@meistrari/auth-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3090 -0
- package/dist/index.d.ts +3090 -0
- package/dist/index.mjs +81 -0
- package/package.json +29 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3090 @@
|
|
|
1
|
+
import * as better_auth from 'better-auth';
|
|
2
|
+
import * as better_auth_plugins_organization from 'better-auth/plugins/organization';
|
|
3
|
+
import { InvitationStatus } from 'better-auth/plugins/organization';
|
|
4
|
+
import * as better_auth_plugins_access from 'better-auth/plugins/access';
|
|
5
|
+
|
|
6
|
+
type Primitive = boolean | number | string
|
|
7
|
+
|
|
8
|
+
type ReadonlyIfObject<Value> = Value extends undefined
|
|
9
|
+
? Value
|
|
10
|
+
: Value extends (...args: any) => any
|
|
11
|
+
? Value
|
|
12
|
+
: Value extends Primitive
|
|
13
|
+
? Value
|
|
14
|
+
: Value extends object
|
|
15
|
+
? Readonly<Value>
|
|
16
|
+
: Value
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Store object.
|
|
20
|
+
*/
|
|
21
|
+
interface ReadableAtom<Value = any> {
|
|
22
|
+
/**
|
|
23
|
+
* Get store value.
|
|
24
|
+
*
|
|
25
|
+
* In contrast with {@link ReadableAtom#value} this value will be always
|
|
26
|
+
* initialized even if store had no listeners.
|
|
27
|
+
*
|
|
28
|
+
* ```js
|
|
29
|
+
* $store.get()
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @returns Store value.
|
|
33
|
+
*/
|
|
34
|
+
get(): Value
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Listeners count.
|
|
38
|
+
*/
|
|
39
|
+
readonly lc: number
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to store changes.
|
|
43
|
+
*
|
|
44
|
+
* In contrast with {@link Store#subscribe} it do not call listener
|
|
45
|
+
* immediately.
|
|
46
|
+
*
|
|
47
|
+
* @param listener Callback with store value and old value.
|
|
48
|
+
* @returns Function to remove listener.
|
|
49
|
+
*/
|
|
50
|
+
listen(
|
|
51
|
+
listener: (
|
|
52
|
+
value: ReadonlyIfObject<Value>,
|
|
53
|
+
oldValue: ReadonlyIfObject<Value>
|
|
54
|
+
) => void
|
|
55
|
+
): () => void
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Low-level method to notify listeners about changes in the store.
|
|
59
|
+
*
|
|
60
|
+
* Can cause unexpected behaviour when combined with frontend frameworks
|
|
61
|
+
* that perform equality checks for values, such as React.
|
|
62
|
+
*/
|
|
63
|
+
notify(oldValue?: ReadonlyIfObject<Value>): void
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Unbind all listeners.
|
|
67
|
+
*/
|
|
68
|
+
off(): void
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Subscribe to store changes and call listener immediately.
|
|
72
|
+
*
|
|
73
|
+
* ```
|
|
74
|
+
* import { $router } from '../store'
|
|
75
|
+
*
|
|
76
|
+
* $router.subscribe(page => {
|
|
77
|
+
* console.log(page)
|
|
78
|
+
* })
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @param listener Callback with store value and old value.
|
|
82
|
+
* @returns Function to remove listener.
|
|
83
|
+
*/
|
|
84
|
+
subscribe(
|
|
85
|
+
listener: (
|
|
86
|
+
value: ReadonlyIfObject<Value>,
|
|
87
|
+
oldValue?: ReadonlyIfObject<Value>
|
|
88
|
+
) => void
|
|
89
|
+
): () => void
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Low-level method to read store’s value without calling `onStart`.
|
|
93
|
+
*
|
|
94
|
+
* Try to use only {@link ReadableAtom#get}.
|
|
95
|
+
* Without subscribers, value can be undefined.
|
|
96
|
+
*/
|
|
97
|
+
readonly value: undefined | Value
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Store with a way to manually change the value.
|
|
102
|
+
*/
|
|
103
|
+
interface WritableAtom<Value = any> extends ReadableAtom<Value> {
|
|
104
|
+
/**
|
|
105
|
+
* Change store value.
|
|
106
|
+
*
|
|
107
|
+
* ```js
|
|
108
|
+
* $router.set({ path: location.pathname, page: parse(location.pathname) })
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* @param newValue New store value.
|
|
112
|
+
*/
|
|
113
|
+
set(newValue: Value): void
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface PreinitializedWritableAtom<Value> extends WritableAtom<Value> {
|
|
117
|
+
readonly value: Value
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>
|
|
121
|
+
|
|
122
|
+
type RetryCondition = (response: Response | null) => boolean | Promise<boolean>;
|
|
123
|
+
type LinearRetry = {
|
|
124
|
+
type: "linear";
|
|
125
|
+
attempts: number;
|
|
126
|
+
delay: number;
|
|
127
|
+
shouldRetry?: RetryCondition;
|
|
128
|
+
};
|
|
129
|
+
type ExponentialRetry = {
|
|
130
|
+
type: "exponential";
|
|
131
|
+
attempts: number;
|
|
132
|
+
baseDelay: number;
|
|
133
|
+
maxDelay: number;
|
|
134
|
+
shouldRetry?: RetryCondition;
|
|
135
|
+
};
|
|
136
|
+
type RetryOptions = LinearRetry | ExponentialRetry | number;
|
|
137
|
+
|
|
138
|
+
/** The Standard Schema interface. */
|
|
139
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
140
|
+
/** The Standard Schema properties. */
|
|
141
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
142
|
+
}
|
|
143
|
+
declare namespace StandardSchemaV1 {
|
|
144
|
+
/** The Standard Schema properties interface. */
|
|
145
|
+
interface Props<Input = unknown, Output = Input> {
|
|
146
|
+
/** The version number of the standard. */
|
|
147
|
+
readonly version: 1;
|
|
148
|
+
/** The vendor name of the schema library. */
|
|
149
|
+
readonly vendor: string;
|
|
150
|
+
/** Validates unknown input values. */
|
|
151
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
152
|
+
/** Inferred types associated with the schema. */
|
|
153
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
154
|
+
}
|
|
155
|
+
/** The result interface of the validate function. */
|
|
156
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
157
|
+
/** The result interface if validation succeeds. */
|
|
158
|
+
interface SuccessResult<Output> {
|
|
159
|
+
/** The typed output value. */
|
|
160
|
+
readonly value: Output;
|
|
161
|
+
/** The non-existent issues. */
|
|
162
|
+
readonly issues?: undefined;
|
|
163
|
+
}
|
|
164
|
+
/** The result interface if validation fails. */
|
|
165
|
+
interface FailureResult {
|
|
166
|
+
/** The issues of failed validation. */
|
|
167
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
168
|
+
}
|
|
169
|
+
/** The issue interface of the failure output. */
|
|
170
|
+
interface Issue {
|
|
171
|
+
/** The error message of the issue. */
|
|
172
|
+
readonly message: string;
|
|
173
|
+
/** The path of the issue, if any. */
|
|
174
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
175
|
+
}
|
|
176
|
+
/** The path segment interface of the issue. */
|
|
177
|
+
interface PathSegment {
|
|
178
|
+
/** The key representing a path segment. */
|
|
179
|
+
readonly key: PropertyKey;
|
|
180
|
+
}
|
|
181
|
+
/** The Standard Schema types interface. */
|
|
182
|
+
interface Types<Input = unknown, Output = Input> {
|
|
183
|
+
/** The input type of the schema. */
|
|
184
|
+
readonly input: Input;
|
|
185
|
+
/** The output type of the schema. */
|
|
186
|
+
readonly output: Output;
|
|
187
|
+
}
|
|
188
|
+
/** Infers the input type of a Standard Schema. */
|
|
189
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
190
|
+
/** Infers the output type of a Standard Schema. */
|
|
191
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
type StringLiteralUnion<T extends string> = T | (string & {});
|
|
195
|
+
type Prettify<T> = {
|
|
196
|
+
[key in keyof T]: T[key];
|
|
197
|
+
} & {};
|
|
198
|
+
|
|
199
|
+
type FetchSchema = {
|
|
200
|
+
input?: StandardSchemaV1;
|
|
201
|
+
output?: StandardSchemaV1;
|
|
202
|
+
query?: StandardSchemaV1;
|
|
203
|
+
params?: StandardSchemaV1<Record<string, unknown>> | undefined;
|
|
204
|
+
method?: Methods;
|
|
205
|
+
};
|
|
206
|
+
type Methods = "get" | "post" | "put" | "patch" | "delete";
|
|
207
|
+
type RouteKey = StringLiteralUnion<`@${Methods}/`>;
|
|
208
|
+
type FetchSchemaRoutes = {
|
|
209
|
+
[key in RouteKey]?: FetchSchema;
|
|
210
|
+
};
|
|
211
|
+
type SchemaConfig = {
|
|
212
|
+
strict?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* A prefix that will be prepended when it's
|
|
215
|
+
* calling the schema.
|
|
216
|
+
*
|
|
217
|
+
* NOTE: Make sure to handle converting
|
|
218
|
+
* the prefix to the baseURL in the init
|
|
219
|
+
* function if you you are defining for a
|
|
220
|
+
* plugin.
|
|
221
|
+
*/
|
|
222
|
+
prefix?: "" | (string & Record<never, never>);
|
|
223
|
+
/**
|
|
224
|
+
* The base url of the schema. By default it's the baseURL of the fetch instance.
|
|
225
|
+
*/
|
|
226
|
+
baseURL?: "" | (string & Record<never, never>);
|
|
227
|
+
};
|
|
228
|
+
type Schema = {
|
|
229
|
+
schema: FetchSchemaRoutes;
|
|
230
|
+
config: SchemaConfig;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
type CreateFetchOption = BetterFetchOption & {
|
|
234
|
+
schema?: Schema;
|
|
235
|
+
/**
|
|
236
|
+
* Catch all error including non api errors. Like schema validation, etc.
|
|
237
|
+
* @default false
|
|
238
|
+
*/
|
|
239
|
+
catchAllError?: boolean;
|
|
240
|
+
defaultOutput?: StandardSchemaV1;
|
|
241
|
+
defaultError?: StandardSchemaV1;
|
|
242
|
+
};
|
|
243
|
+
type WithRequired<T, K extends keyof T | never> = T & {
|
|
244
|
+
[P in K]-?: T[P];
|
|
245
|
+
};
|
|
246
|
+
type InferBody<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : any;
|
|
247
|
+
type RemoveEmptyString<T> = T extends string ? "" extends T ? never : T : T;
|
|
248
|
+
type InferParamPath<Path> = Path extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
249
|
+
[K in Param | keyof InferParamPath<Rest> as RemoveEmptyString<K>]: string;
|
|
250
|
+
} : Path extends `${infer _Start}:${infer Param}` ? {
|
|
251
|
+
[K in Param]: string;
|
|
252
|
+
} : Path extends `${infer _Start}/${infer Rest}` ? InferParamPath<Rest> : {};
|
|
253
|
+
type InferParam<Path, Param> = Param extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Param> : InferParamPath<Path>;
|
|
254
|
+
type InferOptions<T extends FetchSchema, Key, Res = any> = WithRequired<BetterFetchOption<InferBody<T["input"]>, InferQuery<T["query"]>, InferParam<Key, T["params"]>, Res>, RequiredOptionKeys<T, Key> extends keyof BetterFetchOption ? RequiredOptionKeys<T, Key> : never>;
|
|
255
|
+
type InferQuery<Q> = Q extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Q> : any;
|
|
256
|
+
type IsFieldOptional<T> = T extends StandardSchemaV1 ? undefined extends T ? true : false : true;
|
|
257
|
+
type IsParamOptional<T, K> = IsFieldOptional<T> extends false ? false : IsEmptyObject<InferParamPath<K>> extends false ? false : true;
|
|
258
|
+
type IsOptionRequired<T extends FetchSchema, Key> = IsFieldOptional<T["input"]> extends false ? true : IsFieldOptional<T["query"]> extends false ? true : IsParamOptional<T["params"], Key> extends false ? true : false;
|
|
259
|
+
type RequiredOptionKeys<T extends FetchSchema, Key> = (IsFieldOptional<T["input"]> extends false ? "body" : never) | (IsFieldOptional<T["query"]> extends false ? "query" : never) | (IsParamOptional<T["params"], Key> extends false ? "params" : never);
|
|
260
|
+
type InferKey<S> = S extends Schema ? S["config"]["strict"] extends true ? S["config"]["prefix"] extends string ? `${S["config"]["prefix"]}${keyof S["schema"] extends string ? keyof S["schema"] : never}` : S["config"]["baseURL"] extends string ? `${S["config"]["baseURL"]}${keyof S["schema"] extends string ? keyof S["schema"] : never}` : keyof S["schema"] extends string ? keyof S["schema"] : never : S["config"]["prefix"] extends string ? StringLiteralUnion<`${S["config"]["prefix"]}${keyof S["schema"] extends string ? keyof S["schema"] : never}`> : S["config"]["baseURL"] extends string ? StringLiteralUnion<`${S["config"]["baseURL"]}${keyof S["schema"] extends string ? keyof S["schema"] : never}`> : StringLiteralUnion<keyof S["schema"] extends string ? keyof S["schema"] : never> : string;
|
|
261
|
+
type GetKey<S, K> = S extends Schema ? S["config"]["baseURL"] extends string ? K extends `${S["config"]["baseURL"]}${infer AK}` ? AK extends string ? AK : string : S["config"]["prefix"] extends string ? K extends `${S["config"]["prefix"]}${infer AP}` ? AP : string : string : K : K;
|
|
262
|
+
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
263
|
+
type PluginSchema<P> = P extends BetterFetchPlugin ? P["schema"] extends Schema ? P["schema"] : {} : {};
|
|
264
|
+
type MergeSchema<Options extends CreateFetchOption> = Options["plugins"] extends Array<infer P> ? PluginSchema<P> & Options["schema"] : Options["schema"];
|
|
265
|
+
type InferPluginOptions<Options extends CreateFetchOption> = Options["plugins"] extends Array<infer P> ? P extends BetterFetchPlugin ? P["getOptions"] extends () => infer O ? O extends StandardSchemaV1 ? UnionToIntersection<StandardSchemaV1.InferOutput<O>> : {} : {} : {} : {};
|
|
266
|
+
type BetterFetch<CreateOptions extends CreateFetchOption = CreateFetchOption, DefaultRes = CreateOptions["defaultOutput"] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<CreateOptions["defaultOutput"]> : unknown, DefaultErr = CreateOptions["defaultError"] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<CreateOptions["defaultError"]> : unknown, S extends MergeSchema<CreateOptions> = MergeSchema<CreateOptions>> = <Res = DefaultRes, Err = DefaultErr, U extends InferKey<S> = InferKey<S>, K extends GetKey<S, U> = GetKey<S, U>, F extends S extends Schema ? S["schema"][K] : unknown = S extends Schema ? S["schema"][K] : unknown, O extends Omit<BetterFetchOption, "params"> = Omit<BetterFetchOption<any, any, any, Res>, "params">, PluginOptions extends Partial<InferPluginOptions<CreateOptions>> = Partial<InferPluginOptions<CreateOptions>>, Result = BetterFetchResponse<O["output"] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O["output"]> : F extends FetchSchema ? F["output"] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<F["output"]> : Res : Res, Err, O["throw"] extends boolean ? O["throw"] : CreateOptions["throw"] extends true ? true : Err extends false ? true : false>>(url: U, ...options: F extends FetchSchema ? IsOptionRequired<F, K> extends true ? [
|
|
267
|
+
Prettify<InferOptions<F, K, Result extends {
|
|
268
|
+
data: any;
|
|
269
|
+
} ? NonNullable<Result["data"]> : any> & PluginOptions>
|
|
270
|
+
] : [
|
|
271
|
+
Prettify<InferOptions<F, K, Result extends {
|
|
272
|
+
data: any;
|
|
273
|
+
} ? NonNullable<Result["data"]> : any> & PluginOptions>?
|
|
274
|
+
] : [
|
|
275
|
+
Prettify<PluginOptions & O & {
|
|
276
|
+
params?: InferParamPath<K>;
|
|
277
|
+
}>?
|
|
278
|
+
]) => Promise<Result>;
|
|
279
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
280
|
+
type EmptyObject = {
|
|
281
|
+
[emptyObjectSymbol]?: never;
|
|
282
|
+
};
|
|
283
|
+
type IsEmptyObject<T> = T extends EmptyObject ? true : false;
|
|
284
|
+
|
|
285
|
+
declare class BetterFetchError extends Error {
|
|
286
|
+
status: number;
|
|
287
|
+
statusText: string;
|
|
288
|
+
error: any;
|
|
289
|
+
constructor(status: number, statusText: string, error: any);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
type RequestContext<T extends Record<string, any> = any> = {
|
|
293
|
+
url: URL | string;
|
|
294
|
+
headers: Headers;
|
|
295
|
+
body: any;
|
|
296
|
+
method: string;
|
|
297
|
+
signal: AbortSignal;
|
|
298
|
+
} & BetterFetchOption<any, any, any, T>;
|
|
299
|
+
type ResponseContext = {
|
|
300
|
+
response: Response;
|
|
301
|
+
request: RequestContext;
|
|
302
|
+
};
|
|
303
|
+
type SuccessContext<Res = any> = {
|
|
304
|
+
data: Res;
|
|
305
|
+
response: Response;
|
|
306
|
+
request: RequestContext;
|
|
307
|
+
};
|
|
308
|
+
type ErrorContext = {
|
|
309
|
+
response: Response;
|
|
310
|
+
request: RequestContext;
|
|
311
|
+
error: BetterFetchError & Record<string, any>;
|
|
312
|
+
};
|
|
313
|
+
interface FetchHooks<Res = any> {
|
|
314
|
+
/**
|
|
315
|
+
* a callback function that will be called when a
|
|
316
|
+
* request is made.
|
|
317
|
+
*
|
|
318
|
+
* The returned context object will be reassigned to
|
|
319
|
+
* the original request context.
|
|
320
|
+
*/
|
|
321
|
+
onRequest?: <T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void;
|
|
322
|
+
/**
|
|
323
|
+
* a callback function that will be called when
|
|
324
|
+
* response is received. This will be called before
|
|
325
|
+
* the response is parsed and returned.
|
|
326
|
+
*
|
|
327
|
+
* The returned response will be reassigned to the
|
|
328
|
+
* original response if it's changed.
|
|
329
|
+
*/
|
|
330
|
+
onResponse?: (context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void;
|
|
331
|
+
/**
|
|
332
|
+
* a callback function that will be called when a
|
|
333
|
+
* response is successful.
|
|
334
|
+
*/
|
|
335
|
+
onSuccess?: (context: SuccessContext<Res>) => Promise<void> | void;
|
|
336
|
+
/**
|
|
337
|
+
* a callback function that will be called when an
|
|
338
|
+
* error occurs.
|
|
339
|
+
*/
|
|
340
|
+
onError?: (context: ErrorContext) => Promise<void> | void;
|
|
341
|
+
/**
|
|
342
|
+
* a callback function that will be called when a
|
|
343
|
+
* request is retried.
|
|
344
|
+
*/
|
|
345
|
+
onRetry?: (response: ResponseContext) => Promise<void> | void;
|
|
346
|
+
/**
|
|
347
|
+
* Options for the hooks
|
|
348
|
+
*/
|
|
349
|
+
hookOptions?: {
|
|
350
|
+
/**
|
|
351
|
+
* Clone the response
|
|
352
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Response/clone
|
|
353
|
+
*/
|
|
354
|
+
cloneResponse?: boolean;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* A plugin that returns an id and hooks
|
|
359
|
+
*/
|
|
360
|
+
type BetterFetchPlugin = {
|
|
361
|
+
/**
|
|
362
|
+
* A unique id for the plugin
|
|
363
|
+
*/
|
|
364
|
+
id: string;
|
|
365
|
+
/**
|
|
366
|
+
* A name for the plugin
|
|
367
|
+
*/
|
|
368
|
+
name: string;
|
|
369
|
+
/**
|
|
370
|
+
* A description for the plugin
|
|
371
|
+
*/
|
|
372
|
+
description?: string;
|
|
373
|
+
/**
|
|
374
|
+
* A version for the plugin
|
|
375
|
+
*/
|
|
376
|
+
version?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Hooks for the plugin
|
|
379
|
+
*/
|
|
380
|
+
hooks?: FetchHooks;
|
|
381
|
+
/**
|
|
382
|
+
* A function that will be called when the plugin is
|
|
383
|
+
* initialized. This will be called before the any
|
|
384
|
+
* of the other internal functions.
|
|
385
|
+
*
|
|
386
|
+
* The returned options will be merged with the
|
|
387
|
+
* original options.
|
|
388
|
+
*/
|
|
389
|
+
init?: (url: string, options?: BetterFetchOption) => Promise<{
|
|
390
|
+
url: string;
|
|
391
|
+
options?: BetterFetchOption;
|
|
392
|
+
}> | {
|
|
393
|
+
url: string;
|
|
394
|
+
options?: BetterFetchOption;
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* A schema for the plugin
|
|
398
|
+
*/
|
|
399
|
+
schema?: Schema;
|
|
400
|
+
/**
|
|
401
|
+
* Additional options that can be passed to the plugin
|
|
402
|
+
*/
|
|
403
|
+
getOptions?: () => StandardSchemaV1;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
type CommonHeaders = {
|
|
407
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
408
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
409
|
+
authorization: "Bearer" | "Basic";
|
|
410
|
+
};
|
|
411
|
+
type FetchEsque = (input: string | URL | globalThis.Request, init?: RequestInit) => Promise<Response>;
|
|
412
|
+
type PayloadMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
413
|
+
type NonPayloadMethod = "GET" | "HEAD" | "OPTIONS";
|
|
414
|
+
type BetterFetchOption<Body = any, Query extends Record<string, any> = any, Params extends Record<string, any> | Array<string> | undefined = any, Res = any, ExtraOptions extends Record<string, any> = {}> = Prettify<ExtraOptions & Omit<RequestInit, "body"> & FetchHooks<Res> & {
|
|
415
|
+
/**
|
|
416
|
+
* a timeout that will be used to abort the
|
|
417
|
+
* request. Should be in milliseconds.
|
|
418
|
+
*/
|
|
419
|
+
timeout?: number;
|
|
420
|
+
/**
|
|
421
|
+
* Custom fetch implementation
|
|
422
|
+
*/
|
|
423
|
+
customFetchImpl?: FetchEsque;
|
|
424
|
+
/**
|
|
425
|
+
* Better fetch plugins
|
|
426
|
+
* @see https://better-fetch.vercel.app/docs/plugins
|
|
427
|
+
*/
|
|
428
|
+
plugins?: BetterFetchPlugin[];
|
|
429
|
+
/**
|
|
430
|
+
* Base url that will be prepended to the url passed
|
|
431
|
+
* to the fetch function
|
|
432
|
+
*/
|
|
433
|
+
baseURL?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Throw if the request fails.
|
|
436
|
+
*
|
|
437
|
+
* By default better fetch responds error as a
|
|
438
|
+
* value. But if you like it to throw instead you
|
|
439
|
+
* can pass throw:true here.
|
|
440
|
+
* @default false
|
|
441
|
+
*/
|
|
442
|
+
throw?: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Authorization headers
|
|
445
|
+
*/
|
|
446
|
+
auth?: Auth;
|
|
447
|
+
/**
|
|
448
|
+
* Headers
|
|
449
|
+
*/
|
|
450
|
+
headers?: CommonHeaders | Headers | HeadersInit;
|
|
451
|
+
/**
|
|
452
|
+
* Body
|
|
453
|
+
*/
|
|
454
|
+
body?: Body;
|
|
455
|
+
/**
|
|
456
|
+
* Query parameters (key-value pairs)
|
|
457
|
+
*/
|
|
458
|
+
query?: Query;
|
|
459
|
+
/**
|
|
460
|
+
* Dynamic parameters.
|
|
461
|
+
*
|
|
462
|
+
* If url is defined as /path/:id, params will be { id: string }
|
|
463
|
+
*/
|
|
464
|
+
params?: Params;
|
|
465
|
+
/**
|
|
466
|
+
* Duplex mode
|
|
467
|
+
*/
|
|
468
|
+
duplex?: "full" | "half";
|
|
469
|
+
/**
|
|
470
|
+
* Custom JSON parser
|
|
471
|
+
*/
|
|
472
|
+
jsonParser?: (text: string) => Promise<any> | any;
|
|
473
|
+
/**
|
|
474
|
+
* Retry count
|
|
475
|
+
*/
|
|
476
|
+
retry?: RetryOptions;
|
|
477
|
+
/**
|
|
478
|
+
* the number of times the request has already been retried
|
|
479
|
+
*/
|
|
480
|
+
retryAttempt?: number;
|
|
481
|
+
/**
|
|
482
|
+
* HTTP method
|
|
483
|
+
*/
|
|
484
|
+
method?: StringLiteralUnion<PayloadMethod | NonPayloadMethod>;
|
|
485
|
+
/**
|
|
486
|
+
* Expected output schema
|
|
487
|
+
* You can use this to infer the response
|
|
488
|
+
* type and to validate the response.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* const { data, error } = await $fetch
|
|
493
|
+
* ("https://jsonplaceholder.typicode.com/
|
|
494
|
+
* todos/1", {
|
|
495
|
+
* output: z.object({
|
|
496
|
+
* userId: z.number(),
|
|
497
|
+
* id: z.number(),
|
|
498
|
+
* title: z.string(),
|
|
499
|
+
* completed: z.boolean(),
|
|
500
|
+
* }),
|
|
501
|
+
* });
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
output?: StandardSchemaV1 | typeof Blob | typeof File;
|
|
505
|
+
/**
|
|
506
|
+
* Additional error schema for the error object if the
|
|
507
|
+
* response fails.
|
|
508
|
+
*/
|
|
509
|
+
errorSchema?: StandardSchemaV1;
|
|
510
|
+
/**
|
|
511
|
+
* Disable validation for the response
|
|
512
|
+
* @default false
|
|
513
|
+
*/
|
|
514
|
+
disableValidation?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Abort signal
|
|
517
|
+
*/
|
|
518
|
+
signal?: AbortSignal | null;
|
|
519
|
+
}>;
|
|
520
|
+
type Data<T> = {
|
|
521
|
+
data: T;
|
|
522
|
+
error: null;
|
|
523
|
+
};
|
|
524
|
+
type Error$1<E> = {
|
|
525
|
+
data: null;
|
|
526
|
+
error: Prettify<(E extends Record<string, any> ? E : {
|
|
527
|
+
message?: string;
|
|
528
|
+
}) & {
|
|
529
|
+
status: number;
|
|
530
|
+
statusText: string;
|
|
531
|
+
}>;
|
|
532
|
+
};
|
|
533
|
+
type BetterFetchResponse<T, E extends Record<string, unknown> | unknown = unknown, Throw extends boolean = false> = Throw extends true ? T : Data<T> | Error$1<E>;
|
|
534
|
+
|
|
535
|
+
type typeOrTypeReturning<T> = T | (() => T);
|
|
536
|
+
/**
|
|
537
|
+
* Bearer token authentication
|
|
538
|
+
*
|
|
539
|
+
* the value of `token` will be added to a header as
|
|
540
|
+
* `auth: Bearer token`,
|
|
541
|
+
*/
|
|
542
|
+
type Bearer = {
|
|
543
|
+
type: "Bearer";
|
|
544
|
+
token: typeOrTypeReturning<string | undefined | Promise<string | undefined>>;
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* Basic auth
|
|
548
|
+
*/
|
|
549
|
+
type Basic = {
|
|
550
|
+
type: "Basic";
|
|
551
|
+
username: typeOrTypeReturning<string | undefined>;
|
|
552
|
+
password: typeOrTypeReturning<string | undefined>;
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Custom auth
|
|
556
|
+
*
|
|
557
|
+
* @param prefix - prefix of the header
|
|
558
|
+
* @param value - value of the header
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts
|
|
562
|
+
* {
|
|
563
|
+
* type: "Custom",
|
|
564
|
+
* prefix: "Token",
|
|
565
|
+
* value: "token"
|
|
566
|
+
* }
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
type Custom = {
|
|
570
|
+
type: "Custom";
|
|
571
|
+
prefix: typeOrTypeReturning<string | undefined>;
|
|
572
|
+
value: typeOrTypeReturning<string | undefined>;
|
|
573
|
+
};
|
|
574
|
+
type Auth = Bearer | Basic | Custom;
|
|
575
|
+
|
|
576
|
+
declare function isTokenExpired(token: string): any;
|
|
577
|
+
declare function validateToken(token: string, apiUrl: string): Promise<boolean>;
|
|
578
|
+
declare const ac: {
|
|
579
|
+
newRole<K extends "member" | "access" | "organization" | "invitation" | "team" | "ac">(statements: better_auth_plugins_access.Subset<K, {
|
|
580
|
+
access: string[];
|
|
581
|
+
organization: readonly ["update", "delete"];
|
|
582
|
+
member: readonly ["create", "update", "delete"];
|
|
583
|
+
invitation: readonly ["create", "cancel"];
|
|
584
|
+
team: readonly ["create", "update", "delete"];
|
|
585
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
586
|
+
}>): {
|
|
587
|
+
authorize<K_1 extends K>(request: K_1 extends infer T extends K_2 ? { [key in T]?: better_auth_plugins_access.Subset<K, {
|
|
588
|
+
access: string[];
|
|
589
|
+
organization: readonly ["update", "delete"];
|
|
590
|
+
member: readonly ["create", "update", "delete"];
|
|
591
|
+
invitation: readonly ["create", "cancel"];
|
|
592
|
+
team: readonly ["create", "update", "delete"];
|
|
593
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
594
|
+
}>[key] | {
|
|
595
|
+
actions: better_auth_plugins_access.Subset<K, {
|
|
596
|
+
access: string[];
|
|
597
|
+
organization: readonly ["update", "delete"];
|
|
598
|
+
member: readonly ["create", "update", "delete"];
|
|
599
|
+
invitation: readonly ["create", "cancel"];
|
|
600
|
+
team: readonly ["create", "update", "delete"];
|
|
601
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
602
|
+
}>[key];
|
|
603
|
+
connector: "OR" | "AND";
|
|
604
|
+
} | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse;
|
|
605
|
+
statements: better_auth_plugins_access.Subset<K, {
|
|
606
|
+
access: string[];
|
|
607
|
+
organization: readonly ["update", "delete"];
|
|
608
|
+
member: readonly ["create", "update", "delete"];
|
|
609
|
+
invitation: readonly ["create", "cancel"];
|
|
610
|
+
team: readonly ["create", "update", "delete"];
|
|
611
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
612
|
+
}>;
|
|
613
|
+
};
|
|
614
|
+
statements: {
|
|
615
|
+
access: string[];
|
|
616
|
+
organization: readonly ["update", "delete"];
|
|
617
|
+
member: readonly ["create", "update", "delete"];
|
|
618
|
+
invitation: readonly ["create", "cancel"];
|
|
619
|
+
team: readonly ["create", "update", "delete"];
|
|
620
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
621
|
+
};
|
|
622
|
+
};
|
|
623
|
+
declare const Roles: {
|
|
624
|
+
readonly ORG_ADMIN: "org:admin";
|
|
625
|
+
readonly ORG_MEMBER: "org:member";
|
|
626
|
+
readonly ORG_REVIEWER: "org:reviewer";
|
|
627
|
+
};
|
|
628
|
+
type Role = typeof Roles[keyof typeof Roles];
|
|
629
|
+
declare const rolesAccessControl: {
|
|
630
|
+
"org:admin": {
|
|
631
|
+
authorize<K_1 extends "member" | "access" | "organization" | "invitation" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"member" | "access" | "organization" | "invitation" | "team", {
|
|
632
|
+
access: string[];
|
|
633
|
+
organization: readonly ["update", "delete"];
|
|
634
|
+
member: readonly ["create", "update", "delete"];
|
|
635
|
+
invitation: readonly ["create", "cancel"];
|
|
636
|
+
team: readonly ["create", "update", "delete"];
|
|
637
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
638
|
+
}>[key] | {
|
|
639
|
+
actions: better_auth_plugins_access.Subset<"member" | "access" | "organization" | "invitation" | "team", {
|
|
640
|
+
access: string[];
|
|
641
|
+
organization: readonly ["update", "delete"];
|
|
642
|
+
member: readonly ["create", "update", "delete"];
|
|
643
|
+
invitation: readonly ["create", "cancel"];
|
|
644
|
+
team: readonly ["create", "update", "delete"];
|
|
645
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
646
|
+
}>[key];
|
|
647
|
+
connector: "OR" | "AND";
|
|
648
|
+
} | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse;
|
|
649
|
+
statements: better_auth_plugins_access.Subset<"member" | "access" | "organization" | "invitation" | "team", {
|
|
650
|
+
access: string[];
|
|
651
|
+
organization: readonly ["update", "delete"];
|
|
652
|
+
member: readonly ["create", "update", "delete"];
|
|
653
|
+
invitation: readonly ["create", "cancel"];
|
|
654
|
+
team: readonly ["create", "update", "delete"];
|
|
655
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
656
|
+
}>;
|
|
657
|
+
};
|
|
658
|
+
"org:member": {
|
|
659
|
+
authorize<K_1 extends "access">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"access", {
|
|
660
|
+
access: string[];
|
|
661
|
+
organization: readonly ["update", "delete"];
|
|
662
|
+
member: readonly ["create", "update", "delete"];
|
|
663
|
+
invitation: readonly ["create", "cancel"];
|
|
664
|
+
team: readonly ["create", "update", "delete"];
|
|
665
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
666
|
+
}>[key] | {
|
|
667
|
+
actions: better_auth_plugins_access.Subset<"access", {
|
|
668
|
+
access: string[];
|
|
669
|
+
organization: readonly ["update", "delete"];
|
|
670
|
+
member: readonly ["create", "update", "delete"];
|
|
671
|
+
invitation: readonly ["create", "cancel"];
|
|
672
|
+
team: readonly ["create", "update", "delete"];
|
|
673
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
674
|
+
}>[key];
|
|
675
|
+
connector: "OR" | "AND";
|
|
676
|
+
} | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse;
|
|
677
|
+
statements: better_auth_plugins_access.Subset<"access", {
|
|
678
|
+
access: string[];
|
|
679
|
+
organization: readonly ["update", "delete"];
|
|
680
|
+
member: readonly ["create", "update", "delete"];
|
|
681
|
+
invitation: readonly ["create", "cancel"];
|
|
682
|
+
team: readonly ["create", "update", "delete"];
|
|
683
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
684
|
+
}>;
|
|
685
|
+
};
|
|
686
|
+
"org:reviewer": {
|
|
687
|
+
authorize<K_1 extends "access">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins_access.Subset<"access", {
|
|
688
|
+
access: string[];
|
|
689
|
+
organization: readonly ["update", "delete"];
|
|
690
|
+
member: readonly ["create", "update", "delete"];
|
|
691
|
+
invitation: readonly ["create", "cancel"];
|
|
692
|
+
team: readonly ["create", "update", "delete"];
|
|
693
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
694
|
+
}>[key] | {
|
|
695
|
+
actions: better_auth_plugins_access.Subset<"access", {
|
|
696
|
+
access: string[];
|
|
697
|
+
organization: readonly ["update", "delete"];
|
|
698
|
+
member: readonly ["create", "update", "delete"];
|
|
699
|
+
invitation: readonly ["create", "cancel"];
|
|
700
|
+
team: readonly ["create", "update", "delete"];
|
|
701
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
702
|
+
}>[key];
|
|
703
|
+
connector: "OR" | "AND";
|
|
704
|
+
} | undefined; } : never, connector?: "OR" | "AND"): better_auth_plugins_access.AuthorizeResponse;
|
|
705
|
+
statements: better_auth_plugins_access.Subset<"access", {
|
|
706
|
+
access: string[];
|
|
707
|
+
organization: readonly ["update", "delete"];
|
|
708
|
+
member: readonly ["create", "update", "delete"];
|
|
709
|
+
invitation: readonly ["create", "cancel"];
|
|
710
|
+
team: readonly ["create", "update", "delete"];
|
|
711
|
+
ac: readonly ["create", "read", "update", "delete"];
|
|
712
|
+
}>;
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
/**
|
|
716
|
+
* Creates an authentication client configured with organization and custom endpoints support
|
|
717
|
+
* @param baseURL - The base URL for the authentication service
|
|
718
|
+
* @param version - SDK version for User-Agent header
|
|
719
|
+
* @returns Configured BetterAuth client instance
|
|
720
|
+
*/
|
|
721
|
+
declare function createAuthClient(baseURL: string): {
|
|
722
|
+
useActiveOrganization: PreinitializedWritableAtom<{
|
|
723
|
+
data: better_auth.Prettify<{
|
|
724
|
+
id: string;
|
|
725
|
+
name: string;
|
|
726
|
+
slug: string;
|
|
727
|
+
createdAt: Date;
|
|
728
|
+
logo?: string | null | undefined;
|
|
729
|
+
metadata?: any;
|
|
730
|
+
} & {
|
|
731
|
+
members: (better_auth_plugins_organization.Member & {
|
|
732
|
+
user: {
|
|
733
|
+
id: string;
|
|
734
|
+
name: string;
|
|
735
|
+
email: string;
|
|
736
|
+
image: string | undefined;
|
|
737
|
+
};
|
|
738
|
+
})[];
|
|
739
|
+
invitations: better_auth_plugins_organization.Invitation[];
|
|
740
|
+
}> | null;
|
|
741
|
+
error: null | BetterFetchError;
|
|
742
|
+
isPending: boolean;
|
|
743
|
+
isRefetching: boolean;
|
|
744
|
+
refetch: (queryParams?: {
|
|
745
|
+
query?: better_auth.SessionQueryParams;
|
|
746
|
+
} | undefined) => void;
|
|
747
|
+
}> & object;
|
|
748
|
+
useListOrganizations: PreinitializedWritableAtom<{
|
|
749
|
+
data: {
|
|
750
|
+
id: string;
|
|
751
|
+
name: string;
|
|
752
|
+
slug: string;
|
|
753
|
+
createdAt: Date;
|
|
754
|
+
logo?: string | null | undefined;
|
|
755
|
+
metadata?: any;
|
|
756
|
+
}[] | null;
|
|
757
|
+
error: null | BetterFetchError;
|
|
758
|
+
isPending: boolean;
|
|
759
|
+
isRefetching: boolean;
|
|
760
|
+
refetch: (queryParams?: {
|
|
761
|
+
query?: better_auth.SessionQueryParams;
|
|
762
|
+
} | undefined) => void;
|
|
763
|
+
}> & object;
|
|
764
|
+
useActiveMember: PreinitializedWritableAtom<{
|
|
765
|
+
data: {
|
|
766
|
+
id: string;
|
|
767
|
+
organizationId: string;
|
|
768
|
+
userId: string;
|
|
769
|
+
role: string;
|
|
770
|
+
createdAt: Date;
|
|
771
|
+
} | null;
|
|
772
|
+
error: null | BetterFetchError;
|
|
773
|
+
isPending: boolean;
|
|
774
|
+
isRefetching: boolean;
|
|
775
|
+
refetch: (queryParams?: {
|
|
776
|
+
query?: better_auth.SessionQueryParams;
|
|
777
|
+
} | undefined) => void;
|
|
778
|
+
}> & object;
|
|
779
|
+
useActiveMemberRole: PreinitializedWritableAtom<{
|
|
780
|
+
data: {
|
|
781
|
+
role: string;
|
|
782
|
+
} | null;
|
|
783
|
+
error: null | BetterFetchError;
|
|
784
|
+
isPending: boolean;
|
|
785
|
+
isRefetching: boolean;
|
|
786
|
+
refetch: (queryParams?: {
|
|
787
|
+
query?: better_auth.SessionQueryParams;
|
|
788
|
+
} | undefined) => void;
|
|
789
|
+
}> & object;
|
|
790
|
+
} & {
|
|
791
|
+
signIn: {
|
|
792
|
+
social: <FetchOptions extends {
|
|
793
|
+
method?: string | undefined;
|
|
794
|
+
cache?: RequestCache | undefined;
|
|
795
|
+
credentials?: RequestCredentials | undefined;
|
|
796
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
797
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
798
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
799
|
+
authorization: "Bearer" | "Basic";
|
|
800
|
+
})) | undefined;
|
|
801
|
+
integrity?: string | undefined;
|
|
802
|
+
keepalive?: boolean | undefined;
|
|
803
|
+
mode?: RequestMode | undefined;
|
|
804
|
+
priority?: RequestPriority | undefined;
|
|
805
|
+
redirect?: RequestRedirect | undefined;
|
|
806
|
+
referrer?: string | undefined;
|
|
807
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
808
|
+
signal?: (AbortSignal | null) | undefined;
|
|
809
|
+
window?: null | undefined;
|
|
810
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
811
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
812
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
813
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
814
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
815
|
+
hookOptions?: {
|
|
816
|
+
cloneResponse?: boolean;
|
|
817
|
+
} | undefined;
|
|
818
|
+
timeout?: number | undefined;
|
|
819
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
820
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
821
|
+
baseURL?: string | undefined;
|
|
822
|
+
throw?: boolean | undefined;
|
|
823
|
+
auth?: ({
|
|
824
|
+
type: "Bearer";
|
|
825
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
826
|
+
} | {
|
|
827
|
+
type: "Basic";
|
|
828
|
+
username: string | (() => string | undefined) | undefined;
|
|
829
|
+
password: string | (() => string | undefined) | undefined;
|
|
830
|
+
} | {
|
|
831
|
+
type: "Custom";
|
|
832
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
833
|
+
value: string | (() => string | undefined) | undefined;
|
|
834
|
+
}) | undefined;
|
|
835
|
+
body?: (Partial<{
|
|
836
|
+
provider: unknown;
|
|
837
|
+
callbackURL?: string | undefined;
|
|
838
|
+
newUserCallbackURL?: string | undefined;
|
|
839
|
+
errorCallbackURL?: string | undefined;
|
|
840
|
+
disableRedirect?: boolean | undefined;
|
|
841
|
+
idToken?: {
|
|
842
|
+
token: string;
|
|
843
|
+
nonce?: string | undefined;
|
|
844
|
+
accessToken?: string | undefined;
|
|
845
|
+
refreshToken?: string | undefined;
|
|
846
|
+
expiresAt?: number | undefined;
|
|
847
|
+
} | undefined;
|
|
848
|
+
scopes?: string[] | undefined;
|
|
849
|
+
requestSignUp?: boolean | undefined;
|
|
850
|
+
loginHint?: string | undefined;
|
|
851
|
+
}> & Record<string, any>) | undefined;
|
|
852
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
853
|
+
params?: Record<string, any> | undefined;
|
|
854
|
+
duplex?: "full" | "half" | undefined;
|
|
855
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
856
|
+
retry?: RetryOptions | undefined;
|
|
857
|
+
retryAttempt?: number | undefined;
|
|
858
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
859
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
860
|
+
disableValidation?: boolean | undefined;
|
|
861
|
+
}>(data_0: better_auth.Prettify<{
|
|
862
|
+
provider: unknown;
|
|
863
|
+
callbackURL?: string | undefined;
|
|
864
|
+
newUserCallbackURL?: string | undefined;
|
|
865
|
+
errorCallbackURL?: string | undefined;
|
|
866
|
+
disableRedirect?: boolean | undefined;
|
|
867
|
+
idToken?: {
|
|
868
|
+
token: string;
|
|
869
|
+
nonce?: string | undefined;
|
|
870
|
+
accessToken?: string | undefined;
|
|
871
|
+
refreshToken?: string | undefined;
|
|
872
|
+
expiresAt?: number | undefined;
|
|
873
|
+
} | undefined;
|
|
874
|
+
scopes?: string[] | undefined;
|
|
875
|
+
requestSignUp?: boolean | undefined;
|
|
876
|
+
loginHint?: string | undefined;
|
|
877
|
+
} & {
|
|
878
|
+
fetchOptions?: FetchOptions | undefined;
|
|
879
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<NonNullable<{
|
|
880
|
+
redirect: boolean;
|
|
881
|
+
token: string;
|
|
882
|
+
url: undefined;
|
|
883
|
+
user: {
|
|
884
|
+
id: string;
|
|
885
|
+
email: string;
|
|
886
|
+
name: string;
|
|
887
|
+
image: string | null | undefined;
|
|
888
|
+
emailVerified: boolean;
|
|
889
|
+
createdAt: Date;
|
|
890
|
+
updatedAt: Date;
|
|
891
|
+
};
|
|
892
|
+
} | {
|
|
893
|
+
url: string;
|
|
894
|
+
redirect: boolean;
|
|
895
|
+
}>, {
|
|
896
|
+
code?: string;
|
|
897
|
+
message?: string;
|
|
898
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
899
|
+
};
|
|
900
|
+
} & {
|
|
901
|
+
signOut: <FetchOptions extends {
|
|
902
|
+
method?: string | undefined;
|
|
903
|
+
cache?: RequestCache | undefined;
|
|
904
|
+
credentials?: RequestCredentials | undefined;
|
|
905
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
906
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
907
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
908
|
+
authorization: "Bearer" | "Basic";
|
|
909
|
+
})) | undefined;
|
|
910
|
+
integrity?: string | undefined;
|
|
911
|
+
keepalive?: boolean | undefined;
|
|
912
|
+
mode?: RequestMode | undefined;
|
|
913
|
+
priority?: RequestPriority | undefined;
|
|
914
|
+
redirect?: RequestRedirect | undefined;
|
|
915
|
+
referrer?: string | undefined;
|
|
916
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
917
|
+
signal?: (AbortSignal | null) | undefined;
|
|
918
|
+
window?: null | undefined;
|
|
919
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
920
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
921
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
922
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
923
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
924
|
+
hookOptions?: {
|
|
925
|
+
cloneResponse?: boolean;
|
|
926
|
+
} | undefined;
|
|
927
|
+
timeout?: number | undefined;
|
|
928
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
929
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
930
|
+
baseURL?: string | undefined;
|
|
931
|
+
throw?: boolean | undefined;
|
|
932
|
+
auth?: ({
|
|
933
|
+
type: "Bearer";
|
|
934
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
935
|
+
} | {
|
|
936
|
+
type: "Basic";
|
|
937
|
+
username: string | (() => string | undefined) | undefined;
|
|
938
|
+
password: string | (() => string | undefined) | undefined;
|
|
939
|
+
} | {
|
|
940
|
+
type: "Custom";
|
|
941
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
942
|
+
value: string | (() => string | undefined) | undefined;
|
|
943
|
+
}) | undefined;
|
|
944
|
+
body?: undefined;
|
|
945
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
946
|
+
params?: Record<string, any> | undefined;
|
|
947
|
+
duplex?: "full" | "half" | undefined;
|
|
948
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
949
|
+
retry?: RetryOptions | undefined;
|
|
950
|
+
retryAttempt?: number | undefined;
|
|
951
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
952
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
953
|
+
disableValidation?: boolean | undefined;
|
|
954
|
+
}>(data_0?: better_auth.Prettify<{
|
|
955
|
+
query?: Record<string, any> | undefined;
|
|
956
|
+
fetchOptions?: FetchOptions | undefined;
|
|
957
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
958
|
+
success: boolean;
|
|
959
|
+
}, {
|
|
960
|
+
code?: string;
|
|
961
|
+
message?: string;
|
|
962
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
963
|
+
} & {
|
|
964
|
+
signUp: {
|
|
965
|
+
email: <FetchOptions extends {
|
|
966
|
+
method?: string | undefined;
|
|
967
|
+
cache?: RequestCache | undefined;
|
|
968
|
+
credentials?: RequestCredentials | undefined;
|
|
969
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
970
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
971
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
972
|
+
authorization: "Bearer" | "Basic";
|
|
973
|
+
})) | undefined;
|
|
974
|
+
integrity?: string | undefined;
|
|
975
|
+
keepalive?: boolean | undefined;
|
|
976
|
+
mode?: RequestMode | undefined;
|
|
977
|
+
priority?: RequestPriority | undefined;
|
|
978
|
+
redirect?: RequestRedirect | undefined;
|
|
979
|
+
referrer?: string | undefined;
|
|
980
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
981
|
+
signal?: (AbortSignal | null) | undefined;
|
|
982
|
+
window?: null | undefined;
|
|
983
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
984
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
985
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
986
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
987
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
988
|
+
hookOptions?: {
|
|
989
|
+
cloneResponse?: boolean;
|
|
990
|
+
} | undefined;
|
|
991
|
+
timeout?: number | undefined;
|
|
992
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
993
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
994
|
+
baseURL?: string | undefined;
|
|
995
|
+
throw?: boolean | undefined;
|
|
996
|
+
auth?: ({
|
|
997
|
+
type: "Bearer";
|
|
998
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
999
|
+
} | {
|
|
1000
|
+
type: "Basic";
|
|
1001
|
+
username: string | (() => string | undefined) | undefined;
|
|
1002
|
+
password: string | (() => string | undefined) | undefined;
|
|
1003
|
+
} | {
|
|
1004
|
+
type: "Custom";
|
|
1005
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1006
|
+
value: string | (() => string | undefined) | undefined;
|
|
1007
|
+
}) | undefined;
|
|
1008
|
+
body?: (Partial<{
|
|
1009
|
+
name: string;
|
|
1010
|
+
email: string;
|
|
1011
|
+
password: string;
|
|
1012
|
+
image?: string;
|
|
1013
|
+
callbackURL?: string;
|
|
1014
|
+
rememberMe?: boolean;
|
|
1015
|
+
}> & Record<string, any>) | undefined;
|
|
1016
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1017
|
+
params?: Record<string, any> | undefined;
|
|
1018
|
+
duplex?: "full" | "half" | undefined;
|
|
1019
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1020
|
+
retry?: RetryOptions | undefined;
|
|
1021
|
+
retryAttempt?: number | undefined;
|
|
1022
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1023
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1024
|
+
disableValidation?: boolean | undefined;
|
|
1025
|
+
}>(data_0: better_auth.Prettify<{
|
|
1026
|
+
email: string;
|
|
1027
|
+
name: string;
|
|
1028
|
+
password: string;
|
|
1029
|
+
image?: string;
|
|
1030
|
+
callbackURL?: string;
|
|
1031
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1032
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<NonNullable<{
|
|
1033
|
+
token: null;
|
|
1034
|
+
user: {
|
|
1035
|
+
id: string;
|
|
1036
|
+
email: string;
|
|
1037
|
+
name: string;
|
|
1038
|
+
image: string | null | undefined;
|
|
1039
|
+
emailVerified: boolean;
|
|
1040
|
+
createdAt: Date;
|
|
1041
|
+
updatedAt: Date;
|
|
1042
|
+
};
|
|
1043
|
+
} | {
|
|
1044
|
+
token: string;
|
|
1045
|
+
user: {
|
|
1046
|
+
id: string;
|
|
1047
|
+
email: string;
|
|
1048
|
+
name: string;
|
|
1049
|
+
image: string | null | undefined;
|
|
1050
|
+
emailVerified: boolean;
|
|
1051
|
+
createdAt: Date;
|
|
1052
|
+
updatedAt: Date;
|
|
1053
|
+
};
|
|
1054
|
+
}>, {
|
|
1055
|
+
code?: string;
|
|
1056
|
+
message?: string;
|
|
1057
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1058
|
+
};
|
|
1059
|
+
} & {
|
|
1060
|
+
signIn: {
|
|
1061
|
+
email: <FetchOptions extends {
|
|
1062
|
+
method?: string | undefined;
|
|
1063
|
+
cache?: RequestCache | undefined;
|
|
1064
|
+
credentials?: RequestCredentials | undefined;
|
|
1065
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1066
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1067
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1068
|
+
authorization: "Bearer" | "Basic";
|
|
1069
|
+
})) | undefined;
|
|
1070
|
+
integrity?: string | undefined;
|
|
1071
|
+
keepalive?: boolean | undefined;
|
|
1072
|
+
mode?: RequestMode | undefined;
|
|
1073
|
+
priority?: RequestPriority | undefined;
|
|
1074
|
+
redirect?: RequestRedirect | undefined;
|
|
1075
|
+
referrer?: string | undefined;
|
|
1076
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1077
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1078
|
+
window?: null | undefined;
|
|
1079
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1080
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1081
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1082
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1083
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1084
|
+
hookOptions?: {
|
|
1085
|
+
cloneResponse?: boolean;
|
|
1086
|
+
} | undefined;
|
|
1087
|
+
timeout?: number | undefined;
|
|
1088
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1089
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1090
|
+
baseURL?: string | undefined;
|
|
1091
|
+
throw?: boolean | undefined;
|
|
1092
|
+
auth?: ({
|
|
1093
|
+
type: "Bearer";
|
|
1094
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1095
|
+
} | {
|
|
1096
|
+
type: "Basic";
|
|
1097
|
+
username: string | (() => string | undefined) | undefined;
|
|
1098
|
+
password: string | (() => string | undefined) | undefined;
|
|
1099
|
+
} | {
|
|
1100
|
+
type: "Custom";
|
|
1101
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1102
|
+
value: string | (() => string | undefined) | undefined;
|
|
1103
|
+
}) | undefined;
|
|
1104
|
+
body?: (Partial<{
|
|
1105
|
+
email: string;
|
|
1106
|
+
password: string;
|
|
1107
|
+
callbackURL?: string | undefined;
|
|
1108
|
+
rememberMe?: boolean | undefined;
|
|
1109
|
+
}> & Record<string, any>) | undefined;
|
|
1110
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1111
|
+
params?: Record<string, any> | undefined;
|
|
1112
|
+
duplex?: "full" | "half" | undefined;
|
|
1113
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1114
|
+
retry?: RetryOptions | undefined;
|
|
1115
|
+
retryAttempt?: number | undefined;
|
|
1116
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1117
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1118
|
+
disableValidation?: boolean | undefined;
|
|
1119
|
+
}>(data_0: better_auth.Prettify<{
|
|
1120
|
+
email: string;
|
|
1121
|
+
password: string;
|
|
1122
|
+
callbackURL?: string | undefined;
|
|
1123
|
+
rememberMe?: boolean | undefined;
|
|
1124
|
+
} & {
|
|
1125
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1126
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1127
|
+
redirect: boolean;
|
|
1128
|
+
token: string;
|
|
1129
|
+
url: string | undefined;
|
|
1130
|
+
user: {
|
|
1131
|
+
id: string;
|
|
1132
|
+
email: string;
|
|
1133
|
+
name: string;
|
|
1134
|
+
image: string | null | undefined;
|
|
1135
|
+
emailVerified: boolean;
|
|
1136
|
+
createdAt: Date;
|
|
1137
|
+
updatedAt: Date;
|
|
1138
|
+
};
|
|
1139
|
+
}, {
|
|
1140
|
+
code?: string;
|
|
1141
|
+
message?: string;
|
|
1142
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1143
|
+
};
|
|
1144
|
+
} & {
|
|
1145
|
+
forgetPassword: <FetchOptions extends {
|
|
1146
|
+
method?: string | undefined;
|
|
1147
|
+
cache?: RequestCache | undefined;
|
|
1148
|
+
credentials?: RequestCredentials | undefined;
|
|
1149
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1150
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1151
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1152
|
+
authorization: "Bearer" | "Basic";
|
|
1153
|
+
})) | undefined;
|
|
1154
|
+
integrity?: string | undefined;
|
|
1155
|
+
keepalive?: boolean | undefined;
|
|
1156
|
+
mode?: RequestMode | undefined;
|
|
1157
|
+
priority?: RequestPriority | undefined;
|
|
1158
|
+
redirect?: RequestRedirect | undefined;
|
|
1159
|
+
referrer?: string | undefined;
|
|
1160
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1161
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1162
|
+
window?: null | undefined;
|
|
1163
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1164
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1165
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1166
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1167
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1168
|
+
hookOptions?: {
|
|
1169
|
+
cloneResponse?: boolean;
|
|
1170
|
+
} | undefined;
|
|
1171
|
+
timeout?: number | undefined;
|
|
1172
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1173
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1174
|
+
baseURL?: string | undefined;
|
|
1175
|
+
throw?: boolean | undefined;
|
|
1176
|
+
auth?: ({
|
|
1177
|
+
type: "Bearer";
|
|
1178
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1179
|
+
} | {
|
|
1180
|
+
type: "Basic";
|
|
1181
|
+
username: string | (() => string | undefined) | undefined;
|
|
1182
|
+
password: string | (() => string | undefined) | undefined;
|
|
1183
|
+
} | {
|
|
1184
|
+
type: "Custom";
|
|
1185
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1186
|
+
value: string | (() => string | undefined) | undefined;
|
|
1187
|
+
}) | undefined;
|
|
1188
|
+
body?: (Partial<{
|
|
1189
|
+
email: string;
|
|
1190
|
+
redirectTo?: string | undefined;
|
|
1191
|
+
}> & Record<string, any>) | undefined;
|
|
1192
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1193
|
+
params?: Record<string, any> | undefined;
|
|
1194
|
+
duplex?: "full" | "half" | undefined;
|
|
1195
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1196
|
+
retry?: RetryOptions | undefined;
|
|
1197
|
+
retryAttempt?: number | undefined;
|
|
1198
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1199
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1200
|
+
disableValidation?: boolean | undefined;
|
|
1201
|
+
}>(data_0: better_auth.Prettify<{
|
|
1202
|
+
email: string;
|
|
1203
|
+
redirectTo?: string | undefined;
|
|
1204
|
+
} & {
|
|
1205
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1206
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1207
|
+
status: boolean;
|
|
1208
|
+
}, {
|
|
1209
|
+
code?: string;
|
|
1210
|
+
message?: string;
|
|
1211
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1212
|
+
} & {
|
|
1213
|
+
resetPassword: <FetchOptions extends {
|
|
1214
|
+
method?: string | undefined;
|
|
1215
|
+
cache?: RequestCache | undefined;
|
|
1216
|
+
credentials?: RequestCredentials | undefined;
|
|
1217
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1218
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1219
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1220
|
+
authorization: "Bearer" | "Basic";
|
|
1221
|
+
})) | undefined;
|
|
1222
|
+
integrity?: string | undefined;
|
|
1223
|
+
keepalive?: boolean | undefined;
|
|
1224
|
+
mode?: RequestMode | undefined;
|
|
1225
|
+
priority?: RequestPriority | undefined;
|
|
1226
|
+
redirect?: RequestRedirect | undefined;
|
|
1227
|
+
referrer?: string | undefined;
|
|
1228
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1229
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1230
|
+
window?: null | undefined;
|
|
1231
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1232
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1233
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1234
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1235
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1236
|
+
hookOptions?: {
|
|
1237
|
+
cloneResponse?: boolean;
|
|
1238
|
+
} | undefined;
|
|
1239
|
+
timeout?: number | undefined;
|
|
1240
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1241
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1242
|
+
baseURL?: string | undefined;
|
|
1243
|
+
throw?: boolean | undefined;
|
|
1244
|
+
auth?: ({
|
|
1245
|
+
type: "Bearer";
|
|
1246
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1247
|
+
} | {
|
|
1248
|
+
type: "Basic";
|
|
1249
|
+
username: string | (() => string | undefined) | undefined;
|
|
1250
|
+
password: string | (() => string | undefined) | undefined;
|
|
1251
|
+
} | {
|
|
1252
|
+
type: "Custom";
|
|
1253
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1254
|
+
value: string | (() => string | undefined) | undefined;
|
|
1255
|
+
}) | undefined;
|
|
1256
|
+
body?: (Partial<{
|
|
1257
|
+
newPassword: string;
|
|
1258
|
+
token?: string | undefined;
|
|
1259
|
+
}> & Record<string, any>) | undefined;
|
|
1260
|
+
query?: (Partial<{
|
|
1261
|
+
token?: string | undefined;
|
|
1262
|
+
}> & Record<string, any>) | undefined;
|
|
1263
|
+
params?: Record<string, any> | undefined;
|
|
1264
|
+
duplex?: "full" | "half" | undefined;
|
|
1265
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1266
|
+
retry?: RetryOptions | undefined;
|
|
1267
|
+
retryAttempt?: number | undefined;
|
|
1268
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1269
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1270
|
+
disableValidation?: boolean | undefined;
|
|
1271
|
+
}>(data_0: better_auth.Prettify<{
|
|
1272
|
+
newPassword: string;
|
|
1273
|
+
token?: string | undefined;
|
|
1274
|
+
} & {
|
|
1275
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1276
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1277
|
+
status: boolean;
|
|
1278
|
+
}, {
|
|
1279
|
+
code?: string;
|
|
1280
|
+
message?: string;
|
|
1281
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1282
|
+
} & {
|
|
1283
|
+
verifyEmail: <FetchOptions extends {
|
|
1284
|
+
method?: string | undefined;
|
|
1285
|
+
cache?: RequestCache | undefined;
|
|
1286
|
+
credentials?: RequestCredentials | undefined;
|
|
1287
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1288
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1289
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1290
|
+
authorization: "Bearer" | "Basic";
|
|
1291
|
+
})) | undefined;
|
|
1292
|
+
integrity?: string | undefined;
|
|
1293
|
+
keepalive?: boolean | undefined;
|
|
1294
|
+
mode?: RequestMode | undefined;
|
|
1295
|
+
priority?: RequestPriority | undefined;
|
|
1296
|
+
redirect?: RequestRedirect | undefined;
|
|
1297
|
+
referrer?: string | undefined;
|
|
1298
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1299
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1300
|
+
window?: null | undefined;
|
|
1301
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1302
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1303
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1304
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1305
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1306
|
+
hookOptions?: {
|
|
1307
|
+
cloneResponse?: boolean;
|
|
1308
|
+
} | undefined;
|
|
1309
|
+
timeout?: number | undefined;
|
|
1310
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1311
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1312
|
+
baseURL?: string | undefined;
|
|
1313
|
+
throw?: boolean | undefined;
|
|
1314
|
+
auth?: ({
|
|
1315
|
+
type: "Bearer";
|
|
1316
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1317
|
+
} | {
|
|
1318
|
+
type: "Basic";
|
|
1319
|
+
username: string | (() => string | undefined) | undefined;
|
|
1320
|
+
password: string | (() => string | undefined) | undefined;
|
|
1321
|
+
} | {
|
|
1322
|
+
type: "Custom";
|
|
1323
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1324
|
+
value: string | (() => string | undefined) | undefined;
|
|
1325
|
+
}) | undefined;
|
|
1326
|
+
body?: undefined;
|
|
1327
|
+
query?: (Partial<{
|
|
1328
|
+
token: string;
|
|
1329
|
+
callbackURL?: string | undefined;
|
|
1330
|
+
}> & Record<string, any>) | undefined;
|
|
1331
|
+
params?: Record<string, any> | undefined;
|
|
1332
|
+
duplex?: "full" | "half" | undefined;
|
|
1333
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1334
|
+
retry?: RetryOptions | undefined;
|
|
1335
|
+
retryAttempt?: number | undefined;
|
|
1336
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1337
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1338
|
+
disableValidation?: boolean | undefined;
|
|
1339
|
+
}>(data_0: better_auth.Prettify<{
|
|
1340
|
+
query: {
|
|
1341
|
+
token: string;
|
|
1342
|
+
callbackURL?: string | undefined;
|
|
1343
|
+
};
|
|
1344
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1345
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<NonNullable<void | {
|
|
1346
|
+
status: boolean;
|
|
1347
|
+
user: {
|
|
1348
|
+
id: string;
|
|
1349
|
+
email: string;
|
|
1350
|
+
name: string;
|
|
1351
|
+
image: string | null | undefined;
|
|
1352
|
+
emailVerified: boolean;
|
|
1353
|
+
createdAt: Date;
|
|
1354
|
+
updatedAt: Date;
|
|
1355
|
+
};
|
|
1356
|
+
} | {
|
|
1357
|
+
status: boolean;
|
|
1358
|
+
user: null;
|
|
1359
|
+
}>, {
|
|
1360
|
+
code?: string;
|
|
1361
|
+
message?: string;
|
|
1362
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1363
|
+
} & {
|
|
1364
|
+
sendVerificationEmail: <FetchOptions extends {
|
|
1365
|
+
method?: string | undefined;
|
|
1366
|
+
cache?: RequestCache | undefined;
|
|
1367
|
+
credentials?: RequestCredentials | undefined;
|
|
1368
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1369
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1370
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1371
|
+
authorization: "Bearer" | "Basic";
|
|
1372
|
+
})) | undefined;
|
|
1373
|
+
integrity?: string | undefined;
|
|
1374
|
+
keepalive?: boolean | undefined;
|
|
1375
|
+
mode?: RequestMode | undefined;
|
|
1376
|
+
priority?: RequestPriority | undefined;
|
|
1377
|
+
redirect?: RequestRedirect | undefined;
|
|
1378
|
+
referrer?: string | undefined;
|
|
1379
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1380
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1381
|
+
window?: null | undefined;
|
|
1382
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1383
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1384
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1385
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1386
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1387
|
+
hookOptions?: {
|
|
1388
|
+
cloneResponse?: boolean;
|
|
1389
|
+
} | undefined;
|
|
1390
|
+
timeout?: number | undefined;
|
|
1391
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1392
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1393
|
+
baseURL?: string | undefined;
|
|
1394
|
+
throw?: boolean | undefined;
|
|
1395
|
+
auth?: ({
|
|
1396
|
+
type: "Bearer";
|
|
1397
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1398
|
+
} | {
|
|
1399
|
+
type: "Basic";
|
|
1400
|
+
username: string | (() => string | undefined) | undefined;
|
|
1401
|
+
password: string | (() => string | undefined) | undefined;
|
|
1402
|
+
} | {
|
|
1403
|
+
type: "Custom";
|
|
1404
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1405
|
+
value: string | (() => string | undefined) | undefined;
|
|
1406
|
+
}) | undefined;
|
|
1407
|
+
body?: (Partial<{
|
|
1408
|
+
email: string;
|
|
1409
|
+
callbackURL?: string | undefined;
|
|
1410
|
+
}> & Record<string, any>) | undefined;
|
|
1411
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1412
|
+
params?: Record<string, any> | undefined;
|
|
1413
|
+
duplex?: "full" | "half" | undefined;
|
|
1414
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1415
|
+
retry?: RetryOptions | undefined;
|
|
1416
|
+
retryAttempt?: number | undefined;
|
|
1417
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1418
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1419
|
+
disableValidation?: boolean | undefined;
|
|
1420
|
+
}>(data_0: better_auth.Prettify<{
|
|
1421
|
+
email: string;
|
|
1422
|
+
callbackURL?: string | undefined;
|
|
1423
|
+
} & {
|
|
1424
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1425
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1426
|
+
status: boolean;
|
|
1427
|
+
}, {
|
|
1428
|
+
code?: string;
|
|
1429
|
+
message?: string;
|
|
1430
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1431
|
+
} & {
|
|
1432
|
+
changeEmail: <FetchOptions extends {
|
|
1433
|
+
method?: string | undefined;
|
|
1434
|
+
cache?: RequestCache | undefined;
|
|
1435
|
+
credentials?: RequestCredentials | undefined;
|
|
1436
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1437
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1438
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1439
|
+
authorization: "Bearer" | "Basic";
|
|
1440
|
+
})) | undefined;
|
|
1441
|
+
integrity?: string | undefined;
|
|
1442
|
+
keepalive?: boolean | undefined;
|
|
1443
|
+
mode?: RequestMode | undefined;
|
|
1444
|
+
priority?: RequestPriority | undefined;
|
|
1445
|
+
redirect?: RequestRedirect | undefined;
|
|
1446
|
+
referrer?: string | undefined;
|
|
1447
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1448
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1449
|
+
window?: null | undefined;
|
|
1450
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1451
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1452
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1453
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1454
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1455
|
+
hookOptions?: {
|
|
1456
|
+
cloneResponse?: boolean;
|
|
1457
|
+
} | undefined;
|
|
1458
|
+
timeout?: number | undefined;
|
|
1459
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1460
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1461
|
+
baseURL?: string | undefined;
|
|
1462
|
+
throw?: boolean | undefined;
|
|
1463
|
+
auth?: ({
|
|
1464
|
+
type: "Bearer";
|
|
1465
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1466
|
+
} | {
|
|
1467
|
+
type: "Basic";
|
|
1468
|
+
username: string | (() => string | undefined) | undefined;
|
|
1469
|
+
password: string | (() => string | undefined) | undefined;
|
|
1470
|
+
} | {
|
|
1471
|
+
type: "Custom";
|
|
1472
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1473
|
+
value: string | (() => string | undefined) | undefined;
|
|
1474
|
+
}) | undefined;
|
|
1475
|
+
body?: (Partial<{
|
|
1476
|
+
newEmail: string;
|
|
1477
|
+
callbackURL?: string | undefined;
|
|
1478
|
+
}> & Record<string, any>) | undefined;
|
|
1479
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1480
|
+
params?: Record<string, any> | undefined;
|
|
1481
|
+
duplex?: "full" | "half" | undefined;
|
|
1482
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1483
|
+
retry?: RetryOptions | undefined;
|
|
1484
|
+
retryAttempt?: number | undefined;
|
|
1485
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1486
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1487
|
+
disableValidation?: boolean | undefined;
|
|
1488
|
+
}>(data_0: better_auth.Prettify<{
|
|
1489
|
+
newEmail: string;
|
|
1490
|
+
callbackURL?: string | undefined;
|
|
1491
|
+
} & {
|
|
1492
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1493
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1494
|
+
status: boolean;
|
|
1495
|
+
}, {
|
|
1496
|
+
code?: string;
|
|
1497
|
+
message?: string;
|
|
1498
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1499
|
+
} & {
|
|
1500
|
+
changePassword: <FetchOptions extends {
|
|
1501
|
+
method?: string | undefined;
|
|
1502
|
+
cache?: RequestCache | undefined;
|
|
1503
|
+
credentials?: RequestCredentials | undefined;
|
|
1504
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1505
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1506
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1507
|
+
authorization: "Bearer" | "Basic";
|
|
1508
|
+
})) | undefined;
|
|
1509
|
+
integrity?: string | undefined;
|
|
1510
|
+
keepalive?: boolean | undefined;
|
|
1511
|
+
mode?: RequestMode | undefined;
|
|
1512
|
+
priority?: RequestPriority | undefined;
|
|
1513
|
+
redirect?: RequestRedirect | undefined;
|
|
1514
|
+
referrer?: string | undefined;
|
|
1515
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1516
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1517
|
+
window?: null | undefined;
|
|
1518
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1519
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1520
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1521
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1522
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1523
|
+
hookOptions?: {
|
|
1524
|
+
cloneResponse?: boolean;
|
|
1525
|
+
} | undefined;
|
|
1526
|
+
timeout?: number | undefined;
|
|
1527
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1528
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1529
|
+
baseURL?: string | undefined;
|
|
1530
|
+
throw?: boolean | undefined;
|
|
1531
|
+
auth?: ({
|
|
1532
|
+
type: "Bearer";
|
|
1533
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1534
|
+
} | {
|
|
1535
|
+
type: "Basic";
|
|
1536
|
+
username: string | (() => string | undefined) | undefined;
|
|
1537
|
+
password: string | (() => string | undefined) | undefined;
|
|
1538
|
+
} | {
|
|
1539
|
+
type: "Custom";
|
|
1540
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1541
|
+
value: string | (() => string | undefined) | undefined;
|
|
1542
|
+
}) | undefined;
|
|
1543
|
+
body?: (Partial<{
|
|
1544
|
+
newPassword: string;
|
|
1545
|
+
currentPassword: string;
|
|
1546
|
+
revokeOtherSessions?: boolean | undefined;
|
|
1547
|
+
}> & Record<string, any>) | undefined;
|
|
1548
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1549
|
+
params?: Record<string, any> | undefined;
|
|
1550
|
+
duplex?: "full" | "half" | undefined;
|
|
1551
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1552
|
+
retry?: RetryOptions | undefined;
|
|
1553
|
+
retryAttempt?: number | undefined;
|
|
1554
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1555
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1556
|
+
disableValidation?: boolean | undefined;
|
|
1557
|
+
}>(data_0: better_auth.Prettify<{
|
|
1558
|
+
newPassword: string;
|
|
1559
|
+
currentPassword: string;
|
|
1560
|
+
revokeOtherSessions?: boolean | undefined;
|
|
1561
|
+
} & {
|
|
1562
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1563
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1564
|
+
token: string | null;
|
|
1565
|
+
user: {
|
|
1566
|
+
id: string;
|
|
1567
|
+
email: string;
|
|
1568
|
+
name: string;
|
|
1569
|
+
image: string | null | undefined;
|
|
1570
|
+
emailVerified: boolean;
|
|
1571
|
+
createdAt: Date;
|
|
1572
|
+
updatedAt: Date;
|
|
1573
|
+
};
|
|
1574
|
+
}, {
|
|
1575
|
+
code?: string;
|
|
1576
|
+
message?: string;
|
|
1577
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1578
|
+
} & {
|
|
1579
|
+
updateUser: <FetchOptions extends {
|
|
1580
|
+
method?: string | undefined;
|
|
1581
|
+
cache?: RequestCache | undefined;
|
|
1582
|
+
credentials?: RequestCredentials | undefined;
|
|
1583
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1584
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1585
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1586
|
+
authorization: "Bearer" | "Basic";
|
|
1587
|
+
})) | undefined;
|
|
1588
|
+
integrity?: string | undefined;
|
|
1589
|
+
keepalive?: boolean | undefined;
|
|
1590
|
+
mode?: RequestMode | undefined;
|
|
1591
|
+
priority?: RequestPriority | undefined;
|
|
1592
|
+
redirect?: RequestRedirect | undefined;
|
|
1593
|
+
referrer?: string | undefined;
|
|
1594
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1595
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1596
|
+
window?: null | undefined;
|
|
1597
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1598
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1599
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1600
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1601
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1602
|
+
hookOptions?: {
|
|
1603
|
+
cloneResponse?: boolean;
|
|
1604
|
+
} | undefined;
|
|
1605
|
+
timeout?: number | undefined;
|
|
1606
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1607
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1608
|
+
baseURL?: string | undefined;
|
|
1609
|
+
throw?: boolean | undefined;
|
|
1610
|
+
auth?: ({
|
|
1611
|
+
type: "Bearer";
|
|
1612
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1613
|
+
} | {
|
|
1614
|
+
type: "Basic";
|
|
1615
|
+
username: string | (() => string | undefined) | undefined;
|
|
1616
|
+
password: string | (() => string | undefined) | undefined;
|
|
1617
|
+
} | {
|
|
1618
|
+
type: "Custom";
|
|
1619
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1620
|
+
value: string | (() => string | undefined) | undefined;
|
|
1621
|
+
}) | undefined;
|
|
1622
|
+
body?: (Partial<Partial<{}> & {
|
|
1623
|
+
name?: string;
|
|
1624
|
+
image?: string;
|
|
1625
|
+
}> & Record<string, any>) | undefined;
|
|
1626
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1627
|
+
params?: Record<string, any> | undefined;
|
|
1628
|
+
duplex?: "full" | "half" | undefined;
|
|
1629
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1630
|
+
retry?: RetryOptions | undefined;
|
|
1631
|
+
retryAttempt?: number | undefined;
|
|
1632
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1633
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1634
|
+
disableValidation?: boolean | undefined;
|
|
1635
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1636
|
+
image?: string | null;
|
|
1637
|
+
name?: string;
|
|
1638
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1639
|
+
} & Partial<{}>> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1640
|
+
status: boolean;
|
|
1641
|
+
}, {
|
|
1642
|
+
code?: string;
|
|
1643
|
+
message?: string;
|
|
1644
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1645
|
+
} & {
|
|
1646
|
+
deleteUser: <FetchOptions extends {
|
|
1647
|
+
method?: string | undefined;
|
|
1648
|
+
cache?: RequestCache | undefined;
|
|
1649
|
+
credentials?: RequestCredentials | undefined;
|
|
1650
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1651
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1652
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1653
|
+
authorization: "Bearer" | "Basic";
|
|
1654
|
+
})) | undefined;
|
|
1655
|
+
integrity?: string | undefined;
|
|
1656
|
+
keepalive?: boolean | undefined;
|
|
1657
|
+
mode?: RequestMode | undefined;
|
|
1658
|
+
priority?: RequestPriority | undefined;
|
|
1659
|
+
redirect?: RequestRedirect | undefined;
|
|
1660
|
+
referrer?: string | undefined;
|
|
1661
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1662
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1663
|
+
window?: null | undefined;
|
|
1664
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1665
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1666
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1667
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1668
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1669
|
+
hookOptions?: {
|
|
1670
|
+
cloneResponse?: boolean;
|
|
1671
|
+
} | undefined;
|
|
1672
|
+
timeout?: number | undefined;
|
|
1673
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1674
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1675
|
+
baseURL?: string | undefined;
|
|
1676
|
+
throw?: boolean | undefined;
|
|
1677
|
+
auth?: ({
|
|
1678
|
+
type: "Bearer";
|
|
1679
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1680
|
+
} | {
|
|
1681
|
+
type: "Basic";
|
|
1682
|
+
username: string | (() => string | undefined) | undefined;
|
|
1683
|
+
password: string | (() => string | undefined) | undefined;
|
|
1684
|
+
} | {
|
|
1685
|
+
type: "Custom";
|
|
1686
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1687
|
+
value: string | (() => string | undefined) | undefined;
|
|
1688
|
+
}) | undefined;
|
|
1689
|
+
body?: (Partial<{
|
|
1690
|
+
callbackURL?: string | undefined;
|
|
1691
|
+
password?: string | undefined;
|
|
1692
|
+
token?: string | undefined;
|
|
1693
|
+
}> & Record<string, any>) | undefined;
|
|
1694
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1695
|
+
params?: Record<string, any> | undefined;
|
|
1696
|
+
duplex?: "full" | "half" | undefined;
|
|
1697
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1698
|
+
retry?: RetryOptions | undefined;
|
|
1699
|
+
retryAttempt?: number | undefined;
|
|
1700
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1701
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1702
|
+
disableValidation?: boolean | undefined;
|
|
1703
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1704
|
+
callbackURL?: string | undefined;
|
|
1705
|
+
password?: string | undefined;
|
|
1706
|
+
token?: string | undefined;
|
|
1707
|
+
} & {
|
|
1708
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1709
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1710
|
+
success: boolean;
|
|
1711
|
+
message: string;
|
|
1712
|
+
}, {
|
|
1713
|
+
code?: string;
|
|
1714
|
+
message?: string;
|
|
1715
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1716
|
+
} & {
|
|
1717
|
+
resetPassword: {
|
|
1718
|
+
":token": <FetchOptions extends {
|
|
1719
|
+
method?: string | undefined;
|
|
1720
|
+
cache?: RequestCache | undefined;
|
|
1721
|
+
credentials?: RequestCredentials | undefined;
|
|
1722
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1723
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1724
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1725
|
+
authorization: "Bearer" | "Basic";
|
|
1726
|
+
})) | undefined;
|
|
1727
|
+
integrity?: string | undefined;
|
|
1728
|
+
keepalive?: boolean | undefined;
|
|
1729
|
+
mode?: RequestMode | undefined;
|
|
1730
|
+
priority?: RequestPriority | undefined;
|
|
1731
|
+
redirect?: RequestRedirect | undefined;
|
|
1732
|
+
referrer?: string | undefined;
|
|
1733
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1734
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1735
|
+
window?: null | undefined;
|
|
1736
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1737
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1738
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1739
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1740
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1741
|
+
hookOptions?: {
|
|
1742
|
+
cloneResponse?: boolean;
|
|
1743
|
+
} | undefined;
|
|
1744
|
+
timeout?: number | undefined;
|
|
1745
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1746
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1747
|
+
baseURL?: string | undefined;
|
|
1748
|
+
throw?: boolean | undefined;
|
|
1749
|
+
auth?: ({
|
|
1750
|
+
type: "Bearer";
|
|
1751
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1752
|
+
} | {
|
|
1753
|
+
type: "Basic";
|
|
1754
|
+
username: string | (() => string | undefined) | undefined;
|
|
1755
|
+
password: string | (() => string | undefined) | undefined;
|
|
1756
|
+
} | {
|
|
1757
|
+
type: "Custom";
|
|
1758
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1759
|
+
value: string | (() => string | undefined) | undefined;
|
|
1760
|
+
}) | undefined;
|
|
1761
|
+
body?: undefined;
|
|
1762
|
+
query?: (Partial<{
|
|
1763
|
+
callbackURL: string;
|
|
1764
|
+
}> & Record<string, any>) | undefined;
|
|
1765
|
+
params?: {
|
|
1766
|
+
token: string;
|
|
1767
|
+
} | undefined;
|
|
1768
|
+
duplex?: "full" | "half" | undefined;
|
|
1769
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1770
|
+
retry?: RetryOptions | undefined;
|
|
1771
|
+
retryAttempt?: number | undefined;
|
|
1772
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1773
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1774
|
+
disableValidation?: boolean | undefined;
|
|
1775
|
+
}>(data_0: better_auth.Prettify<{
|
|
1776
|
+
query: {
|
|
1777
|
+
callbackURL: string;
|
|
1778
|
+
};
|
|
1779
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1780
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<never, {
|
|
1781
|
+
code?: string;
|
|
1782
|
+
message?: string;
|
|
1783
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1784
|
+
};
|
|
1785
|
+
} & {
|
|
1786
|
+
requestPasswordReset: <FetchOptions extends {
|
|
1787
|
+
method?: string | undefined;
|
|
1788
|
+
cache?: RequestCache | undefined;
|
|
1789
|
+
credentials?: RequestCredentials | undefined;
|
|
1790
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1791
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1792
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1793
|
+
authorization: "Bearer" | "Basic";
|
|
1794
|
+
})) | undefined;
|
|
1795
|
+
integrity?: string | undefined;
|
|
1796
|
+
keepalive?: boolean | undefined;
|
|
1797
|
+
mode?: RequestMode | undefined;
|
|
1798
|
+
priority?: RequestPriority | undefined;
|
|
1799
|
+
redirect?: RequestRedirect | undefined;
|
|
1800
|
+
referrer?: string | undefined;
|
|
1801
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1802
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1803
|
+
window?: null | undefined;
|
|
1804
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1805
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1806
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1807
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1808
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1809
|
+
hookOptions?: {
|
|
1810
|
+
cloneResponse?: boolean;
|
|
1811
|
+
} | undefined;
|
|
1812
|
+
timeout?: number | undefined;
|
|
1813
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1814
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1815
|
+
baseURL?: string | undefined;
|
|
1816
|
+
throw?: boolean | undefined;
|
|
1817
|
+
auth?: ({
|
|
1818
|
+
type: "Bearer";
|
|
1819
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1820
|
+
} | {
|
|
1821
|
+
type: "Basic";
|
|
1822
|
+
username: string | (() => string | undefined) | undefined;
|
|
1823
|
+
password: string | (() => string | undefined) | undefined;
|
|
1824
|
+
} | {
|
|
1825
|
+
type: "Custom";
|
|
1826
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1827
|
+
value: string | (() => string | undefined) | undefined;
|
|
1828
|
+
}) | undefined;
|
|
1829
|
+
body?: (Partial<{
|
|
1830
|
+
email: string;
|
|
1831
|
+
redirectTo?: string | undefined;
|
|
1832
|
+
}> & Record<string, any>) | undefined;
|
|
1833
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1834
|
+
params?: Record<string, any> | undefined;
|
|
1835
|
+
duplex?: "full" | "half" | undefined;
|
|
1836
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1837
|
+
retry?: RetryOptions | undefined;
|
|
1838
|
+
retryAttempt?: number | undefined;
|
|
1839
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1840
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1841
|
+
disableValidation?: boolean | undefined;
|
|
1842
|
+
}>(data_0: better_auth.Prettify<{
|
|
1843
|
+
email: string;
|
|
1844
|
+
redirectTo?: string | undefined;
|
|
1845
|
+
} & {
|
|
1846
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1847
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
1848
|
+
status: boolean;
|
|
1849
|
+
message: string;
|
|
1850
|
+
}, {
|
|
1851
|
+
code?: string;
|
|
1852
|
+
message?: string;
|
|
1853
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1854
|
+
} & {
|
|
1855
|
+
resetPassword: {
|
|
1856
|
+
":token": <FetchOptions extends {
|
|
1857
|
+
method?: string | undefined;
|
|
1858
|
+
cache?: RequestCache | undefined;
|
|
1859
|
+
credentials?: RequestCredentials | undefined;
|
|
1860
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1861
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1862
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1863
|
+
authorization: "Bearer" | "Basic";
|
|
1864
|
+
})) | undefined;
|
|
1865
|
+
integrity?: string | undefined;
|
|
1866
|
+
keepalive?: boolean | undefined;
|
|
1867
|
+
mode?: RequestMode | undefined;
|
|
1868
|
+
priority?: RequestPriority | undefined;
|
|
1869
|
+
redirect?: RequestRedirect | undefined;
|
|
1870
|
+
referrer?: string | undefined;
|
|
1871
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1872
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1873
|
+
window?: null | undefined;
|
|
1874
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1875
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1876
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1877
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1878
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1879
|
+
hookOptions?: {
|
|
1880
|
+
cloneResponse?: boolean;
|
|
1881
|
+
} | undefined;
|
|
1882
|
+
timeout?: number | undefined;
|
|
1883
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1884
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1885
|
+
baseURL?: string | undefined;
|
|
1886
|
+
throw?: boolean | undefined;
|
|
1887
|
+
auth?: ({
|
|
1888
|
+
type: "Bearer";
|
|
1889
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1890
|
+
} | {
|
|
1891
|
+
type: "Basic";
|
|
1892
|
+
username: string | (() => string | undefined) | undefined;
|
|
1893
|
+
password: string | (() => string | undefined) | undefined;
|
|
1894
|
+
} | {
|
|
1895
|
+
type: "Custom";
|
|
1896
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1897
|
+
value: string | (() => string | undefined) | undefined;
|
|
1898
|
+
}) | undefined;
|
|
1899
|
+
body?: undefined;
|
|
1900
|
+
query?: (Partial<{
|
|
1901
|
+
callbackURL: string;
|
|
1902
|
+
}> & Record<string, any>) | undefined;
|
|
1903
|
+
params?: {
|
|
1904
|
+
token: string;
|
|
1905
|
+
} | undefined;
|
|
1906
|
+
duplex?: "full" | "half" | undefined;
|
|
1907
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1908
|
+
retry?: RetryOptions | undefined;
|
|
1909
|
+
retryAttempt?: number | undefined;
|
|
1910
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1911
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1912
|
+
disableValidation?: boolean | undefined;
|
|
1913
|
+
}>(data_0: better_auth.Prettify<{
|
|
1914
|
+
query: {
|
|
1915
|
+
callbackURL: string;
|
|
1916
|
+
};
|
|
1917
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1918
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<never, {
|
|
1919
|
+
code?: string;
|
|
1920
|
+
message?: string;
|
|
1921
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1922
|
+
};
|
|
1923
|
+
} & {
|
|
1924
|
+
listSessions: <FetchOptions extends {
|
|
1925
|
+
method?: string | undefined;
|
|
1926
|
+
cache?: RequestCache | undefined;
|
|
1927
|
+
credentials?: RequestCredentials | undefined;
|
|
1928
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1929
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
1930
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
1931
|
+
authorization: "Bearer" | "Basic";
|
|
1932
|
+
})) | undefined;
|
|
1933
|
+
integrity?: string | undefined;
|
|
1934
|
+
keepalive?: boolean | undefined;
|
|
1935
|
+
mode?: RequestMode | undefined;
|
|
1936
|
+
priority?: RequestPriority | undefined;
|
|
1937
|
+
redirect?: RequestRedirect | undefined;
|
|
1938
|
+
referrer?: string | undefined;
|
|
1939
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
1940
|
+
signal?: (AbortSignal | null) | undefined;
|
|
1941
|
+
window?: null | undefined;
|
|
1942
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
1943
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
1944
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
1945
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
1946
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
1947
|
+
hookOptions?: {
|
|
1948
|
+
cloneResponse?: boolean;
|
|
1949
|
+
} | undefined;
|
|
1950
|
+
timeout?: number | undefined;
|
|
1951
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
1952
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
1953
|
+
baseURL?: string | undefined;
|
|
1954
|
+
throw?: boolean | undefined;
|
|
1955
|
+
auth?: ({
|
|
1956
|
+
type: "Bearer";
|
|
1957
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
1958
|
+
} | {
|
|
1959
|
+
type: "Basic";
|
|
1960
|
+
username: string | (() => string | undefined) | undefined;
|
|
1961
|
+
password: string | (() => string | undefined) | undefined;
|
|
1962
|
+
} | {
|
|
1963
|
+
type: "Custom";
|
|
1964
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
1965
|
+
value: string | (() => string | undefined) | undefined;
|
|
1966
|
+
}) | undefined;
|
|
1967
|
+
body?: undefined;
|
|
1968
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
1969
|
+
params?: Record<string, any> | undefined;
|
|
1970
|
+
duplex?: "full" | "half" | undefined;
|
|
1971
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
1972
|
+
retry?: RetryOptions | undefined;
|
|
1973
|
+
retryAttempt?: number | undefined;
|
|
1974
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
1975
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
1976
|
+
disableValidation?: boolean | undefined;
|
|
1977
|
+
}>(data_0?: better_auth.Prettify<{
|
|
1978
|
+
query?: Record<string, any> | undefined;
|
|
1979
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1980
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<better_auth.Prettify<{
|
|
1981
|
+
id: string;
|
|
1982
|
+
createdAt: Date;
|
|
1983
|
+
updatedAt: Date;
|
|
1984
|
+
userId: string;
|
|
1985
|
+
expiresAt: Date;
|
|
1986
|
+
token: string;
|
|
1987
|
+
ipAddress?: string | null | undefined | undefined;
|
|
1988
|
+
userAgent?: string | null | undefined | undefined;
|
|
1989
|
+
}>[], {
|
|
1990
|
+
code?: string;
|
|
1991
|
+
message?: string;
|
|
1992
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1993
|
+
} & {
|
|
1994
|
+
revokeSession: <FetchOptions extends {
|
|
1995
|
+
method?: string | undefined;
|
|
1996
|
+
cache?: RequestCache | undefined;
|
|
1997
|
+
credentials?: RequestCredentials | undefined;
|
|
1998
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
1999
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2000
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2001
|
+
authorization: "Bearer" | "Basic";
|
|
2002
|
+
})) | undefined;
|
|
2003
|
+
integrity?: string | undefined;
|
|
2004
|
+
keepalive?: boolean | undefined;
|
|
2005
|
+
mode?: RequestMode | undefined;
|
|
2006
|
+
priority?: RequestPriority | undefined;
|
|
2007
|
+
redirect?: RequestRedirect | undefined;
|
|
2008
|
+
referrer?: string | undefined;
|
|
2009
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2010
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2011
|
+
window?: null | undefined;
|
|
2012
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2013
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2014
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2015
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2016
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2017
|
+
hookOptions?: {
|
|
2018
|
+
cloneResponse?: boolean;
|
|
2019
|
+
} | undefined;
|
|
2020
|
+
timeout?: number | undefined;
|
|
2021
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2022
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2023
|
+
baseURL?: string | undefined;
|
|
2024
|
+
throw?: boolean | undefined;
|
|
2025
|
+
auth?: ({
|
|
2026
|
+
type: "Bearer";
|
|
2027
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2028
|
+
} | {
|
|
2029
|
+
type: "Basic";
|
|
2030
|
+
username: string | (() => string | undefined) | undefined;
|
|
2031
|
+
password: string | (() => string | undefined) | undefined;
|
|
2032
|
+
} | {
|
|
2033
|
+
type: "Custom";
|
|
2034
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2035
|
+
value: string | (() => string | undefined) | undefined;
|
|
2036
|
+
}) | undefined;
|
|
2037
|
+
body?: (Partial<{
|
|
2038
|
+
token: string;
|
|
2039
|
+
}> & Record<string, any>) | undefined;
|
|
2040
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2041
|
+
params?: Record<string, any> | undefined;
|
|
2042
|
+
duplex?: "full" | "half" | undefined;
|
|
2043
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2044
|
+
retry?: RetryOptions | undefined;
|
|
2045
|
+
retryAttempt?: number | undefined;
|
|
2046
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2047
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2048
|
+
disableValidation?: boolean | undefined;
|
|
2049
|
+
}>(data_0: better_auth.Prettify<{
|
|
2050
|
+
token: string;
|
|
2051
|
+
} & {
|
|
2052
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2053
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2054
|
+
status: boolean;
|
|
2055
|
+
}, {
|
|
2056
|
+
code?: string;
|
|
2057
|
+
message?: string;
|
|
2058
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2059
|
+
} & {
|
|
2060
|
+
revokeSessions: <FetchOptions extends {
|
|
2061
|
+
method?: string | undefined;
|
|
2062
|
+
cache?: RequestCache | undefined;
|
|
2063
|
+
credentials?: RequestCredentials | undefined;
|
|
2064
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2065
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2066
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2067
|
+
authorization: "Bearer" | "Basic";
|
|
2068
|
+
})) | undefined;
|
|
2069
|
+
integrity?: string | undefined;
|
|
2070
|
+
keepalive?: boolean | undefined;
|
|
2071
|
+
mode?: RequestMode | undefined;
|
|
2072
|
+
priority?: RequestPriority | undefined;
|
|
2073
|
+
redirect?: RequestRedirect | undefined;
|
|
2074
|
+
referrer?: string | undefined;
|
|
2075
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2076
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2077
|
+
window?: null | undefined;
|
|
2078
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2079
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2080
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2081
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2082
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2083
|
+
hookOptions?: {
|
|
2084
|
+
cloneResponse?: boolean;
|
|
2085
|
+
} | undefined;
|
|
2086
|
+
timeout?: number | undefined;
|
|
2087
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2088
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2089
|
+
baseURL?: string | undefined;
|
|
2090
|
+
throw?: boolean | undefined;
|
|
2091
|
+
auth?: ({
|
|
2092
|
+
type: "Bearer";
|
|
2093
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2094
|
+
} | {
|
|
2095
|
+
type: "Basic";
|
|
2096
|
+
username: string | (() => string | undefined) | undefined;
|
|
2097
|
+
password: string | (() => string | undefined) | undefined;
|
|
2098
|
+
} | {
|
|
2099
|
+
type: "Custom";
|
|
2100
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2101
|
+
value: string | (() => string | undefined) | undefined;
|
|
2102
|
+
}) | undefined;
|
|
2103
|
+
body?: undefined;
|
|
2104
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2105
|
+
params?: Record<string, any> | undefined;
|
|
2106
|
+
duplex?: "full" | "half" | undefined;
|
|
2107
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2108
|
+
retry?: RetryOptions | undefined;
|
|
2109
|
+
retryAttempt?: number | undefined;
|
|
2110
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2111
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2112
|
+
disableValidation?: boolean | undefined;
|
|
2113
|
+
}>(data_0?: better_auth.Prettify<{
|
|
2114
|
+
query?: Record<string, any> | undefined;
|
|
2115
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2116
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2117
|
+
status: boolean;
|
|
2118
|
+
}, {
|
|
2119
|
+
code?: string;
|
|
2120
|
+
message?: string;
|
|
2121
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2122
|
+
} & {
|
|
2123
|
+
revokeOtherSessions: <FetchOptions extends {
|
|
2124
|
+
method?: string | undefined;
|
|
2125
|
+
cache?: RequestCache | undefined;
|
|
2126
|
+
credentials?: RequestCredentials | undefined;
|
|
2127
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2128
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2129
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2130
|
+
authorization: "Bearer" | "Basic";
|
|
2131
|
+
})) | undefined;
|
|
2132
|
+
integrity?: string | undefined;
|
|
2133
|
+
keepalive?: boolean | undefined;
|
|
2134
|
+
mode?: RequestMode | undefined;
|
|
2135
|
+
priority?: RequestPriority | undefined;
|
|
2136
|
+
redirect?: RequestRedirect | undefined;
|
|
2137
|
+
referrer?: string | undefined;
|
|
2138
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2139
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2140
|
+
window?: null | undefined;
|
|
2141
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2142
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2143
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2144
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2145
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2146
|
+
hookOptions?: {
|
|
2147
|
+
cloneResponse?: boolean;
|
|
2148
|
+
} | undefined;
|
|
2149
|
+
timeout?: number | undefined;
|
|
2150
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2151
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2152
|
+
baseURL?: string | undefined;
|
|
2153
|
+
throw?: boolean | undefined;
|
|
2154
|
+
auth?: ({
|
|
2155
|
+
type: "Bearer";
|
|
2156
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2157
|
+
} | {
|
|
2158
|
+
type: "Basic";
|
|
2159
|
+
username: string | (() => string | undefined) | undefined;
|
|
2160
|
+
password: string | (() => string | undefined) | undefined;
|
|
2161
|
+
} | {
|
|
2162
|
+
type: "Custom";
|
|
2163
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2164
|
+
value: string | (() => string | undefined) | undefined;
|
|
2165
|
+
}) | undefined;
|
|
2166
|
+
body?: undefined;
|
|
2167
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2168
|
+
params?: Record<string, any> | undefined;
|
|
2169
|
+
duplex?: "full" | "half" | undefined;
|
|
2170
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2171
|
+
retry?: RetryOptions | undefined;
|
|
2172
|
+
retryAttempt?: number | undefined;
|
|
2173
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2174
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2175
|
+
disableValidation?: boolean | undefined;
|
|
2176
|
+
}>(data_0?: better_auth.Prettify<{
|
|
2177
|
+
query?: Record<string, any> | undefined;
|
|
2178
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2179
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2180
|
+
status: boolean;
|
|
2181
|
+
}, {
|
|
2182
|
+
code?: string;
|
|
2183
|
+
message?: string;
|
|
2184
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2185
|
+
} & {
|
|
2186
|
+
linkSocial: <FetchOptions extends {
|
|
2187
|
+
method?: string | undefined;
|
|
2188
|
+
cache?: RequestCache | undefined;
|
|
2189
|
+
credentials?: RequestCredentials | undefined;
|
|
2190
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2191
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2192
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2193
|
+
authorization: "Bearer" | "Basic";
|
|
2194
|
+
})) | undefined;
|
|
2195
|
+
integrity?: string | undefined;
|
|
2196
|
+
keepalive?: boolean | undefined;
|
|
2197
|
+
mode?: RequestMode | undefined;
|
|
2198
|
+
priority?: RequestPriority | undefined;
|
|
2199
|
+
redirect?: RequestRedirect | undefined;
|
|
2200
|
+
referrer?: string | undefined;
|
|
2201
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2202
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2203
|
+
window?: null | undefined;
|
|
2204
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2205
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2206
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2207
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2208
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2209
|
+
hookOptions?: {
|
|
2210
|
+
cloneResponse?: boolean;
|
|
2211
|
+
} | undefined;
|
|
2212
|
+
timeout?: number | undefined;
|
|
2213
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2214
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2215
|
+
baseURL?: string | undefined;
|
|
2216
|
+
throw?: boolean | undefined;
|
|
2217
|
+
auth?: ({
|
|
2218
|
+
type: "Bearer";
|
|
2219
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2220
|
+
} | {
|
|
2221
|
+
type: "Basic";
|
|
2222
|
+
username: string | (() => string | undefined) | undefined;
|
|
2223
|
+
password: string | (() => string | undefined) | undefined;
|
|
2224
|
+
} | {
|
|
2225
|
+
type: "Custom";
|
|
2226
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2227
|
+
value: string | (() => string | undefined) | undefined;
|
|
2228
|
+
}) | undefined;
|
|
2229
|
+
body?: (Partial<{
|
|
2230
|
+
provider: unknown;
|
|
2231
|
+
callbackURL?: string | undefined;
|
|
2232
|
+
idToken?: {
|
|
2233
|
+
token: string;
|
|
2234
|
+
nonce?: string | undefined;
|
|
2235
|
+
accessToken?: string | undefined;
|
|
2236
|
+
refreshToken?: string | undefined;
|
|
2237
|
+
scopes?: string[] | undefined;
|
|
2238
|
+
} | undefined;
|
|
2239
|
+
requestSignUp?: boolean | undefined;
|
|
2240
|
+
scopes?: string[] | undefined;
|
|
2241
|
+
errorCallbackURL?: string | undefined;
|
|
2242
|
+
disableRedirect?: boolean | undefined;
|
|
2243
|
+
}> & Record<string, any>) | undefined;
|
|
2244
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2245
|
+
params?: Record<string, any> | undefined;
|
|
2246
|
+
duplex?: "full" | "half" | undefined;
|
|
2247
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2248
|
+
retry?: RetryOptions | undefined;
|
|
2249
|
+
retryAttempt?: number | undefined;
|
|
2250
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2251
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2252
|
+
disableValidation?: boolean | undefined;
|
|
2253
|
+
}>(data_0: better_auth.Prettify<{
|
|
2254
|
+
provider: unknown;
|
|
2255
|
+
callbackURL?: string | undefined;
|
|
2256
|
+
idToken?: {
|
|
2257
|
+
token: string;
|
|
2258
|
+
nonce?: string | undefined;
|
|
2259
|
+
accessToken?: string | undefined;
|
|
2260
|
+
refreshToken?: string | undefined;
|
|
2261
|
+
scopes?: string[] | undefined;
|
|
2262
|
+
} | undefined;
|
|
2263
|
+
requestSignUp?: boolean | undefined;
|
|
2264
|
+
scopes?: string[] | undefined;
|
|
2265
|
+
errorCallbackURL?: string | undefined;
|
|
2266
|
+
disableRedirect?: boolean | undefined;
|
|
2267
|
+
} & {
|
|
2268
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2269
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2270
|
+
url: string;
|
|
2271
|
+
redirect: boolean;
|
|
2272
|
+
}, {
|
|
2273
|
+
code?: string;
|
|
2274
|
+
message?: string;
|
|
2275
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2276
|
+
} & {
|
|
2277
|
+
listAccounts: <FetchOptions extends {
|
|
2278
|
+
method?: string | undefined;
|
|
2279
|
+
cache?: RequestCache | undefined;
|
|
2280
|
+
credentials?: RequestCredentials | undefined;
|
|
2281
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2282
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2283
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2284
|
+
authorization: "Bearer" | "Basic";
|
|
2285
|
+
})) | undefined;
|
|
2286
|
+
integrity?: string | undefined;
|
|
2287
|
+
keepalive?: boolean | undefined;
|
|
2288
|
+
mode?: RequestMode | undefined;
|
|
2289
|
+
priority?: RequestPriority | undefined;
|
|
2290
|
+
redirect?: RequestRedirect | undefined;
|
|
2291
|
+
referrer?: string | undefined;
|
|
2292
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2293
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2294
|
+
window?: null | undefined;
|
|
2295
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2296
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2297
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2298
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2299
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2300
|
+
hookOptions?: {
|
|
2301
|
+
cloneResponse?: boolean;
|
|
2302
|
+
} | undefined;
|
|
2303
|
+
timeout?: number | undefined;
|
|
2304
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2305
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2306
|
+
baseURL?: string | undefined;
|
|
2307
|
+
throw?: boolean | undefined;
|
|
2308
|
+
auth?: ({
|
|
2309
|
+
type: "Bearer";
|
|
2310
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2311
|
+
} | {
|
|
2312
|
+
type: "Basic";
|
|
2313
|
+
username: string | (() => string | undefined) | undefined;
|
|
2314
|
+
password: string | (() => string | undefined) | undefined;
|
|
2315
|
+
} | {
|
|
2316
|
+
type: "Custom";
|
|
2317
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2318
|
+
value: string | (() => string | undefined) | undefined;
|
|
2319
|
+
}) | undefined;
|
|
2320
|
+
body?: undefined;
|
|
2321
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2322
|
+
params?: Record<string, any> | undefined;
|
|
2323
|
+
duplex?: "full" | "half" | undefined;
|
|
2324
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2325
|
+
retry?: RetryOptions | undefined;
|
|
2326
|
+
retryAttempt?: number | undefined;
|
|
2327
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2328
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2329
|
+
disableValidation?: boolean | undefined;
|
|
2330
|
+
}>(data_0?: better_auth.Prettify<{
|
|
2331
|
+
query?: Record<string, any> | undefined;
|
|
2332
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2333
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2334
|
+
id: string;
|
|
2335
|
+
providerId: string;
|
|
2336
|
+
createdAt: Date;
|
|
2337
|
+
updatedAt: Date;
|
|
2338
|
+
accountId: string;
|
|
2339
|
+
scopes: string[];
|
|
2340
|
+
}[], {
|
|
2341
|
+
code?: string;
|
|
2342
|
+
message?: string;
|
|
2343
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2344
|
+
} & {
|
|
2345
|
+
deleteUser: {
|
|
2346
|
+
callback: <FetchOptions extends {
|
|
2347
|
+
method?: string | undefined;
|
|
2348
|
+
cache?: RequestCache | undefined;
|
|
2349
|
+
credentials?: RequestCredentials | undefined;
|
|
2350
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2351
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2352
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2353
|
+
authorization: "Bearer" | "Basic";
|
|
2354
|
+
})) | undefined;
|
|
2355
|
+
integrity?: string | undefined;
|
|
2356
|
+
keepalive?: boolean | undefined;
|
|
2357
|
+
mode?: RequestMode | undefined;
|
|
2358
|
+
priority?: RequestPriority | undefined;
|
|
2359
|
+
redirect?: RequestRedirect | undefined;
|
|
2360
|
+
referrer?: string | undefined;
|
|
2361
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2362
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2363
|
+
window?: null | undefined;
|
|
2364
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2365
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2366
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2367
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2368
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2369
|
+
hookOptions?: {
|
|
2370
|
+
cloneResponse?: boolean;
|
|
2371
|
+
} | undefined;
|
|
2372
|
+
timeout?: number | undefined;
|
|
2373
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2374
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2375
|
+
baseURL?: string | undefined;
|
|
2376
|
+
throw?: boolean | undefined;
|
|
2377
|
+
auth?: ({
|
|
2378
|
+
type: "Bearer";
|
|
2379
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2380
|
+
} | {
|
|
2381
|
+
type: "Basic";
|
|
2382
|
+
username: string | (() => string | undefined) | undefined;
|
|
2383
|
+
password: string | (() => string | undefined) | undefined;
|
|
2384
|
+
} | {
|
|
2385
|
+
type: "Custom";
|
|
2386
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2387
|
+
value: string | (() => string | undefined) | undefined;
|
|
2388
|
+
}) | undefined;
|
|
2389
|
+
body?: undefined;
|
|
2390
|
+
query?: (Partial<{
|
|
2391
|
+
token: string;
|
|
2392
|
+
callbackURL?: string | undefined;
|
|
2393
|
+
}> & Record<string, any>) | undefined;
|
|
2394
|
+
params?: Record<string, any> | undefined;
|
|
2395
|
+
duplex?: "full" | "half" | undefined;
|
|
2396
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2397
|
+
retry?: RetryOptions | undefined;
|
|
2398
|
+
retryAttempt?: number | undefined;
|
|
2399
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2400
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2401
|
+
disableValidation?: boolean | undefined;
|
|
2402
|
+
}>(data_0: better_auth.Prettify<{
|
|
2403
|
+
query: {
|
|
2404
|
+
token: string;
|
|
2405
|
+
callbackURL?: string | undefined;
|
|
2406
|
+
};
|
|
2407
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2408
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2409
|
+
success: boolean;
|
|
2410
|
+
message: string;
|
|
2411
|
+
}, {
|
|
2412
|
+
code?: string;
|
|
2413
|
+
message?: string;
|
|
2414
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2415
|
+
};
|
|
2416
|
+
} & {
|
|
2417
|
+
unlinkAccount: <FetchOptions extends {
|
|
2418
|
+
method?: string | undefined;
|
|
2419
|
+
cache?: RequestCache | undefined;
|
|
2420
|
+
credentials?: RequestCredentials | undefined;
|
|
2421
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2422
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2423
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2424
|
+
authorization: "Bearer" | "Basic";
|
|
2425
|
+
})) | undefined;
|
|
2426
|
+
integrity?: string | undefined;
|
|
2427
|
+
keepalive?: boolean | undefined;
|
|
2428
|
+
mode?: RequestMode | undefined;
|
|
2429
|
+
priority?: RequestPriority | undefined;
|
|
2430
|
+
redirect?: RequestRedirect | undefined;
|
|
2431
|
+
referrer?: string | undefined;
|
|
2432
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2433
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2434
|
+
window?: null | undefined;
|
|
2435
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2436
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2437
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2438
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2439
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2440
|
+
hookOptions?: {
|
|
2441
|
+
cloneResponse?: boolean;
|
|
2442
|
+
} | undefined;
|
|
2443
|
+
timeout?: number | undefined;
|
|
2444
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2445
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2446
|
+
baseURL?: string | undefined;
|
|
2447
|
+
throw?: boolean | undefined;
|
|
2448
|
+
auth?: ({
|
|
2449
|
+
type: "Bearer";
|
|
2450
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2451
|
+
} | {
|
|
2452
|
+
type: "Basic";
|
|
2453
|
+
username: string | (() => string | undefined) | undefined;
|
|
2454
|
+
password: string | (() => string | undefined) | undefined;
|
|
2455
|
+
} | {
|
|
2456
|
+
type: "Custom";
|
|
2457
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2458
|
+
value: string | (() => string | undefined) | undefined;
|
|
2459
|
+
}) | undefined;
|
|
2460
|
+
body?: (Partial<{
|
|
2461
|
+
providerId: string;
|
|
2462
|
+
accountId?: string | undefined;
|
|
2463
|
+
}> & Record<string, any>) | undefined;
|
|
2464
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2465
|
+
params?: Record<string, any> | undefined;
|
|
2466
|
+
duplex?: "full" | "half" | undefined;
|
|
2467
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2468
|
+
retry?: RetryOptions | undefined;
|
|
2469
|
+
retryAttempt?: number | undefined;
|
|
2470
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2471
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2472
|
+
disableValidation?: boolean | undefined;
|
|
2473
|
+
}>(data_0: better_auth.Prettify<{
|
|
2474
|
+
providerId: string;
|
|
2475
|
+
accountId?: string | undefined;
|
|
2476
|
+
} & {
|
|
2477
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2478
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2479
|
+
status: boolean;
|
|
2480
|
+
}, {
|
|
2481
|
+
code?: string;
|
|
2482
|
+
message?: string;
|
|
2483
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2484
|
+
} & {
|
|
2485
|
+
refreshToken: <FetchOptions extends {
|
|
2486
|
+
method?: string | undefined;
|
|
2487
|
+
cache?: RequestCache | undefined;
|
|
2488
|
+
credentials?: RequestCredentials | undefined;
|
|
2489
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2490
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2491
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2492
|
+
authorization: "Bearer" | "Basic";
|
|
2493
|
+
})) | undefined;
|
|
2494
|
+
integrity?: string | undefined;
|
|
2495
|
+
keepalive?: boolean | undefined;
|
|
2496
|
+
mode?: RequestMode | undefined;
|
|
2497
|
+
priority?: RequestPriority | undefined;
|
|
2498
|
+
redirect?: RequestRedirect | undefined;
|
|
2499
|
+
referrer?: string | undefined;
|
|
2500
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2501
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2502
|
+
window?: null | undefined;
|
|
2503
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2504
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2505
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2506
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2507
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2508
|
+
hookOptions?: {
|
|
2509
|
+
cloneResponse?: boolean;
|
|
2510
|
+
} | undefined;
|
|
2511
|
+
timeout?: number | undefined;
|
|
2512
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2513
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2514
|
+
baseURL?: string | undefined;
|
|
2515
|
+
throw?: boolean | undefined;
|
|
2516
|
+
auth?: ({
|
|
2517
|
+
type: "Bearer";
|
|
2518
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2519
|
+
} | {
|
|
2520
|
+
type: "Basic";
|
|
2521
|
+
username: string | (() => string | undefined) | undefined;
|
|
2522
|
+
password: string | (() => string | undefined) | undefined;
|
|
2523
|
+
} | {
|
|
2524
|
+
type: "Custom";
|
|
2525
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2526
|
+
value: string | (() => string | undefined) | undefined;
|
|
2527
|
+
}) | undefined;
|
|
2528
|
+
body?: (Partial<{
|
|
2529
|
+
providerId: string;
|
|
2530
|
+
accountId?: string | undefined;
|
|
2531
|
+
userId?: string | undefined;
|
|
2532
|
+
}> & Record<string, any>) | undefined;
|
|
2533
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2534
|
+
params?: Record<string, any> | undefined;
|
|
2535
|
+
duplex?: "full" | "half" | undefined;
|
|
2536
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2537
|
+
retry?: RetryOptions | undefined;
|
|
2538
|
+
retryAttempt?: number | undefined;
|
|
2539
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2540
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2541
|
+
disableValidation?: boolean | undefined;
|
|
2542
|
+
}>(data_0: better_auth.Prettify<{
|
|
2543
|
+
providerId: string;
|
|
2544
|
+
accountId?: string | undefined;
|
|
2545
|
+
userId?: string | undefined;
|
|
2546
|
+
} & {
|
|
2547
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2548
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<any, {
|
|
2549
|
+
code?: string;
|
|
2550
|
+
message?: string;
|
|
2551
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2552
|
+
} & {
|
|
2553
|
+
getAccessToken: <FetchOptions extends {
|
|
2554
|
+
method?: string | undefined;
|
|
2555
|
+
cache?: RequestCache | undefined;
|
|
2556
|
+
credentials?: RequestCredentials | undefined;
|
|
2557
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2558
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2559
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2560
|
+
authorization: "Bearer" | "Basic";
|
|
2561
|
+
})) | undefined;
|
|
2562
|
+
integrity?: string | undefined;
|
|
2563
|
+
keepalive?: boolean | undefined;
|
|
2564
|
+
mode?: RequestMode | undefined;
|
|
2565
|
+
priority?: RequestPriority | undefined;
|
|
2566
|
+
redirect?: RequestRedirect | undefined;
|
|
2567
|
+
referrer?: string | undefined;
|
|
2568
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2569
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2570
|
+
window?: null | undefined;
|
|
2571
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2572
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2573
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2574
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2575
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2576
|
+
hookOptions?: {
|
|
2577
|
+
cloneResponse?: boolean;
|
|
2578
|
+
} | undefined;
|
|
2579
|
+
timeout?: number | undefined;
|
|
2580
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2581
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2582
|
+
baseURL?: string | undefined;
|
|
2583
|
+
throw?: boolean | undefined;
|
|
2584
|
+
auth?: ({
|
|
2585
|
+
type: "Bearer";
|
|
2586
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2587
|
+
} | {
|
|
2588
|
+
type: "Basic";
|
|
2589
|
+
username: string | (() => string | undefined) | undefined;
|
|
2590
|
+
password: string | (() => string | undefined) | undefined;
|
|
2591
|
+
} | {
|
|
2592
|
+
type: "Custom";
|
|
2593
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2594
|
+
value: string | (() => string | undefined) | undefined;
|
|
2595
|
+
}) | undefined;
|
|
2596
|
+
body?: (Partial<{
|
|
2597
|
+
providerId: string;
|
|
2598
|
+
accountId?: string | undefined;
|
|
2599
|
+
userId?: string | undefined;
|
|
2600
|
+
}> & Record<string, any>) | undefined;
|
|
2601
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2602
|
+
params?: Record<string, any> | undefined;
|
|
2603
|
+
duplex?: "full" | "half" | undefined;
|
|
2604
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2605
|
+
retry?: RetryOptions | undefined;
|
|
2606
|
+
retryAttempt?: number | undefined;
|
|
2607
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2608
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2609
|
+
disableValidation?: boolean | undefined;
|
|
2610
|
+
}>(data_0: better_auth.Prettify<{
|
|
2611
|
+
providerId: string;
|
|
2612
|
+
accountId?: string | undefined;
|
|
2613
|
+
userId?: string | undefined;
|
|
2614
|
+
} & {
|
|
2615
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2616
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2617
|
+
accessToken: string;
|
|
2618
|
+
accessTokenExpiresAt: Date | undefined;
|
|
2619
|
+
scopes: string[];
|
|
2620
|
+
idToken: string | undefined;
|
|
2621
|
+
}, {
|
|
2622
|
+
code?: string;
|
|
2623
|
+
message?: string;
|
|
2624
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2625
|
+
} & {
|
|
2626
|
+
accountInfo: <FetchOptions extends {
|
|
2627
|
+
method?: string | undefined;
|
|
2628
|
+
cache?: RequestCache | undefined;
|
|
2629
|
+
credentials?: RequestCredentials | undefined;
|
|
2630
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2631
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2632
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2633
|
+
authorization: "Bearer" | "Basic";
|
|
2634
|
+
})) | undefined;
|
|
2635
|
+
integrity?: string | undefined;
|
|
2636
|
+
keepalive?: boolean | undefined;
|
|
2637
|
+
mode?: RequestMode | undefined;
|
|
2638
|
+
priority?: RequestPriority | undefined;
|
|
2639
|
+
redirect?: RequestRedirect | undefined;
|
|
2640
|
+
referrer?: string | undefined;
|
|
2641
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2642
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2643
|
+
window?: null | undefined;
|
|
2644
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2645
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2646
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2647
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2648
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2649
|
+
hookOptions?: {
|
|
2650
|
+
cloneResponse?: boolean;
|
|
2651
|
+
} | undefined;
|
|
2652
|
+
timeout?: number | undefined;
|
|
2653
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2654
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2655
|
+
baseURL?: string | undefined;
|
|
2656
|
+
throw?: boolean | undefined;
|
|
2657
|
+
auth?: ({
|
|
2658
|
+
type: "Bearer";
|
|
2659
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2660
|
+
} | {
|
|
2661
|
+
type: "Basic";
|
|
2662
|
+
username: string | (() => string | undefined) | undefined;
|
|
2663
|
+
password: string | (() => string | undefined) | undefined;
|
|
2664
|
+
} | {
|
|
2665
|
+
type: "Custom";
|
|
2666
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2667
|
+
value: string | (() => string | undefined) | undefined;
|
|
2668
|
+
}) | undefined;
|
|
2669
|
+
body?: (Partial<{
|
|
2670
|
+
accountId: string;
|
|
2671
|
+
}> & Record<string, any>) | undefined;
|
|
2672
|
+
query?: (Partial<Record<string, any>> & Record<string, any>) | undefined;
|
|
2673
|
+
params?: Record<string, any> | undefined;
|
|
2674
|
+
duplex?: "full" | "half" | undefined;
|
|
2675
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2676
|
+
retry?: RetryOptions | undefined;
|
|
2677
|
+
retryAttempt?: number | undefined;
|
|
2678
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2679
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2680
|
+
disableValidation?: boolean | undefined;
|
|
2681
|
+
}>(data_0: better_auth.Prettify<{
|
|
2682
|
+
accountId: string;
|
|
2683
|
+
} & {
|
|
2684
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2685
|
+
}>, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2686
|
+
user: packages_core_dist_oauth2.OAuth2UserInfo;
|
|
2687
|
+
data: Record<string, any>;
|
|
2688
|
+
}, {
|
|
2689
|
+
code?: string;
|
|
2690
|
+
message?: string;
|
|
2691
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2692
|
+
} & {
|
|
2693
|
+
getSession: <FetchOptions extends {
|
|
2694
|
+
method?: string | undefined;
|
|
2695
|
+
cache?: RequestCache | undefined;
|
|
2696
|
+
credentials?: RequestCredentials | undefined;
|
|
2697
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2698
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2699
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2700
|
+
authorization: "Bearer" | "Basic";
|
|
2701
|
+
})) | undefined;
|
|
2702
|
+
integrity?: string | undefined;
|
|
2703
|
+
keepalive?: boolean | undefined;
|
|
2704
|
+
mode?: RequestMode | undefined;
|
|
2705
|
+
priority?: RequestPriority | undefined;
|
|
2706
|
+
redirect?: RequestRedirect | undefined;
|
|
2707
|
+
referrer?: string | undefined;
|
|
2708
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2709
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2710
|
+
window?: null | undefined;
|
|
2711
|
+
onRequest?: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2712
|
+
onResponse?: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2713
|
+
onSuccess?: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2714
|
+
onError?: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2715
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2716
|
+
hookOptions?: {
|
|
2717
|
+
cloneResponse?: boolean;
|
|
2718
|
+
} | undefined;
|
|
2719
|
+
timeout?: number | undefined;
|
|
2720
|
+
customFetchImpl?: FetchEsque | undefined;
|
|
2721
|
+
plugins?: BetterFetchPlugin[] | undefined;
|
|
2722
|
+
baseURL?: string | undefined;
|
|
2723
|
+
throw?: boolean | undefined;
|
|
2724
|
+
auth?: ({
|
|
2725
|
+
type: "Bearer";
|
|
2726
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2727
|
+
} | {
|
|
2728
|
+
type: "Basic";
|
|
2729
|
+
username: string | (() => string | undefined) | undefined;
|
|
2730
|
+
password: string | (() => string | undefined) | undefined;
|
|
2731
|
+
} | {
|
|
2732
|
+
type: "Custom";
|
|
2733
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2734
|
+
value: string | (() => string | undefined) | undefined;
|
|
2735
|
+
}) | undefined;
|
|
2736
|
+
body?: undefined;
|
|
2737
|
+
query?: (Partial<{
|
|
2738
|
+
disableCookieCache?: unknown;
|
|
2739
|
+
disableRefresh?: unknown;
|
|
2740
|
+
}> & Record<string, any>) | undefined;
|
|
2741
|
+
params?: Record<string, any> | undefined;
|
|
2742
|
+
duplex?: "full" | "half" | undefined;
|
|
2743
|
+
jsonParser?: ((text: string) => Promise<any> | any) | undefined;
|
|
2744
|
+
retry?: RetryOptions | undefined;
|
|
2745
|
+
retryAttempt?: number | undefined;
|
|
2746
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2747
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2748
|
+
disableValidation?: boolean | undefined;
|
|
2749
|
+
}>(data_0?: better_auth.Prettify<{
|
|
2750
|
+
query?: {
|
|
2751
|
+
disableCookieCache?: unknown;
|
|
2752
|
+
disableRefresh?: unknown;
|
|
2753
|
+
} | undefined;
|
|
2754
|
+
fetchOptions?: FetchOptions | undefined;
|
|
2755
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<BetterFetchResponse<{
|
|
2756
|
+
user: {
|
|
2757
|
+
id: string;
|
|
2758
|
+
createdAt: Date;
|
|
2759
|
+
updatedAt: Date;
|
|
2760
|
+
email: string;
|
|
2761
|
+
emailVerified: boolean;
|
|
2762
|
+
name: string;
|
|
2763
|
+
image?: string | null | undefined;
|
|
2764
|
+
};
|
|
2765
|
+
session: {
|
|
2766
|
+
id: string;
|
|
2767
|
+
createdAt: Date;
|
|
2768
|
+
updatedAt: Date;
|
|
2769
|
+
userId: string;
|
|
2770
|
+
expiresAt: Date;
|
|
2771
|
+
token: string;
|
|
2772
|
+
ipAddress?: string | null | undefined;
|
|
2773
|
+
userAgent?: string | null | undefined;
|
|
2774
|
+
activeTeamId?: string | null | undefined;
|
|
2775
|
+
activeOrganizationId?: string | null | undefined;
|
|
2776
|
+
};
|
|
2777
|
+
} | null, {
|
|
2778
|
+
code?: string;
|
|
2779
|
+
message?: string;
|
|
2780
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
2781
|
+
} & {
|
|
2782
|
+
$Infer: {
|
|
2783
|
+
ActiveOrganization: {
|
|
2784
|
+
members: {
|
|
2785
|
+
id: string;
|
|
2786
|
+
organizationId: string;
|
|
2787
|
+
role: "org:admin" | "org:member" | "org:reviewer";
|
|
2788
|
+
createdAt: Date;
|
|
2789
|
+
userId: string;
|
|
2790
|
+
teamId?: string;
|
|
2791
|
+
user: {
|
|
2792
|
+
email: string;
|
|
2793
|
+
name: string;
|
|
2794
|
+
image?: string;
|
|
2795
|
+
};
|
|
2796
|
+
}[];
|
|
2797
|
+
invitations: {
|
|
2798
|
+
id: string;
|
|
2799
|
+
organizationId: string;
|
|
2800
|
+
email: string;
|
|
2801
|
+
role: "org:admin" | "org:member" | "org:reviewer";
|
|
2802
|
+
status: InvitationStatus;
|
|
2803
|
+
inviterId: string;
|
|
2804
|
+
expiresAt: Date;
|
|
2805
|
+
teamId?: string;
|
|
2806
|
+
}[];
|
|
2807
|
+
teams: better_auth_plugins_organization.Team[];
|
|
2808
|
+
} & {
|
|
2809
|
+
id: string;
|
|
2810
|
+
name: string;
|
|
2811
|
+
slug: string;
|
|
2812
|
+
createdAt: Date;
|
|
2813
|
+
logo?: string | null | undefined;
|
|
2814
|
+
metadata?: any;
|
|
2815
|
+
};
|
|
2816
|
+
Organization: better_auth_plugins_organization.Organization;
|
|
2817
|
+
Invitation: {
|
|
2818
|
+
id: string;
|
|
2819
|
+
organizationId: string;
|
|
2820
|
+
email: string;
|
|
2821
|
+
role: "org:admin" | "org:member" | "org:reviewer";
|
|
2822
|
+
status: InvitationStatus;
|
|
2823
|
+
inviterId: string;
|
|
2824
|
+
expiresAt: Date;
|
|
2825
|
+
teamId?: string;
|
|
2826
|
+
};
|
|
2827
|
+
Member: {
|
|
2828
|
+
id: string;
|
|
2829
|
+
organizationId: string;
|
|
2830
|
+
role: "org:admin" | "org:member" | "org:reviewer";
|
|
2831
|
+
createdAt: Date;
|
|
2832
|
+
userId: string;
|
|
2833
|
+
teamId?: string;
|
|
2834
|
+
user: {
|
|
2835
|
+
email: string;
|
|
2836
|
+
name: string;
|
|
2837
|
+
image?: string;
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
Team: better_auth_plugins_organization.Team;
|
|
2841
|
+
};
|
|
2842
|
+
organization: {
|
|
2843
|
+
checkRolePermission: <R extends "org:admin" | "org:member" | "org:reviewer">(data: ({
|
|
2844
|
+
permission: {
|
|
2845
|
+
access?: string[] | undefined;
|
|
2846
|
+
organization?: ("update" | "delete")[] | undefined;
|
|
2847
|
+
member?: ("update" | "delete" | "create")[] | undefined;
|
|
2848
|
+
invitation?: ("create" | "cancel")[] | undefined;
|
|
2849
|
+
team?: ("update" | "delete" | "create")[] | undefined;
|
|
2850
|
+
ac?: ("update" | "delete" | "create" | "read")[] | undefined;
|
|
2851
|
+
};
|
|
2852
|
+
permissions?: never;
|
|
2853
|
+
} | {
|
|
2854
|
+
permissions: {
|
|
2855
|
+
access?: string[] | undefined;
|
|
2856
|
+
organization?: ("update" | "delete")[] | undefined;
|
|
2857
|
+
member?: ("update" | "delete" | "create")[] | undefined;
|
|
2858
|
+
invitation?: ("create" | "cancel")[] | undefined;
|
|
2859
|
+
team?: ("update" | "delete" | "create")[] | undefined;
|
|
2860
|
+
ac?: ("update" | "delete" | "create" | "read")[] | undefined;
|
|
2861
|
+
};
|
|
2862
|
+
permission?: never;
|
|
2863
|
+
}) & {
|
|
2864
|
+
role: R;
|
|
2865
|
+
}) => boolean;
|
|
2866
|
+
};
|
|
2867
|
+
} & {
|
|
2868
|
+
useSession: Atom<{
|
|
2869
|
+
data: {
|
|
2870
|
+
user: {
|
|
2871
|
+
id: string;
|
|
2872
|
+
createdAt: Date;
|
|
2873
|
+
updatedAt: Date;
|
|
2874
|
+
email: string;
|
|
2875
|
+
emailVerified: boolean;
|
|
2876
|
+
name: string;
|
|
2877
|
+
image?: string | null | undefined;
|
|
2878
|
+
};
|
|
2879
|
+
session: {
|
|
2880
|
+
id: string;
|
|
2881
|
+
createdAt: Date;
|
|
2882
|
+
updatedAt: Date;
|
|
2883
|
+
userId: string;
|
|
2884
|
+
expiresAt: Date;
|
|
2885
|
+
token: string;
|
|
2886
|
+
ipAddress?: string | null | undefined;
|
|
2887
|
+
userAgent?: string | null | undefined;
|
|
2888
|
+
activeTeamId?: string | null | undefined;
|
|
2889
|
+
activeOrganizationId?: string | null | undefined;
|
|
2890
|
+
};
|
|
2891
|
+
} | null;
|
|
2892
|
+
error: BetterFetchError | null;
|
|
2893
|
+
isPending: boolean;
|
|
2894
|
+
}>;
|
|
2895
|
+
$fetch: BetterFetch<{
|
|
2896
|
+
plugins: (BetterFetchPlugin | {
|
|
2897
|
+
id: string;
|
|
2898
|
+
name: string;
|
|
2899
|
+
hooks: {
|
|
2900
|
+
onSuccess: ((context: SuccessContext<any>) => Promise<void> | void) | undefined;
|
|
2901
|
+
onError: ((context: ErrorContext) => Promise<void> | void) | undefined;
|
|
2902
|
+
onRequest: (<T extends Record<string, any>>(context: RequestContext<T>) => Promise<RequestContext | void> | RequestContext | void) | undefined;
|
|
2903
|
+
onResponse: ((context: ResponseContext) => Promise<Response | void | ResponseContext> | Response | ResponseContext | void) | undefined;
|
|
2904
|
+
};
|
|
2905
|
+
} | {
|
|
2906
|
+
id: string;
|
|
2907
|
+
name: string;
|
|
2908
|
+
hooks: {
|
|
2909
|
+
onSuccess(context: SuccessContext<any>): void;
|
|
2910
|
+
};
|
|
2911
|
+
})[];
|
|
2912
|
+
cache?: RequestCache | undefined;
|
|
2913
|
+
credentials?: RequestCredentials;
|
|
2914
|
+
headers?: (HeadersInit & (HeadersInit | {
|
|
2915
|
+
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
2916
|
+
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
2917
|
+
authorization: "Bearer" | "Basic";
|
|
2918
|
+
})) | undefined;
|
|
2919
|
+
integrity?: string | undefined;
|
|
2920
|
+
keepalive?: boolean | undefined;
|
|
2921
|
+
method: string;
|
|
2922
|
+
mode?: RequestMode | undefined;
|
|
2923
|
+
priority?: RequestPriority | undefined;
|
|
2924
|
+
redirect?: RequestRedirect | undefined;
|
|
2925
|
+
referrer?: string | undefined;
|
|
2926
|
+
referrerPolicy?: ReferrerPolicy | undefined;
|
|
2927
|
+
signal?: (AbortSignal | null) | undefined;
|
|
2928
|
+
window?: null | undefined;
|
|
2929
|
+
onRetry?: ((response: ResponseContext) => Promise<void> | void) | undefined;
|
|
2930
|
+
hookOptions?: {
|
|
2931
|
+
cloneResponse?: boolean;
|
|
2932
|
+
} | undefined;
|
|
2933
|
+
timeout?: number | undefined;
|
|
2934
|
+
customFetchImpl: FetchEsque;
|
|
2935
|
+
baseURL: string;
|
|
2936
|
+
throw?: boolean | undefined;
|
|
2937
|
+
auth?: ({
|
|
2938
|
+
type: "Bearer";
|
|
2939
|
+
token: string | Promise<string | undefined> | (() => string | Promise<string | undefined> | undefined) | undefined;
|
|
2940
|
+
} | {
|
|
2941
|
+
type: "Basic";
|
|
2942
|
+
username: string | (() => string | undefined) | undefined;
|
|
2943
|
+
password: string | (() => string | undefined) | undefined;
|
|
2944
|
+
} | {
|
|
2945
|
+
type: "Custom";
|
|
2946
|
+
prefix: string | (() => string | undefined) | undefined;
|
|
2947
|
+
value: string | (() => string | undefined) | undefined;
|
|
2948
|
+
}) | undefined;
|
|
2949
|
+
body?: any;
|
|
2950
|
+
query?: any;
|
|
2951
|
+
params?: any;
|
|
2952
|
+
duplex?: "full" | "half" | undefined;
|
|
2953
|
+
jsonParser: (text: string) => Promise<any> | any;
|
|
2954
|
+
retry?: RetryOptions | undefined;
|
|
2955
|
+
retryAttempt?: number | undefined;
|
|
2956
|
+
output?: (StandardSchemaV1 | typeof Blob | typeof File) | undefined;
|
|
2957
|
+
errorSchema?: StandardSchemaV1 | undefined;
|
|
2958
|
+
disableValidation?: boolean | undefined;
|
|
2959
|
+
}, unknown, unknown, {}>;
|
|
2960
|
+
$store: {
|
|
2961
|
+
notify: (signal?: Omit<string, "$sessionSignal"> | "$sessionSignal") => void;
|
|
2962
|
+
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
2963
|
+
atoms: Record<string, WritableAtom<any>>;
|
|
2964
|
+
};
|
|
2965
|
+
$Infer: {
|
|
2966
|
+
Session: {
|
|
2967
|
+
user: {
|
|
2968
|
+
id: string;
|
|
2969
|
+
createdAt: Date;
|
|
2970
|
+
updatedAt: Date;
|
|
2971
|
+
email: string;
|
|
2972
|
+
emailVerified: boolean;
|
|
2973
|
+
name: string;
|
|
2974
|
+
image?: string | null | undefined;
|
|
2975
|
+
};
|
|
2976
|
+
session: {
|
|
2977
|
+
id: string;
|
|
2978
|
+
createdAt: Date;
|
|
2979
|
+
updatedAt: Date;
|
|
2980
|
+
userId: string;
|
|
2981
|
+
expiresAt: Date;
|
|
2982
|
+
token: string;
|
|
2983
|
+
ipAddress?: string | null | undefined;
|
|
2984
|
+
userAgent?: string | null | undefined;
|
|
2985
|
+
activeTeamId?: string | null | undefined;
|
|
2986
|
+
activeOrganizationId?: string | null | undefined;
|
|
2987
|
+
};
|
|
2988
|
+
};
|
|
2989
|
+
};
|
|
2990
|
+
$ERROR_CODES: any;
|
|
2991
|
+
};
|
|
2992
|
+
|
|
2993
|
+
type CreateAuthClient = typeof createAuthClient;
|
|
2994
|
+
type User = {
|
|
2995
|
+
id: string;
|
|
2996
|
+
email: string;
|
|
2997
|
+
emailVerified: boolean;
|
|
2998
|
+
name: string;
|
|
2999
|
+
createdAt: Date;
|
|
3000
|
+
updatedAt: Date;
|
|
3001
|
+
image?: string | null | undefined;
|
|
3002
|
+
twoFactorEnabled: boolean | null | undefined;
|
|
3003
|
+
banned: boolean | null | undefined;
|
|
3004
|
+
role?: string | null | undefined;
|
|
3005
|
+
banReason?: string | null | undefined;
|
|
3006
|
+
banExpires?: Date | null | undefined;
|
|
3007
|
+
};
|
|
3008
|
+
type Session = {
|
|
3009
|
+
id: string;
|
|
3010
|
+
userId: string;
|
|
3011
|
+
expiresAt: Date;
|
|
3012
|
+
createdAt: Date;
|
|
3013
|
+
updatedAt: Date;
|
|
3014
|
+
token: string;
|
|
3015
|
+
ipAddress?: string | null | undefined;
|
|
3016
|
+
userAgent?: string | null | undefined;
|
|
3017
|
+
activeOrganizationId?: string | null | undefined;
|
|
3018
|
+
activeTeamId?: string | null | undefined;
|
|
3019
|
+
impersonatedBy?: string | null | undefined;
|
|
3020
|
+
};
|
|
3021
|
+
type Member = {
|
|
3022
|
+
id: string;
|
|
3023
|
+
organizationId: string;
|
|
3024
|
+
role: Role;
|
|
3025
|
+
createdAt: Date;
|
|
3026
|
+
userId: string;
|
|
3027
|
+
teamId?: string;
|
|
3028
|
+
user: {
|
|
3029
|
+
id: string;
|
|
3030
|
+
email: string;
|
|
3031
|
+
name: string;
|
|
3032
|
+
image?: string;
|
|
3033
|
+
};
|
|
3034
|
+
};
|
|
3035
|
+
type Invitation = {
|
|
3036
|
+
id: string;
|
|
3037
|
+
organizationId: string;
|
|
3038
|
+
email: string;
|
|
3039
|
+
role: Role;
|
|
3040
|
+
status: InvitationStatus;
|
|
3041
|
+
inviterId: string;
|
|
3042
|
+
expiresAt: Date;
|
|
3043
|
+
teamId?: string;
|
|
3044
|
+
};
|
|
3045
|
+
type Organization = {
|
|
3046
|
+
id: string;
|
|
3047
|
+
name: string;
|
|
3048
|
+
slug: string;
|
|
3049
|
+
createdAt: Date;
|
|
3050
|
+
logo?: string | null | undefined;
|
|
3051
|
+
metadata?: Record<string, any> | undefined;
|
|
3052
|
+
settings?: Record<string, any> | undefined;
|
|
3053
|
+
};
|
|
3054
|
+
type FullOrganization = Organization & {
|
|
3055
|
+
members: Member[];
|
|
3056
|
+
invitations: Invitation[];
|
|
3057
|
+
teams: Team[];
|
|
3058
|
+
};
|
|
3059
|
+
type Team = {
|
|
3060
|
+
id: string;
|
|
3061
|
+
name: string;
|
|
3062
|
+
organizationId: string;
|
|
3063
|
+
createdAt: Date;
|
|
3064
|
+
updatedAt: Date;
|
|
3065
|
+
};
|
|
3066
|
+
type TeamMember = {
|
|
3067
|
+
id: string;
|
|
3068
|
+
teamId: string;
|
|
3069
|
+
userId: string;
|
|
3070
|
+
createdAt: Date;
|
|
3071
|
+
};
|
|
3072
|
+
type Workspace = Organization & {
|
|
3073
|
+
settings?: {
|
|
3074
|
+
disableStorage?: boolean;
|
|
3075
|
+
dataRetentionHours?: number;
|
|
3076
|
+
};
|
|
3077
|
+
stats?: {
|
|
3078
|
+
memberCount: number;
|
|
3079
|
+
projectCount: number;
|
|
3080
|
+
promptCount: number;
|
|
3081
|
+
};
|
|
3082
|
+
};
|
|
3083
|
+
type FullWorkspace = Workspace & FullOrganization;
|
|
3084
|
+
type UpdateWorkspacePayload = {
|
|
3085
|
+
name?: string;
|
|
3086
|
+
logo?: string;
|
|
3087
|
+
};
|
|
3088
|
+
|
|
3089
|
+
export { Roles, ac, createAuthClient, isTokenExpired, rolesAccessControl, validateToken };
|
|
3090
|
+
export type { CreateAuthClient, FullWorkspace, Invitation, Member, Organization, Role, Session, Team, TeamMember, UpdateWorkspacePayload, User, Workspace };
|