better-auth 1.6.26 → 1.6.28
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/adapters/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +16 -13
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +59 -46
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +137 -132
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +76 -69
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +45 -41
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +12 -9
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +6 -3
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +12 -11
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +20 -18
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +7 -6
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +33 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +12 -11
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { AccessControl, ArrayElement, Statements } from "../access/types.mjs";
|
|
2
2
|
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "./types.mjs";
|
|
3
|
-
import "
|
|
3
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
4
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
5
|
+
import * as _$better_call0 from "better-call";
|
|
6
|
+
import * as _$zod from "zod";
|
|
7
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
8
|
+
|
|
4
9
|
//#region src/plugins/admin/admin.d.ts
|
|
5
10
|
declare module "@better-auth/core" {
|
|
6
11
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -50,7 +55,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
50
55
|
token: string;
|
|
51
56
|
ipAddress?: string | null | undefined;
|
|
52
57
|
userAgent?: string | null | undefined;
|
|
53
|
-
} & Record<string, unknown>, ctx:
|
|
58
|
+
} & Record<string, unknown>, ctx: _$_better_auth_core0.GenericEndpointContext | null): Promise<void>;
|
|
54
59
|
};
|
|
55
60
|
};
|
|
56
61
|
};
|
|
@@ -58,19 +63,19 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
58
63
|
};
|
|
59
64
|
hooks: {
|
|
60
65
|
after: {
|
|
61
|
-
matcher(context:
|
|
62
|
-
handler: (inputContext:
|
|
66
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
67
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<SessionWithImpersonatedBy[] | undefined>>;
|
|
63
68
|
}[];
|
|
64
69
|
};
|
|
65
70
|
endpoints: {
|
|
66
|
-
setRole:
|
|
71
|
+
setRole: _$better_call0.StrictEndpoint<"/admin/set-role", {
|
|
67
72
|
method: "POST";
|
|
68
|
-
body:
|
|
69
|
-
userId:
|
|
70
|
-
role:
|
|
71
|
-
},
|
|
73
|
+
body: _$zod.ZodObject<{
|
|
74
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
75
|
+
role: _$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>]>;
|
|
76
|
+
}, _$zod_v4_core0.$strip>;
|
|
72
77
|
requireHeaders: true;
|
|
73
|
-
use: (
|
|
78
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
74
79
|
session: {
|
|
75
80
|
user: UserWithRole;
|
|
76
81
|
session: {
|
|
@@ -84,7 +89,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
84
89
|
userAgent?: string | null | undefined;
|
|
85
90
|
};
|
|
86
91
|
};
|
|
87
|
-
}
|
|
92
|
+
}>>[];
|
|
88
93
|
metadata: {
|
|
89
94
|
openapi: {
|
|
90
95
|
operationId: string;
|
|
@@ -118,12 +123,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
118
123
|
}, {
|
|
119
124
|
user: UserWithRole;
|
|
120
125
|
}>;
|
|
121
|
-
getUser:
|
|
126
|
+
getUser: _$better_call0.StrictEndpoint<"/admin/get-user", {
|
|
122
127
|
method: "GET";
|
|
123
|
-
query:
|
|
124
|
-
id:
|
|
125
|
-
},
|
|
126
|
-
use: (
|
|
128
|
+
query: _$zod.ZodObject<{
|
|
129
|
+
id: _$zod.ZodString;
|
|
130
|
+
}, _$zod_v4_core0.$strip>;
|
|
131
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
127
132
|
session: {
|
|
128
133
|
user: UserWithRole;
|
|
129
134
|
session: {
|
|
@@ -137,7 +142,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
137
142
|
userAgent?: string | null | undefined;
|
|
138
143
|
};
|
|
139
144
|
};
|
|
140
|
-
}
|
|
145
|
+
}>>[];
|
|
141
146
|
metadata: {
|
|
142
147
|
openapi: {
|
|
143
148
|
operationId: string;
|
|
@@ -163,15 +168,15 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
163
168
|
};
|
|
164
169
|
};
|
|
165
170
|
}, UserWithRole>;
|
|
166
|
-
createUser:
|
|
171
|
+
createUser: _$better_call0.StrictEndpoint<"/admin/create-user", {
|
|
167
172
|
method: "POST";
|
|
168
|
-
body:
|
|
169
|
-
email:
|
|
170
|
-
password:
|
|
171
|
-
name:
|
|
172
|
-
role:
|
|
173
|
-
data:
|
|
174
|
-
},
|
|
173
|
+
body: _$zod.ZodObject<{
|
|
174
|
+
email: _$zod.ZodString;
|
|
175
|
+
password: _$zod.ZodOptional<_$zod.ZodString>;
|
|
176
|
+
name: _$zod.ZodString;
|
|
177
|
+
role: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>]>>;
|
|
178
|
+
data: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodAny>>;
|
|
179
|
+
}, _$zod_v4_core0.$strip>;
|
|
175
180
|
metadata: {
|
|
176
181
|
openapi: {
|
|
177
182
|
operationId: string;
|
|
@@ -208,13 +213,13 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
208
213
|
}, {
|
|
209
214
|
user: UserWithRole;
|
|
210
215
|
}>;
|
|
211
|
-
adminUpdateUser:
|
|
216
|
+
adminUpdateUser: _$better_call0.StrictEndpoint<"/admin/update-user", {
|
|
212
217
|
method: "POST";
|
|
213
|
-
body:
|
|
214
|
-
userId:
|
|
215
|
-
data:
|
|
216
|
-
},
|
|
217
|
-
use: (
|
|
218
|
+
body: _$zod.ZodObject<{
|
|
219
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
220
|
+
data: _$zod.ZodRecord<_$zod.ZodAny, _$zod.ZodAny>;
|
|
221
|
+
}, _$zod_v4_core0.$strip>;
|
|
222
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
218
223
|
session: {
|
|
219
224
|
user: UserWithRole;
|
|
220
225
|
session: {
|
|
@@ -228,7 +233,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
228
233
|
userAgent?: string | null | undefined;
|
|
229
234
|
};
|
|
230
235
|
};
|
|
231
|
-
}
|
|
236
|
+
}>>[];
|
|
232
237
|
metadata: {
|
|
233
238
|
openapi: {
|
|
234
239
|
operationId: string;
|
|
@@ -254,9 +259,9 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
254
259
|
};
|
|
255
260
|
};
|
|
256
261
|
}, UserWithRole>;
|
|
257
|
-
listUsers:
|
|
262
|
+
listUsers: _$better_call0.StrictEndpoint<"/admin/list-users", {
|
|
258
263
|
method: "GET";
|
|
259
|
-
use: (
|
|
264
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
260
265
|
session: {
|
|
261
266
|
user: UserWithRole;
|
|
262
267
|
session: {
|
|
@@ -270,28 +275,28 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
270
275
|
userAgent?: string | null | undefined;
|
|
271
276
|
};
|
|
272
277
|
};
|
|
273
|
-
}
|
|
274
|
-
query:
|
|
275
|
-
searchValue:
|
|
276
|
-
searchField:
|
|
278
|
+
}>>[];
|
|
279
|
+
query: _$zod.ZodObject<{
|
|
280
|
+
searchValue: _$zod.ZodOptional<_$zod.ZodString>;
|
|
281
|
+
searchField: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
277
282
|
email: "email";
|
|
278
283
|
name: "name";
|
|
279
284
|
}>>;
|
|
280
|
-
searchOperator:
|
|
285
|
+
searchOperator: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
281
286
|
contains: "contains";
|
|
282
287
|
starts_with: "starts_with";
|
|
283
288
|
ends_with: "ends_with";
|
|
284
289
|
}>>;
|
|
285
|
-
limit:
|
|
286
|
-
offset:
|
|
287
|
-
sortBy:
|
|
288
|
-
sortDirection:
|
|
290
|
+
limit: _$zod.ZodOptional<_$zod.ZodUnion<[_$zod.ZodString, _$zod.ZodNumber]>>;
|
|
291
|
+
offset: _$zod.ZodOptional<_$zod.ZodUnion<[_$zod.ZodString, _$zod.ZodNumber]>>;
|
|
292
|
+
sortBy: _$zod.ZodOptional<_$zod.ZodString>;
|
|
293
|
+
sortDirection: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
289
294
|
asc: "asc";
|
|
290
295
|
desc: "desc";
|
|
291
296
|
}>>;
|
|
292
|
-
filterField:
|
|
293
|
-
filterValue:
|
|
294
|
-
filterOperator:
|
|
297
|
+
filterField: _$zod.ZodOptional<_$zod.ZodString>;
|
|
298
|
+
filterValue: _$zod.ZodOptional<_$zod.ZodUnion<[_$zod.ZodUnion<[_$zod.ZodUnion<[_$zod.ZodUnion<[_$zod.ZodString, _$zod.ZodNumber]>, _$zod.ZodBoolean]>, _$zod.ZodArray<_$zod.ZodString>]>, _$zod.ZodArray<_$zod.ZodNumber>]>>;
|
|
299
|
+
filterOperator: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
295
300
|
eq: "eq";
|
|
296
301
|
ne: "ne";
|
|
297
302
|
gt: "gt";
|
|
@@ -304,7 +309,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
304
309
|
starts_with: "starts_with";
|
|
305
310
|
ends_with: "ends_with";
|
|
306
311
|
}>>;
|
|
307
|
-
},
|
|
312
|
+
}, _$zod_v4_core0.$strip>;
|
|
308
313
|
metadata: {
|
|
309
314
|
openapi: {
|
|
310
315
|
operationId: string;
|
|
@@ -346,9 +351,9 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
346
351
|
users: UserWithRole[];
|
|
347
352
|
total: number;
|
|
348
353
|
}>;
|
|
349
|
-
listUserSessions:
|
|
354
|
+
listUserSessions: _$better_call0.StrictEndpoint<"/admin/list-user-sessions", {
|
|
350
355
|
method: "POST";
|
|
351
|
-
use: (
|
|
356
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
352
357
|
session: {
|
|
353
358
|
user: UserWithRole;
|
|
354
359
|
session: {
|
|
@@ -362,10 +367,10 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
362
367
|
userAgent?: string | null | undefined;
|
|
363
368
|
};
|
|
364
369
|
};
|
|
365
|
-
}
|
|
366
|
-
body:
|
|
367
|
-
userId:
|
|
368
|
-
},
|
|
370
|
+
}>>[];
|
|
371
|
+
body: _$zod.ZodObject<{
|
|
372
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
373
|
+
}, _$zod_v4_core0.$strip>;
|
|
369
374
|
metadata: {
|
|
370
375
|
openapi: {
|
|
371
376
|
operationId: string;
|
|
@@ -396,12 +401,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
396
401
|
}, {
|
|
397
402
|
sessions: SessionWithImpersonatedBy[];
|
|
398
403
|
}>;
|
|
399
|
-
unbanUser:
|
|
404
|
+
unbanUser: _$better_call0.StrictEndpoint<"/admin/unban-user", {
|
|
400
405
|
method: "POST";
|
|
401
|
-
body:
|
|
402
|
-
userId:
|
|
403
|
-
},
|
|
404
|
-
use: (
|
|
406
|
+
body: _$zod.ZodObject<{
|
|
407
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
408
|
+
}, _$zod_v4_core0.$strip>;
|
|
409
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
405
410
|
session: {
|
|
406
411
|
user: UserWithRole;
|
|
407
412
|
session: {
|
|
@@ -415,7 +420,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
415
420
|
userAgent?: string | null | undefined;
|
|
416
421
|
};
|
|
417
422
|
};
|
|
418
|
-
}
|
|
423
|
+
}>>[];
|
|
419
424
|
metadata: {
|
|
420
425
|
openapi: {
|
|
421
426
|
operationId: string;
|
|
@@ -443,14 +448,14 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
443
448
|
}, {
|
|
444
449
|
user: UserWithRole;
|
|
445
450
|
}>;
|
|
446
|
-
banUser:
|
|
451
|
+
banUser: _$better_call0.StrictEndpoint<"/admin/ban-user", {
|
|
447
452
|
method: "POST";
|
|
448
|
-
body:
|
|
449
|
-
userId:
|
|
450
|
-
banReason:
|
|
451
|
-
banExpiresIn:
|
|
452
|
-
},
|
|
453
|
-
use: (
|
|
453
|
+
body: _$zod.ZodObject<{
|
|
454
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
455
|
+
banReason: _$zod.ZodOptional<_$zod.ZodString>;
|
|
456
|
+
banExpiresIn: _$zod.ZodOptional<_$zod.ZodNumber>;
|
|
457
|
+
}, _$zod_v4_core0.$strip>;
|
|
458
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
454
459
|
session: {
|
|
455
460
|
user: UserWithRole;
|
|
456
461
|
session: {
|
|
@@ -464,7 +469,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
464
469
|
userAgent?: string | null | undefined;
|
|
465
470
|
};
|
|
466
471
|
};
|
|
467
|
-
}
|
|
472
|
+
}>>[];
|
|
468
473
|
metadata: {
|
|
469
474
|
openapi: {
|
|
470
475
|
operationId: string;
|
|
@@ -492,12 +497,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
492
497
|
}, {
|
|
493
498
|
user: UserWithRole;
|
|
494
499
|
}>;
|
|
495
|
-
impersonateUser:
|
|
500
|
+
impersonateUser: _$better_call0.StrictEndpoint<"/admin/impersonate-user", {
|
|
496
501
|
method: "POST";
|
|
497
|
-
body:
|
|
498
|
-
userId:
|
|
499
|
-
},
|
|
500
|
-
use: (
|
|
502
|
+
body: _$zod.ZodObject<{
|
|
503
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
504
|
+
}, _$zod_v4_core0.$strip>;
|
|
505
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
501
506
|
session: {
|
|
502
507
|
user: UserWithRole;
|
|
503
508
|
session: {
|
|
@@ -511,7 +516,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
511
516
|
userAgent?: string | null | undefined;
|
|
512
517
|
};
|
|
513
518
|
};
|
|
514
|
-
}
|
|
519
|
+
}>>[];
|
|
515
520
|
metadata: {
|
|
516
521
|
openapi: {
|
|
517
522
|
operationId: string;
|
|
@@ -552,7 +557,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
552
557
|
};
|
|
553
558
|
user: UserWithRole;
|
|
554
559
|
}>;
|
|
555
|
-
stopImpersonating:
|
|
560
|
+
stopImpersonating: _$better_call0.StrictEndpoint<"/admin/stop-impersonating", {
|
|
556
561
|
method: "POST";
|
|
557
562
|
requireHeaders: true;
|
|
558
563
|
}, {
|
|
@@ -576,12 +581,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
576
581
|
image?: string | null | undefined;
|
|
577
582
|
} & Record<string, any>;
|
|
578
583
|
}>;
|
|
579
|
-
revokeUserSession:
|
|
584
|
+
revokeUserSession: _$better_call0.StrictEndpoint<"/admin/revoke-user-session", {
|
|
580
585
|
method: "POST";
|
|
581
|
-
body:
|
|
582
|
-
sessionToken:
|
|
583
|
-
},
|
|
584
|
-
use: (
|
|
586
|
+
body: _$zod.ZodObject<{
|
|
587
|
+
sessionToken: _$zod.ZodString;
|
|
588
|
+
}, _$zod_v4_core0.$strip>;
|
|
589
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
585
590
|
session: {
|
|
586
591
|
user: UserWithRole;
|
|
587
592
|
session: {
|
|
@@ -595,7 +600,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
595
600
|
userAgent?: string | null | undefined;
|
|
596
601
|
};
|
|
597
602
|
};
|
|
598
|
-
}
|
|
603
|
+
}>>[];
|
|
599
604
|
metadata: {
|
|
600
605
|
openapi: {
|
|
601
606
|
operationId: string;
|
|
@@ -623,12 +628,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
623
628
|
}, {
|
|
624
629
|
success: boolean;
|
|
625
630
|
}>;
|
|
626
|
-
revokeUserSessions:
|
|
631
|
+
revokeUserSessions: _$better_call0.StrictEndpoint<"/admin/revoke-user-sessions", {
|
|
627
632
|
method: "POST";
|
|
628
|
-
body:
|
|
629
|
-
userId:
|
|
630
|
-
},
|
|
631
|
-
use: (
|
|
633
|
+
body: _$zod.ZodObject<{
|
|
634
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
635
|
+
}, _$zod_v4_core0.$strip>;
|
|
636
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
632
637
|
session: {
|
|
633
638
|
user: UserWithRole;
|
|
634
639
|
session: {
|
|
@@ -642,7 +647,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
642
647
|
userAgent?: string | null | undefined;
|
|
643
648
|
};
|
|
644
649
|
};
|
|
645
|
-
}
|
|
650
|
+
}>>[];
|
|
646
651
|
metadata: {
|
|
647
652
|
openapi: {
|
|
648
653
|
operationId: string;
|
|
@@ -670,12 +675,12 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
670
675
|
}, {
|
|
671
676
|
success: boolean;
|
|
672
677
|
}>;
|
|
673
|
-
removeUser:
|
|
678
|
+
removeUser: _$better_call0.StrictEndpoint<"/admin/remove-user", {
|
|
674
679
|
method: "POST";
|
|
675
|
-
body:
|
|
676
|
-
userId:
|
|
677
|
-
},
|
|
678
|
-
use: (
|
|
680
|
+
body: _$zod.ZodObject<{
|
|
681
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
682
|
+
}, _$zod_v4_core0.$strip>;
|
|
683
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
679
684
|
session: {
|
|
680
685
|
user: UserWithRole;
|
|
681
686
|
session: {
|
|
@@ -689,7 +694,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
689
694
|
userAgent?: string | null | undefined;
|
|
690
695
|
};
|
|
691
696
|
};
|
|
692
|
-
}
|
|
697
|
+
}>>[];
|
|
693
698
|
metadata: {
|
|
694
699
|
openapi: {
|
|
695
700
|
operationId: string;
|
|
@@ -717,13 +722,13 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
717
722
|
}, {
|
|
718
723
|
success: boolean;
|
|
719
724
|
}>;
|
|
720
|
-
setUserPassword:
|
|
725
|
+
setUserPassword: _$better_call0.StrictEndpoint<"/admin/set-user-password", {
|
|
721
726
|
method: "POST";
|
|
722
|
-
body:
|
|
723
|
-
newPassword:
|
|
724
|
-
userId:
|
|
725
|
-
},
|
|
726
|
-
use: (
|
|
727
|
+
body: _$zod.ZodObject<{
|
|
728
|
+
newPassword: _$zod.ZodString;
|
|
729
|
+
userId: _$zod.ZodCoercedString<unknown>;
|
|
730
|
+
}, _$zod_v4_core0.$strip>;
|
|
731
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
727
732
|
session: {
|
|
728
733
|
user: UserWithRole;
|
|
729
734
|
session: {
|
|
@@ -737,7 +742,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
737
742
|
userAgent?: string | null | undefined;
|
|
738
743
|
};
|
|
739
744
|
};
|
|
740
|
-
}
|
|
745
|
+
}>>[];
|
|
741
746
|
metadata: {
|
|
742
747
|
openapi: {
|
|
743
748
|
operationId: string;
|
|
@@ -765,16 +770,16 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
765
770
|
}, {
|
|
766
771
|
status: boolean;
|
|
767
772
|
}>;
|
|
768
|
-
userHasPermission:
|
|
773
|
+
userHasPermission: _$better_call0.StrictEndpoint<"/admin/has-permission", {
|
|
769
774
|
method: "POST";
|
|
770
|
-
body:
|
|
771
|
-
userId:
|
|
772
|
-
role:
|
|
773
|
-
},
|
|
774
|
-
permission:
|
|
775
|
-
},
|
|
776
|
-
permissions:
|
|
777
|
-
},
|
|
775
|
+
body: _$zod.ZodIntersection<_$zod.ZodObject<{
|
|
776
|
+
userId: _$zod.ZodOptional<_$zod.ZodCoercedString<unknown>>;
|
|
777
|
+
role: _$zod.ZodOptional<_$zod.ZodString>;
|
|
778
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodXor<readonly [_$zod.ZodObject<{
|
|
779
|
+
permission: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>>;
|
|
780
|
+
}, _$zod_v4_core0.$strip>, _$zod.ZodObject<{
|
|
781
|
+
permissions: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodArray<_$zod.ZodString>>;
|
|
782
|
+
}, _$zod_v4_core0.$strip>]>>;
|
|
778
783
|
metadata: {
|
|
779
784
|
openapi: {
|
|
780
785
|
description: string;
|
|
@@ -827,7 +832,7 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
827
832
|
})[key] extends readonly unknown[] ? ArrayElement<(O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
828
833
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
|
|
829
834
|
readonly session: readonly ["list", "revoke", "delete"];
|
|
830
|
-
})[key]> : never)[] | undefined
|
|
835
|
+
})[key]> : never)[] | undefined };
|
|
831
836
|
} & {
|
|
832
837
|
userId?: string | undefined;
|
|
833
838
|
role?: InferAdminRolesFromOption<O> | undefined;
|
|
@@ -840,29 +845,29 @@ declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
|
840
845
|
}>;
|
|
841
846
|
};
|
|
842
847
|
$ERROR_CODES: {
|
|
843
|
-
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:
|
|
844
|
-
FAILED_TO_CREATE_USER:
|
|
845
|
-
USER_ALREADY_EXISTS:
|
|
846
|
-
YOU_CANNOT_BAN_YOURSELF:
|
|
847
|
-
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:
|
|
848
|
-
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:
|
|
849
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:
|
|
850
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:
|
|
851
|
-
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:
|
|
852
|
-
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:
|
|
853
|
-
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:
|
|
854
|
-
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:
|
|
855
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:
|
|
856
|
-
BANNED_USER:
|
|
857
|
-
YOU_ARE_NOT_ALLOWED_TO_GET_USER:
|
|
858
|
-
NO_DATA_TO_UPDATE:
|
|
859
|
-
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:
|
|
860
|
-
YOU_CANNOT_REMOVE_YOURSELF:
|
|
861
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:
|
|
862
|
-
YOU_CANNOT_IMPERSONATE_ADMINS:
|
|
863
|
-
INVALID_ROLE_TYPE:
|
|
864
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL:
|
|
865
|
-
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER:
|
|
848
|
+
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: _$_better_auth_core_utils_error_codes0.RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
|
|
849
|
+
FAILED_TO_CREATE_USER: _$_better_auth_core_utils_error_codes0.RawError<"FAILED_TO_CREATE_USER">;
|
|
850
|
+
USER_ALREADY_EXISTS: _$_better_auth_core_utils_error_codes0.RawError<"USER_ALREADY_EXISTS">;
|
|
851
|
+
YOU_CANNOT_BAN_YOURSELF: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_BAN_YOURSELF">;
|
|
852
|
+
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
|
|
853
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
|
|
854
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
|
|
855
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
|
|
856
|
+
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
|
|
857
|
+
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
|
|
858
|
+
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
|
|
859
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
|
|
860
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
|
|
861
|
+
BANNED_USER: _$_better_auth_core_utils_error_codes0.RawError<"BANNED_USER">;
|
|
862
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_USER: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
|
|
863
|
+
NO_DATA_TO_UPDATE: _$_better_auth_core_utils_error_codes0.RawError<"NO_DATA_TO_UPDATE">;
|
|
864
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
|
|
865
|
+
YOU_CANNOT_REMOVE_YOURSELF: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
|
|
866
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
|
|
867
|
+
YOU_CANNOT_IMPERSONATE_ADMINS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
|
|
868
|
+
INVALID_ROLE_TYPE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_ROLE_TYPE">;
|
|
869
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
|
|
870
|
+
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: _$_better_auth_core_utils_error_codes0.RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
|
|
866
871
|
};
|
|
867
872
|
schema: {
|
|
868
873
|
user: {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AccessControl, ArrayElement, Role, Statements } from "../access/types.mjs";
|
|
2
|
-
import "../access/index.mjs";
|
|
3
2
|
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "./types.mjs";
|
|
4
3
|
import { admin } from "./admin.mjs";
|
|
5
|
-
import "../index.mjs";
|
|
6
4
|
import { ADMIN_ERROR_CODES } from "./error-codes.mjs";
|
|
5
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
6
|
+
|
|
7
7
|
//#region src/plugins/admin/client.d.ts
|
|
8
8
|
interface AdminClientOptions {
|
|
9
9
|
ac?: AccessControl | undefined;
|
|
10
|
-
roles?: { [key in string]: Role
|
|
10
|
+
roles?: { [key in string]: Role } | undefined;
|
|
11
11
|
}
|
|
12
12
|
declare const adminClient: <O extends AdminClientOptions>(options?: O | undefined) => {
|
|
13
13
|
id: "admin-client";
|
|
@@ -24,9 +24,9 @@ declare const adminClient: <O extends AdminClientOptions>(options?: O | undefine
|
|
|
24
24
|
}>>;
|
|
25
25
|
getActions: () => {
|
|
26
26
|
admin: {
|
|
27
|
-
checkRolePermission: <R extends O extends {
|
|
27
|
+
checkRolePermission: <R extends (O extends {
|
|
28
28
|
roles: any;
|
|
29
|
-
} ? keyof O["roles"] : "admin" | "user">(data: {
|
|
29
|
+
} ? keyof O["roles"] : "admin" | "user")>(data: {
|
|
30
30
|
permissions: { [key in keyof (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
31
31
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
|
|
32
32
|
readonly session: readonly ["list", "revoke", "delete"];
|
|
@@ -36,7 +36,7 @@ declare const adminClient: <O extends AdminClientOptions>(options?: O | undefine
|
|
|
36
36
|
})[key] extends readonly unknown[] ? ArrayElement<(O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
37
37
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
|
|
38
38
|
readonly session: readonly ["list", "revoke", "delete"];
|
|
39
|
-
})[key]> : never)[] | undefined
|
|
39
|
+
})[key]> : never)[] | undefined };
|
|
40
40
|
} & {
|
|
41
41
|
role: R;
|
|
42
42
|
}) => boolean;
|
|
@@ -52,30 +52,30 @@ declare const adminClient: <O extends AdminClientOptions>(options?: O | undefine
|
|
|
52
52
|
signal: "$sessionSignal";
|
|
53
53
|
}[];
|
|
54
54
|
$ERROR_CODES: {
|
|
55
|
-
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:
|
|
56
|
-
FAILED_TO_CREATE_USER:
|
|
57
|
-
USER_ALREADY_EXISTS:
|
|
58
|
-
YOU_CANNOT_BAN_YOURSELF:
|
|
59
|
-
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:
|
|
60
|
-
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:
|
|
61
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:
|
|
62
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:
|
|
63
|
-
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:
|
|
64
|
-
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:
|
|
65
|
-
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:
|
|
66
|
-
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:
|
|
67
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:
|
|
68
|
-
BANNED_USER:
|
|
69
|
-
YOU_ARE_NOT_ALLOWED_TO_GET_USER:
|
|
70
|
-
NO_DATA_TO_UPDATE:
|
|
71
|
-
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:
|
|
72
|
-
YOU_CANNOT_REMOVE_YOURSELF:
|
|
73
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:
|
|
74
|
-
YOU_CANNOT_IMPERSONATE_ADMINS:
|
|
75
|
-
INVALID_ROLE_TYPE:
|
|
76
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL:
|
|
77
|
-
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER:
|
|
55
|
+
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: _$_better_auth_core_utils_error_codes0.RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
|
|
56
|
+
FAILED_TO_CREATE_USER: _$_better_auth_core_utils_error_codes0.RawError<"FAILED_TO_CREATE_USER">;
|
|
57
|
+
USER_ALREADY_EXISTS: _$_better_auth_core_utils_error_codes0.RawError<"USER_ALREADY_EXISTS">;
|
|
58
|
+
YOU_CANNOT_BAN_YOURSELF: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_BAN_YOURSELF">;
|
|
59
|
+
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
|
|
60
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
|
|
61
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
|
|
62
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
|
|
63
|
+
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
|
|
64
|
+
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
|
|
65
|
+
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
|
|
66
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
|
|
67
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
|
|
68
|
+
BANNED_USER: _$_better_auth_core_utils_error_codes0.RawError<"BANNED_USER">;
|
|
69
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_USER: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
|
|
70
|
+
NO_DATA_TO_UPDATE: _$_better_auth_core_utils_error_codes0.RawError<"NO_DATA_TO_UPDATE">;
|
|
71
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
|
|
72
|
+
YOU_CANNOT_REMOVE_YOURSELF: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
|
|
73
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
|
|
74
|
+
YOU_CANNOT_IMPERSONATE_ADMINS: _$_better_auth_core_utils_error_codes0.RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
|
|
75
|
+
INVALID_ROLE_TYPE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_ROLE_TYPE">;
|
|
76
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: _$_better_auth_core_utils_error_codes0.RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
|
|
77
|
+
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: _$_better_auth_core_utils_error_codes0.RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
//#endregion
|
|
81
|
-
export {
|
|
81
|
+
export { AdminClientOptions, adminClient };
|