@better-auth/core 1.3.27 → 1.3.29
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/.turbo/turbo-build.log +54 -4
- package/build.config.ts +6 -0
- package/dist/db/adapter/index.d.cts +13 -23
- package/dist/db/adapter/index.d.mts +13 -23
- package/dist/db/adapter/index.d.ts +13 -23
- package/dist/db/index.cjs +16 -0
- package/dist/db/index.d.cts +6 -83
- package/dist/db/index.d.mts +6 -83
- package/dist/db/index.d.ts +6 -83
- package/dist/db/index.mjs +16 -1
- package/dist/env/index.cjs +312 -0
- package/dist/env/index.d.cts +36 -0
- package/dist/env/index.d.mts +36 -0
- package/dist/env/index.d.ts +36 -0
- package/dist/env/index.mjs +297 -0
- package/dist/error/index.cjs +44 -0
- package/dist/error/index.d.cts +33 -0
- package/dist/error/index.d.mts +33 -0
- package/dist/error/index.d.ts +33 -0
- package/dist/error/index.mjs +41 -0
- package/dist/index.d.cts +156 -101
- package/dist/index.d.mts +156 -101
- package/dist/index.d.ts +156 -101
- package/dist/middleware/index.cjs +25 -0
- package/dist/middleware/index.d.cts +13 -0
- package/dist/middleware/index.d.mts +13 -0
- package/dist/middleware/index.d.ts +13 -0
- package/dist/middleware/index.mjs +21 -0
- package/dist/oauth2/index.cjs +368 -0
- package/dist/oauth2/index.d.cts +100 -0
- package/dist/oauth2/index.d.mts +100 -0
- package/dist/oauth2/index.d.ts +100 -0
- package/dist/oauth2/index.mjs +357 -0
- package/dist/shared/core.Bl6TpxyD.d.mts +181 -0
- package/dist/shared/core.Bqe5IGAi.d.ts +13 -0
- package/dist/shared/core.Bshk2o_x.d.ts +1721 -0
- package/dist/shared/core.BwoNUcJQ.d.cts +53 -0
- package/dist/shared/core.BwoNUcJQ.d.mts +53 -0
- package/dist/shared/core.BwoNUcJQ.d.ts +53 -0
- package/dist/shared/core.C6_2xGyf.d.mts +1721 -0
- package/dist/shared/{core.CnvFgghY.d.cts → core.CajxAutx.d.cts} +27 -1
- package/dist/shared/{core.CnvFgghY.d.mts → core.CajxAutx.d.mts} +27 -1
- package/dist/shared/{core.CnvFgghY.d.ts → core.CajxAutx.d.ts} +27 -1
- package/dist/shared/core.CfqdiZTu.d.cts +1721 -0
- package/dist/shared/core.DkdZ1o38.d.ts +181 -0
- package/dist/shared/core.Dl-70uns.d.cts +84 -0
- package/dist/shared/core.Dl-70uns.d.mts +84 -0
- package/dist/shared/core.Dl-70uns.d.ts +84 -0
- package/dist/shared/core.DyEdx0m7.d.cts +181 -0
- package/dist/shared/core.E9DfzGLz.d.mts +13 -0
- package/dist/shared/core.HqYn20Fi.d.cts +13 -0
- package/dist/social-providers/index.cjs +2793 -0
- package/dist/social-providers/index.d.cts +3903 -0
- package/dist/social-providers/index.d.mts +3903 -0
- package/dist/social-providers/index.d.ts +3903 -0
- package/dist/social-providers/index.mjs +2743 -0
- package/dist/utils/index.cjs +7 -0
- package/dist/utils/index.d.cts +10 -0
- package/dist/utils/index.d.mts +10 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.mjs +5 -0
- package/package.json +98 -2
- package/src/db/adapter/index.ts +424 -0
- package/src/db/index.ts +2 -0
- package/src/db/schema/rate-limit.ts +21 -0
- package/src/db/type.ts +28 -0
- package/src/env/color-depth.ts +172 -0
- package/src/env/env-impl.ts +124 -0
- package/src/env/index.ts +23 -0
- package/src/env/logger.test.ts +33 -0
- package/src/env/logger.ts +145 -0
- package/src/error/codes.ts +31 -0
- package/src/error/index.ts +11 -0
- package/src/index.ts +0 -2
- package/src/middleware/index.ts +33 -0
- package/src/oauth2/client-credentials-token.ts +102 -0
- package/src/oauth2/create-authorization-url.ts +85 -0
- package/src/oauth2/index.ts +22 -0
- package/src/oauth2/oauth-provider.ts +194 -0
- package/src/oauth2/refresh-access-token.ts +124 -0
- package/src/oauth2/utils.ts +36 -0
- package/src/oauth2/validate-authorization-code.ts +156 -0
- package/src/social-providers/apple.ts +213 -0
- package/src/social-providers/atlassian.ts +130 -0
- package/src/social-providers/cognito.ts +269 -0
- package/src/social-providers/discord.ts +172 -0
- package/src/social-providers/dropbox.ts +112 -0
- package/src/social-providers/facebook.ts +204 -0
- package/src/social-providers/figma.ts +115 -0
- package/src/social-providers/github.ts +154 -0
- package/src/social-providers/gitlab.ts +152 -0
- package/src/social-providers/google.ts +171 -0
- package/src/social-providers/huggingface.ts +116 -0
- package/src/social-providers/index.ts +118 -0
- package/src/social-providers/kakao.ts +178 -0
- package/src/social-providers/kick.ts +95 -0
- package/src/social-providers/line.ts +169 -0
- package/src/social-providers/linear.ts +120 -0
- package/src/social-providers/linkedin.ts +110 -0
- package/src/social-providers/microsoft-entra-id.ts +243 -0
- package/src/social-providers/naver.ts +112 -0
- package/src/social-providers/notion.ts +106 -0
- package/src/social-providers/paypal.ts +261 -0
- package/src/social-providers/reddit.ts +122 -0
- package/src/social-providers/roblox.ts +110 -0
- package/src/social-providers/salesforce.ts +157 -0
- package/src/social-providers/slack.ts +114 -0
- package/src/social-providers/spotify.ts +93 -0
- package/src/social-providers/tiktok.ts +211 -0
- package/src/social-providers/twitch.ts +111 -0
- package/src/social-providers/twitter.ts +194 -0
- package/src/social-providers/vk.ts +128 -0
- package/src/social-providers/zoom.ts +218 -0
- package/src/types/context.ts +334 -0
- package/src/types/cookie.ts +7 -0
- package/src/types/index.ts +19 -1
- package/src/types/init-options.ts +1048 -2
- package/src/types/plugin-client.ts +69 -0
- package/src/types/plugin.ts +134 -0
- package/src/utils/error-codes.ts +51 -0
- package/src/utils/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,124 +1,179 @@
|
|
|
1
|
-
import { L as
|
|
2
|
-
export { a as
|
|
3
|
-
import {
|
|
1
|
+
import { L as LiteralString } from './shared/core.CajxAutx.js';
|
|
2
|
+
export { a as LiteralUnion } from './shared/core.CajxAutx.js';
|
|
3
|
+
import { A as AuthContext, B as BetterAuthOptions, a as AuthMiddleware } from './shared/core.Bshk2o_x.js';
|
|
4
|
+
export { b as BetterAuthAdvancedOptions, d as BetterAuthCookies, c as BetterAuthRateLimitOptions, G as GenerateIdFn, e as GenericEndpointContext, I as InternalAdapter } from './shared/core.Bshk2o_x.js';
|
|
5
|
+
import { Migration } from 'kysely';
|
|
6
|
+
import { Endpoint, Middleware, EndpointContext, InputContext } from 'better-call';
|
|
7
|
+
import { B as BetterAuthPluginDBSchema } from './shared/core.Bqe5IGAi.js';
|
|
8
|
+
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
9
|
+
import { WritableAtom, Atom } from 'nanostores';
|
|
4
10
|
import 'zod';
|
|
11
|
+
import './shared/core.Dl-70uns.js';
|
|
12
|
+
import 'bun:sqlite';
|
|
13
|
+
import 'node:sqlite';
|
|
14
|
+
import './social-providers/index.js';
|
|
15
|
+
import '@better-auth/core/oauth2';
|
|
16
|
+
import './shared/core.DkdZ1o38.js';
|
|
17
|
+
import './shared/core.BwoNUcJQ.js';
|
|
18
|
+
import '@better-auth/core';
|
|
5
19
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
type
|
|
20
|
+
type Awaitable<T> = T | Promise<T>;
|
|
21
|
+
type DeepPartial<T> = T extends Function ? T : T extends object ? {
|
|
22
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
23
|
+
} : T;
|
|
24
|
+
type HookEndpointContext = EndpointContext<string, any> & Omit<InputContext<string, any>, "method"> & {
|
|
25
|
+
context: AuthContext & {
|
|
26
|
+
returned?: unknown;
|
|
27
|
+
responseHeaders?: Headers;
|
|
28
|
+
};
|
|
29
|
+
headers?: Headers;
|
|
30
|
+
};
|
|
31
|
+
type BetterAuthPlugin = {
|
|
32
|
+
id: LiteralString;
|
|
11
33
|
/**
|
|
12
|
-
*
|
|
34
|
+
* The init function is called when the plugin is initialized.
|
|
35
|
+
* You can return a new context or modify the existing context.
|
|
13
36
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
init?: (ctx: AuthContext) => Awaitable<{
|
|
38
|
+
context?: DeepPartial<Omit<AuthContext, "options">>;
|
|
39
|
+
options?: Partial<BetterAuthOptions>;
|
|
40
|
+
}> | void | Promise<void>;
|
|
41
|
+
endpoints?: {
|
|
42
|
+
[key: string]: Endpoint;
|
|
43
|
+
};
|
|
44
|
+
middlewares?: {
|
|
45
|
+
path: string;
|
|
46
|
+
middleware: Middleware;
|
|
47
|
+
}[];
|
|
48
|
+
onRequest?: (request: Request, ctx: AuthContext) => Promise<{
|
|
49
|
+
response: Response;
|
|
50
|
+
} | {
|
|
51
|
+
request: Request;
|
|
52
|
+
} | void>;
|
|
53
|
+
onResponse?: (response: Response, ctx: AuthContext) => Promise<{
|
|
54
|
+
response: Response;
|
|
55
|
+
} | void>;
|
|
56
|
+
hooks?: {
|
|
57
|
+
before?: {
|
|
58
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
59
|
+
handler: AuthMiddleware;
|
|
60
|
+
}[];
|
|
61
|
+
after?: {
|
|
62
|
+
matcher: (context: HookEndpointContext) => boolean;
|
|
63
|
+
handler: AuthMiddleware;
|
|
64
|
+
}[];
|
|
32
65
|
};
|
|
33
66
|
/**
|
|
34
|
-
*
|
|
67
|
+
* Schema the plugin needs
|
|
68
|
+
*
|
|
69
|
+
* This will also be used to migrate the database. If the fields are dynamic from the plugins
|
|
70
|
+
* configuration each time the configuration is changed a new migration will be created.
|
|
35
71
|
*
|
|
36
|
-
*
|
|
72
|
+
* NOTE: If you want to create migrations manually using
|
|
73
|
+
* migrations option or any other way you
|
|
74
|
+
* can disable migration per table basis.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* schema: {
|
|
79
|
+
* user: {
|
|
80
|
+
* fields: {
|
|
81
|
+
* email: {
|
|
82
|
+
* type: "string",
|
|
83
|
+
* },
|
|
84
|
+
* emailVerified: {
|
|
85
|
+
* type: "boolean",
|
|
86
|
+
* defaultValue: false,
|
|
87
|
+
* },
|
|
88
|
+
* },
|
|
89
|
+
* }
|
|
90
|
+
* } as AuthPluginSchema
|
|
91
|
+
* ```
|
|
37
92
|
*/
|
|
38
|
-
|
|
93
|
+
schema?: BetterAuthPluginDBSchema;
|
|
39
94
|
/**
|
|
40
|
-
*
|
|
95
|
+
* The migrations of the plugin. If you define schema that will automatically create
|
|
96
|
+
* migrations for you.
|
|
41
97
|
*
|
|
42
|
-
*
|
|
98
|
+
* ⚠️ Only uses this if you dont't want to use the schema option and you disabled migrations for
|
|
99
|
+
* the tables.
|
|
43
100
|
*/
|
|
44
|
-
|
|
101
|
+
migrations?: Record<string, Migration>;
|
|
45
102
|
/**
|
|
46
|
-
*
|
|
103
|
+
* The options of the plugin
|
|
47
104
|
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Enable cross subdomain cookies
|
|
51
|
-
*/
|
|
52
|
-
enabled: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Additional cookies to be shared across subdomains
|
|
55
|
-
*/
|
|
56
|
-
additionalCookies?: string[];
|
|
57
|
-
/**
|
|
58
|
-
* The domain to use for the cookies
|
|
59
|
-
*
|
|
60
|
-
* By default, the domain will be the root
|
|
61
|
-
* domain from the base URL.
|
|
62
|
-
*/
|
|
63
|
-
domain?: string;
|
|
64
|
-
};
|
|
65
|
-
cookies?: {
|
|
66
|
-
[key: string]: {
|
|
67
|
-
name?: string;
|
|
68
|
-
attributes?: CookieOptions;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
defaultCookieAttributes?: CookieOptions;
|
|
105
|
+
options?: Record<string, any> | undefined;
|
|
72
106
|
/**
|
|
73
|
-
*
|
|
74
|
-
* in cookies config, this will be overridden.
|
|
75
|
-
*
|
|
76
|
-
* @default
|
|
77
|
-
* ```txt
|
|
78
|
-
* "appName" -> which defaults to "better-auth"
|
|
79
|
-
* ```
|
|
107
|
+
* types to be inferred
|
|
80
108
|
*/
|
|
81
|
-
|
|
109
|
+
$Infer?: Record<string, any>;
|
|
82
110
|
/**
|
|
83
|
-
*
|
|
111
|
+
* The rate limit rules to apply to specific paths.
|
|
84
112
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* @default 100
|
|
91
|
-
*/
|
|
92
|
-
defaultFindManyLimit?: number;
|
|
93
|
-
/**
|
|
94
|
-
* If your database auto increments number ids, set this to `true`.
|
|
95
|
-
*
|
|
96
|
-
* Note: If enabled, we will not handle ID generation (including if you use `generateId`), and it would be expected that your database will provide the ID automatically.
|
|
97
|
-
*
|
|
98
|
-
* @default false
|
|
99
|
-
*/
|
|
100
|
-
useNumberId?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Custom generateId function.
|
|
103
|
-
*
|
|
104
|
-
* If not provided, random ids will be generated.
|
|
105
|
-
* If set to false, the database's auto generated id will be used.
|
|
106
|
-
*/
|
|
107
|
-
generateId?: GenerateIdFn | false;
|
|
108
|
-
};
|
|
113
|
+
rateLimit?: {
|
|
114
|
+
window: number;
|
|
115
|
+
max: number;
|
|
116
|
+
pathMatcher: (path: string) => boolean;
|
|
117
|
+
}[];
|
|
109
118
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* If not provided, random ids will be generated.
|
|
113
|
-
* If set to false, the database's auto generated id will be used.
|
|
114
|
-
*
|
|
115
|
-
* @deprecated Please use `database.generateId` instead. This will be potentially removed in future releases.
|
|
119
|
+
* The error codes returned by the plugin
|
|
116
120
|
*/
|
|
117
|
-
|
|
121
|
+
$ERROR_CODES?: Record<string, string>;
|
|
118
122
|
};
|
|
119
123
|
|
|
120
|
-
interface
|
|
124
|
+
interface ClientStore {
|
|
125
|
+
notify: (signal: string) => void;
|
|
126
|
+
listen: (signal: string, listener: () => void) => void;
|
|
127
|
+
atoms: Record<string, WritableAtom<any>>;
|
|
128
|
+
}
|
|
129
|
+
type ClientAtomListener = {
|
|
130
|
+
matcher: (path: string) => boolean;
|
|
131
|
+
signal: "$sessionSignal" | Omit<string, "$sessionSignal">;
|
|
132
|
+
};
|
|
133
|
+
interface BetterAuthClientOptions {
|
|
134
|
+
fetchOptions?: BetterFetchOption;
|
|
135
|
+
plugins?: BetterAuthClientPlugin[];
|
|
136
|
+
baseURL?: string;
|
|
137
|
+
basePath?: string;
|
|
138
|
+
disableDefaultFetchPlugins?: boolean;
|
|
139
|
+
$InferAuth?: BetterAuthOptions;
|
|
140
|
+
}
|
|
141
|
+
interface BetterAuthClientPlugin {
|
|
142
|
+
id: LiteralString;
|
|
143
|
+
/**
|
|
144
|
+
* only used for type inference. don't pass the
|
|
145
|
+
* actual plugin
|
|
146
|
+
*/
|
|
147
|
+
$InferServerPlugin?: BetterAuthPlugin;
|
|
148
|
+
/**
|
|
149
|
+
* Custom actions
|
|
150
|
+
*/
|
|
151
|
+
getActions?: ($fetch: BetterFetch, $store: ClientStore,
|
|
152
|
+
/**
|
|
153
|
+
* better-auth client options
|
|
154
|
+
*/
|
|
155
|
+
options: BetterAuthClientOptions | undefined) => Record<string, any>;
|
|
156
|
+
/**
|
|
157
|
+
* State atoms that'll be resolved by each framework
|
|
158
|
+
* auth store.
|
|
159
|
+
*/
|
|
160
|
+
getAtoms?: ($fetch: BetterFetch) => Record<string, Atom<any>>;
|
|
161
|
+
/**
|
|
162
|
+
* specify path methods for server plugin inferred
|
|
163
|
+
* endpoints to force a specific method.
|
|
164
|
+
*/
|
|
165
|
+
pathMethods?: Record<string, "POST" | "GET">;
|
|
166
|
+
/**
|
|
167
|
+
* Better fetch plugins
|
|
168
|
+
*/
|
|
169
|
+
fetchPlugins?: BetterFetchPlugin[];
|
|
170
|
+
/**
|
|
171
|
+
* a list of recaller based on a matcher function.
|
|
172
|
+
* The signal name needs to match a signal in this
|
|
173
|
+
* plugin or any plugin the user might have added.
|
|
174
|
+
*/
|
|
175
|
+
atomListeners?: ClientAtomListener[];
|
|
121
176
|
}
|
|
122
177
|
|
|
123
|
-
export {
|
|
124
|
-
export type {
|
|
178
|
+
export { AuthContext, BetterAuthOptions, LiteralString };
|
|
179
|
+
export type { BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthPlugin, ClientAtomListener, ClientStore };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const betterCall = require('better-call');
|
|
4
|
+
|
|
5
|
+
const optionsMiddleware = betterCall.createMiddleware(async () => {
|
|
6
|
+
return {};
|
|
7
|
+
});
|
|
8
|
+
const createAuthMiddleware = betterCall.createMiddleware.create({
|
|
9
|
+
use: [
|
|
10
|
+
optionsMiddleware,
|
|
11
|
+
/**
|
|
12
|
+
* Only use for post hooks
|
|
13
|
+
*/
|
|
14
|
+
betterCall.createMiddleware(async () => {
|
|
15
|
+
return {};
|
|
16
|
+
})
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
const createAuthEndpoint = betterCall.createEndpoint.create({
|
|
20
|
+
use: [optionsMiddleware]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
exports.createAuthEndpoint = createAuthEndpoint;
|
|
24
|
+
exports.createAuthMiddleware = createAuthMiddleware;
|
|
25
|
+
exports.optionsMiddleware = optionsMiddleware;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.cjs';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.CfqdiZTu.cjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import '../shared/core.Dl-70uns.cjs';
|
|
7
|
+
import 'bun:sqlite';
|
|
8
|
+
import 'node:sqlite';
|
|
9
|
+
import '../social-providers/index.cjs';
|
|
10
|
+
import '@better-auth/core/oauth2';
|
|
11
|
+
import '../shared/core.DyEdx0m7.cjs';
|
|
12
|
+
import '../shared/core.BwoNUcJQ.cjs';
|
|
13
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.mjs';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.C6_2xGyf.mjs';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import '../shared/core.Dl-70uns.mjs';
|
|
7
|
+
import 'bun:sqlite';
|
|
8
|
+
import 'node:sqlite';
|
|
9
|
+
import '../social-providers/index.mjs';
|
|
10
|
+
import '@better-auth/core/oauth2';
|
|
11
|
+
import '../shared/core.Bl6TpxyD.mjs';
|
|
12
|
+
import '../shared/core.BwoNUcJQ.mjs';
|
|
13
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'better-call';
|
|
2
|
+
import '../shared/core.CajxAutx.js';
|
|
3
|
+
export { n as AuthEndpoint, a as AuthMiddleware, m as createAuthEndpoint, l as createAuthMiddleware, o as optionsMiddleware } from '../shared/core.Bshk2o_x.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import 'kysely';
|
|
6
|
+
import '../shared/core.Dl-70uns.js';
|
|
7
|
+
import 'bun:sqlite';
|
|
8
|
+
import 'node:sqlite';
|
|
9
|
+
import '../social-providers/index.js';
|
|
10
|
+
import '@better-auth/core/oauth2';
|
|
11
|
+
import '../shared/core.DkdZ1o38.js';
|
|
12
|
+
import '../shared/core.BwoNUcJQ.js';
|
|
13
|
+
import '@better-auth/core';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createMiddleware, createEndpoint } from 'better-call';
|
|
2
|
+
|
|
3
|
+
const optionsMiddleware = createMiddleware(async () => {
|
|
4
|
+
return {};
|
|
5
|
+
});
|
|
6
|
+
const createAuthMiddleware = createMiddleware.create({
|
|
7
|
+
use: [
|
|
8
|
+
optionsMiddleware,
|
|
9
|
+
/**
|
|
10
|
+
* Only use for post hooks
|
|
11
|
+
*/
|
|
12
|
+
createMiddleware(async () => {
|
|
13
|
+
return {};
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
const createAuthEndpoint = createEndpoint.create({
|
|
18
|
+
use: [optionsMiddleware]
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|