@krak-stack/auth 0.1.47 → 0.1.49
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/api.d.ts +22 -2
- package/dist/components/admin-organization-form.js +0 -1
- package/dist/components/admin-organizations.js +0 -1
- package/dist/components/admin-users.js +0 -1
- package/dist/components/auth-client-api.d.ts +132 -122
- package/dist/components/auth-client.d.ts +24 -55
- package/dist/components/auth-client.js +23 -12
- package/dist/components/auth-forms.js +15 -12
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/member-required.d.ts +43 -0
- package/dist/components/member-required.js +177 -0
- package/dist/components/organization-switcher.d.ts +12 -0
- package/dist/components/organization-switcher.js +118 -48
- package/dist/extra/api.group.d.ts +11 -1
- package/dist/extra/api.group.js +10 -1
- package/dist/extra/schema.d.ts +14 -0
- package/dist/extra/schema.js +32 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/service.d.ts +28 -0
- package/package.json +3 -3
package/dist/api.d.ts
CHANGED
|
@@ -64,7 +64,17 @@ export declare const AuthServiceApi: HttpApi.HttpApi<"AuthServiceApi", import("e
|
|
|
64
64
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
65
65
|
readonly id: import("effect/Schema").String;
|
|
66
66
|
readonly key: import("effect/Schema").String;
|
|
67
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("./extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"
|
|
67
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("./extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
68
|
+
readonly organizationId: import("effect/Schema").String;
|
|
69
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
70
|
+
readonly id: import("effect/Schema").String;
|
|
71
|
+
readonly name: import("effect/Schema").String;
|
|
72
|
+
readonly slug: import("effect/Schema").String;
|
|
73
|
+
readonly displayName: import("effect/Schema").String;
|
|
74
|
+
readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
75
|
+
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
76
|
+
readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
77
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
68
78
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
69
79
|
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
70
80
|
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -695,7 +705,17 @@ export declare const AuthClientApi: HttpApi.HttpApi<"AuthClientApi", import("eff
|
|
|
695
705
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
696
706
|
readonly id: import("effect/Schema").String;
|
|
697
707
|
readonly key: import("effect/Schema").String;
|
|
698
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("./extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"
|
|
708
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("./extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
709
|
+
readonly organizationId: import("effect/Schema").String;
|
|
710
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
711
|
+
readonly id: import("effect/Schema").String;
|
|
712
|
+
readonly name: import("effect/Schema").String;
|
|
713
|
+
readonly slug: import("effect/Schema").String;
|
|
714
|
+
readonly displayName: import("effect/Schema").String;
|
|
715
|
+
readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
716
|
+
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
717
|
+
readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
718
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
699
719
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
700
720
|
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
701
721
|
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// @ts-nocheck
|
|
3
2
|
import { useAtomSet, useAtomValue } from "@effect/atom-react";
|
|
4
3
|
import { useNavigate, useRouter, } from "@tanstack/react-router";
|
|
5
4
|
import {} from "@tanstack/react-table";
|
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
import { AtomHttpApi } from "effect/unstable/reactivity";
|
|
2
|
-
export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpApi.AtomHttpApiClient<object, `AuthClientApi:${string}`, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"
|
|
2
|
+
export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpApi.AtomHttpApiClient<object, `AuthClientApi:${string}`, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"auth", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getSession", "GET", "/api/auth/get-session", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
3
|
+
readonly session: import("effect/Schema").Struct<{
|
|
4
|
+
readonly id: import("effect/Schema").String;
|
|
5
|
+
readonly expiresAt: import("effect/Schema").Date;
|
|
6
|
+
readonly token: import("effect/Schema").String;
|
|
7
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
8
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
9
|
+
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
10
|
+
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
11
|
+
readonly userId: import("effect/Schema").String;
|
|
12
|
+
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
13
|
+
readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
14
|
+
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
15
|
+
}>;
|
|
16
|
+
readonly user: import("effect/Schema").Struct<{
|
|
17
|
+
readonly id: import("effect/Schema").String;
|
|
18
|
+
readonly name: import("effect/Schema").String;
|
|
19
|
+
readonly email: import("effect/Schema").String;
|
|
20
|
+
readonly emailVerified: import("effect/Schema").Boolean;
|
|
21
|
+
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
22
|
+
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
23
|
+
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
24
|
+
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
25
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
26
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
27
|
+
}>;
|
|
28
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../better-auth/schema").TooManyRequests>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"organizationImpersonateUser", "POST", "/api/auth/organization/impersonate-user", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
29
|
+
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
30
|
+
readonly actorUserId: import("effect/Schema").NonEmptyString;
|
|
31
|
+
readonly targetUserId: import("effect/Schema").NonEmptyString;
|
|
32
|
+
readonly expiresInSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
33
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
34
|
+
readonly session: import("effect/Schema").Struct<{
|
|
35
|
+
readonly id: import("effect/Schema").String;
|
|
36
|
+
readonly expiresAt: import("effect/Schema").Date;
|
|
37
|
+
readonly token: import("effect/Schema").String;
|
|
38
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
39
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
40
|
+
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
41
|
+
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
42
|
+
readonly userId: import("effect/Schema").String;
|
|
43
|
+
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
44
|
+
readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
45
|
+
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
46
|
+
}>;
|
|
47
|
+
readonly user: import("effect/Schema").Struct<{
|
|
48
|
+
readonly id: import("effect/Schema").String;
|
|
49
|
+
readonly name: import("effect/Schema").String;
|
|
50
|
+
readonly email: import("effect/Schema").String;
|
|
51
|
+
readonly emailVerified: import("effect/Schema").Boolean;
|
|
52
|
+
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
53
|
+
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
54
|
+
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
55
|
+
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
56
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
57
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
58
|
+
}>;
|
|
59
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"authExtra", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createApiKey", "POST", "/api/auth/create-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
60
|
+
readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
|
|
61
|
+
readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
62
|
+
readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
63
|
+
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
64
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
65
|
+
readonly id: import("effect/Schema").String;
|
|
66
|
+
readonly key: import("effect/Schema").String;
|
|
67
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
68
|
+
readonly organizationId: import("effect/Schema").String;
|
|
69
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
70
|
+
readonly id: import("effect/Schema").String;
|
|
71
|
+
readonly name: import("effect/Schema").String;
|
|
72
|
+
readonly slug: import("effect/Schema").String;
|
|
73
|
+
readonly displayName: import("effect/Schema").String;
|
|
74
|
+
readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
75
|
+
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
76
|
+
readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
77
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
78
|
+
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
79
|
+
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
80
|
+
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
81
|
+
readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
82
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
83
|
+
readonly projectKey: import("effect/Schema").String;
|
|
84
|
+
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
85
|
+
readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
86
|
+
readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
87
|
+
readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
88
|
+
readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
89
|
+
readonly authOptions: import("effect/Schema").Struct<{
|
|
90
|
+
readonly emailPassword: import("effect/Schema").Boolean;
|
|
91
|
+
readonly emailOtp: import("effect/Schema").Boolean;
|
|
92
|
+
readonly google: import("effect/Schema").Boolean;
|
|
93
|
+
readonly signUp: import("effect/Schema").Boolean;
|
|
94
|
+
readonly signUpName: import("effect/Schema").Boolean;
|
|
95
|
+
}>;
|
|
96
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"setPassword", "POST", "/api/auth/set-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
97
|
+
readonly newPassword: import("effect/Schema").NonEmptyString;
|
|
98
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
99
|
+
readonly ok: import("effect/Schema").Boolean;
|
|
100
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"uploadUserImage", "POST", "/api/auth/image/upload", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").asMultipartStream<import("effect/Schema").Struct<{
|
|
101
|
+
readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
|
|
102
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
103
|
+
readonly url: import("effect/Schema").String;
|
|
104
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyApiKey", "POST", "/api/auth/verify-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
105
|
+
readonly key: import("effect/Schema").NonEmptyString;
|
|
106
|
+
readonly configId: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>>;
|
|
107
|
+
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
108
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
109
|
+
readonly valid: import("effect/Schema").Boolean;
|
|
110
|
+
readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
111
|
+
readonly message: import("effect/Schema").String;
|
|
112
|
+
readonly code: import("effect/Schema").String;
|
|
113
|
+
}>>;
|
|
114
|
+
readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
115
|
+
readonly id: import("effect/Schema").String;
|
|
116
|
+
readonly configId: import("effect/Schema").String;
|
|
117
|
+
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
118
|
+
readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
119
|
+
readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
120
|
+
readonly referenceId: import("effect/Schema").String;
|
|
121
|
+
readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
122
|
+
readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
|
|
123
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
124
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
125
|
+
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
126
|
+
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
127
|
+
}>>;
|
|
128
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyPassword", "POST", "/api/auth/verify-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
129
|
+
readonly password: import("effect/Schema").NonEmptyString;
|
|
130
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
131
|
+
readonly ok: import("effect/Schema").Boolean;
|
|
132
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"admin", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createDomain", "POST", "/api/auth/admin/domains", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
3
133
|
readonly hostname: import("effect/Schema").NonEmptyString;
|
|
4
134
|
readonly rootHostname: import("effect/Schema").NonEmptyString;
|
|
5
135
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
@@ -315,124 +445,4 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
|
|
|
315
445
|
readonly metadata: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
316
446
|
readonly memberCount: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
317
447
|
readonly createdAt: import("effect/Schema").Date;
|
|
318
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false
|
|
319
|
-
readonly session: import("effect/Schema").Struct<{
|
|
320
|
-
readonly id: import("effect/Schema").String;
|
|
321
|
-
readonly expiresAt: import("effect/Schema").Date;
|
|
322
|
-
readonly token: import("effect/Schema").String;
|
|
323
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
324
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
325
|
-
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
326
|
-
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
327
|
-
readonly userId: import("effect/Schema").String;
|
|
328
|
-
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
329
|
-
readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
330
|
-
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
331
|
-
}>;
|
|
332
|
-
readonly user: import("effect/Schema").Struct<{
|
|
333
|
-
readonly id: import("effect/Schema").String;
|
|
334
|
-
readonly name: import("effect/Schema").String;
|
|
335
|
-
readonly email: import("effect/Schema").String;
|
|
336
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
337
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
338
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
339
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
340
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
341
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
342
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
343
|
-
}>;
|
|
344
|
-
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../better-auth/schema").TooManyRequests>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"organizationImpersonateUser", "POST", "/api/auth/organization/impersonate-user", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
345
|
-
readonly organizationId: import("effect/Schema").NonEmptyString;
|
|
346
|
-
readonly actorUserId: import("effect/Schema").NonEmptyString;
|
|
347
|
-
readonly targetUserId: import("effect/Schema").NonEmptyString;
|
|
348
|
-
readonly expiresInSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
349
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
350
|
-
readonly session: import("effect/Schema").Struct<{
|
|
351
|
-
readonly id: import("effect/Schema").String;
|
|
352
|
-
readonly expiresAt: import("effect/Schema").Date;
|
|
353
|
-
readonly token: import("effect/Schema").String;
|
|
354
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
355
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
356
|
-
readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
357
|
-
readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
358
|
-
readonly userId: import("effect/Schema").String;
|
|
359
|
-
readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
360
|
-
readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
361
|
-
readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
362
|
-
}>;
|
|
363
|
-
readonly user: import("effect/Schema").Struct<{
|
|
364
|
-
readonly id: import("effect/Schema").String;
|
|
365
|
-
readonly name: import("effect/Schema").String;
|
|
366
|
-
readonly email: import("effect/Schema").String;
|
|
367
|
-
readonly emailVerified: import("effect/Schema").Boolean;
|
|
368
|
-
readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
369
|
-
readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
370
|
-
readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
371
|
-
readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
372
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
373
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
374
|
-
}>;
|
|
375
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").BadRequest | typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false> | import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"authExtra", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"createApiKey", "POST", "/api/auth/create-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
376
|
-
readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
|
|
377
|
-
readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
378
|
-
readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
379
|
-
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
380
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
381
|
-
readonly id: import("effect/Schema").String;
|
|
382
|
-
readonly key: import("effect/Schema").String;
|
|
383
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getProjectPublicConfig", "GET", "/api/auth/project-config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
384
|
-
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
385
|
-
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
386
|
-
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
387
|
-
readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
388
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
389
|
-
readonly projectKey: import("effect/Schema").String;
|
|
390
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
391
|
-
readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
392
|
-
readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
393
|
-
readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
394
|
-
readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
395
|
-
readonly authOptions: import("effect/Schema").Struct<{
|
|
396
|
-
readonly emailPassword: import("effect/Schema").Boolean;
|
|
397
|
-
readonly emailOtp: import("effect/Schema").Boolean;
|
|
398
|
-
readonly google: import("effect/Schema").Boolean;
|
|
399
|
-
readonly signUp: import("effect/Schema").Boolean;
|
|
400
|
-
readonly signUpName: import("effect/Schema").Boolean;
|
|
401
|
-
}>;
|
|
402
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"setPassword", "POST", "/api/auth/set-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
403
|
-
readonly newPassword: import("effect/Schema").NonEmptyString;
|
|
404
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
405
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
406
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"uploadUserImage", "POST", "/api/auth/image/upload", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/unstable/httpapi/HttpApiSchema").asMultipartStream<import("effect/Schema").Struct<{
|
|
407
|
-
readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
|
|
408
|
-
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
409
|
-
readonly url: import("effect/Schema").String;
|
|
410
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyApiKey", "POST", "/api/auth/verify-api-key", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
411
|
-
readonly key: import("effect/Schema").NonEmptyString;
|
|
412
|
-
readonly configId: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>>;
|
|
413
|
-
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
414
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
415
|
-
readonly valid: import("effect/Schema").Boolean;
|
|
416
|
-
readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
417
|
-
readonly message: import("effect/Schema").String;
|
|
418
|
-
readonly code: import("effect/Schema").String;
|
|
419
|
-
}>>;
|
|
420
|
-
readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
421
|
-
readonly id: import("effect/Schema").String;
|
|
422
|
-
readonly configId: import("effect/Schema").String;
|
|
423
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
424
|
-
readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
425
|
-
readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
426
|
-
readonly referenceId: import("effect/Schema").String;
|
|
427
|
-
readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
428
|
-
readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
|
|
429
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
430
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
431
|
-
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
432
|
-
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
433
|
-
}>>;
|
|
434
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../extra/schema").ExtraBadRequest>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"verifyPassword", "POST", "/api/auth/verify-password", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
435
|
-
readonly password: import("effect/Schema").NonEmptyString;
|
|
436
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
437
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
438
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError | typeof import("../extra/schema").ExtraBadRequest>, never, never>, false>>;
|
|
448
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | typeof import("effect/unstable/httpapi/HttpApiError").Forbidden | typeof import("effect/unstable/httpapi/HttpApiError").NotFound | typeof import("effect/unstable/httpapi/HttpApiError").InternalServerError>, never, never>, false>>;
|
|
@@ -1,60 +1,29 @@
|
|
|
1
1
|
import { apiKeyClient } from "@better-auth/api-key/client";
|
|
2
|
-
import { adminClient, emailOTPClient, genericOAuthClient, lastLoginMethodClient, organizationClient, twoFactorClient } from "better-auth/client/plugins";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
session: {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { adminClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient } from "better-auth/client/plugins";
|
|
3
|
+
import { type ReactAuthClient } from "better-auth/react";
|
|
4
|
+
declare const additionalFields: {
|
|
5
|
+
readonly session: {
|
|
6
|
+
readonly impersonatedByOrganizationId: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly required: false;
|
|
9
|
+
readonly input: false;
|
|
10
|
+
};
|
|
8
11
|
};
|
|
9
|
-
user: {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
email: string;
|
|
13
|
-
image?: string | null | undefined;
|
|
14
|
-
role?: string | null | undefined;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
type Query<T> = {
|
|
18
|
-
data: T | null | undefined;
|
|
19
|
-
isPending: boolean;
|
|
20
|
-
refetch: () => Promise<unknown>;
|
|
21
12
|
};
|
|
22
|
-
type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
data: Session | null;
|
|
36
|
-
error: unknown;
|
|
37
|
-
}>;
|
|
38
|
-
organization: {
|
|
39
|
-
setActive: (input: {
|
|
40
|
-
organizationId: string;
|
|
41
|
-
}) => Promise<{
|
|
42
|
-
data: unknown;
|
|
43
|
-
error: unknown;
|
|
44
|
-
}>;
|
|
45
|
-
};
|
|
46
|
-
useSession: () => Query<Session>;
|
|
47
|
-
useActiveOrganization: () => Query<{
|
|
48
|
-
id: string;
|
|
49
|
-
name: string;
|
|
50
|
-
slug: string;
|
|
51
|
-
createdAt: Date | string;
|
|
52
|
-
members: unknown[];
|
|
53
|
-
invitations: unknown[];
|
|
54
|
-
}>;
|
|
55
|
-
useActiveMemberRole: () => Query<{
|
|
56
|
-
role: string;
|
|
57
|
-
}>;
|
|
13
|
+
type AuthUiClientPlugins = [
|
|
14
|
+
ReturnType<typeof inferAdditionalFields<never, typeof additionalFields>>,
|
|
15
|
+
ReturnType<typeof adminClient<{}>>,
|
|
16
|
+
ReturnType<typeof emailOTPClient>,
|
|
17
|
+
ReturnType<typeof lastLoginMethodClient>,
|
|
18
|
+
ReturnType<typeof organizationClient<{}>>,
|
|
19
|
+
ReturnType<typeof twoFactorClient>,
|
|
20
|
+
ReturnType<typeof apiKeyClient>,
|
|
21
|
+
ReturnType<typeof genericOAuthClient>
|
|
22
|
+
];
|
|
23
|
+
type AuthUiClientOptions = {
|
|
24
|
+
baseURL?: string | undefined;
|
|
25
|
+
plugins: AuthUiClientPlugins;
|
|
58
26
|
};
|
|
59
|
-
export
|
|
27
|
+
export type AuthUiClient = ReactAuthClient<AuthUiClientOptions>;
|
|
28
|
+
export declare const createAuthUiClient: (baseUrl?: string | undefined) => ReactAuthClient<AuthUiClientOptions>;
|
|
60
29
|
export {};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { apiKeyClient } from "@better-auth/api-key/client";
|
|
2
|
-
import { adminClient, emailOTPClient, genericOAuthClient, lastLoginMethodClient, organizationClient, twoFactorClient, } from "better-auth/client/plugins";
|
|
2
|
+
import { adminClient, emailOTPClient, genericOAuthClient, inferAdditionalFields, lastLoginMethodClient, organizationClient, twoFactorClient, } from "better-auth/client/plugins";
|
|
3
3
|
import { createAuthClient } from "better-auth/react";
|
|
4
|
+
const additionalFields = {
|
|
5
|
+
session: {
|
|
6
|
+
impersonatedByOrganizationId: {
|
|
7
|
+
type: "string",
|
|
8
|
+
required: false,
|
|
9
|
+
input: false,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const authUiClientPlugins = [
|
|
14
|
+
inferAdditionalFields(additionalFields),
|
|
15
|
+
adminClient(),
|
|
16
|
+
emailOTPClient(),
|
|
17
|
+
lastLoginMethodClient({
|
|
18
|
+
cookieName: "krakstack-auth.last_used_login_method",
|
|
19
|
+
}),
|
|
20
|
+
organizationClient(),
|
|
21
|
+
twoFactorClient(),
|
|
22
|
+
apiKeyClient(),
|
|
23
|
+
genericOAuthClient(),
|
|
24
|
+
];
|
|
4
25
|
export const createAuthUiClient = (baseUrl) => createAuthClient({
|
|
5
26
|
...(baseUrl ? { baseURL: baseUrl } : {}),
|
|
6
|
-
plugins:
|
|
7
|
-
adminClient(),
|
|
8
|
-
emailOTPClient(),
|
|
9
|
-
lastLoginMethodClient({
|
|
10
|
-
cookieName: "krakstack-auth.last_used_login_method",
|
|
11
|
-
}),
|
|
12
|
-
organizationClient(),
|
|
13
|
-
twoFactorClient(),
|
|
14
|
-
apiKeyClient(),
|
|
15
|
-
genericOAuthClient(),
|
|
16
|
-
],
|
|
27
|
+
plugins: authUiClientPlugins,
|
|
17
28
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// @ts-nocheck
|
|
3
2
|
import { useAtomSuspense } from "@effect/atom-react";
|
|
4
3
|
import { Link, useNavigate, useRouterState } from "@tanstack/react-router";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
5
|
import { Atom, AsyncResult } from "effect/unstable/reactivity";
|
|
6
6
|
import { REGEXP_ONLY_DIGITS } from "input-otp";
|
|
7
7
|
import { KeyRound, Mail } from "lucide-react";
|
|
@@ -14,6 +14,7 @@ import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, } from "@/com
|
|
|
14
14
|
import { authClientApi } from "./auth-client-api";
|
|
15
15
|
import { useKrakstackAuth } from "./auth-provider";
|
|
16
16
|
import { cn } from "./utils";
|
|
17
|
+
import { ExtraProjectPublicConfig as ExtraProjectPublicConfigSchema, } from "../extra/schema";
|
|
17
18
|
const EMAIL_OTP_RESEND_COOLDOWN_SECONDS = 60;
|
|
18
19
|
const defaultMessages = {
|
|
19
20
|
en: {
|
|
@@ -157,7 +158,9 @@ const useAuthProjectConfig = (baseUrl, searchString, projectConfig) => {
|
|
|
157
158
|
})
|
|
158
159
|
: Atom.make(AsyncResult.success(projectConfig));
|
|
159
160
|
const result = useAtomSuspense(atom, { suspendOnWaiting: true });
|
|
160
|
-
return result.value
|
|
161
|
+
return result.value === null
|
|
162
|
+
? null
|
|
163
|
+
: Schema.decodeUnknownSync(ExtraProjectPublicConfigSchema)(result.value);
|
|
161
164
|
};
|
|
162
165
|
const text = (value, params) => Object.entries(params ?? {}).reduce((current, [key, replacement]) => current.replace(`{${key}}`, replacement), value);
|
|
163
166
|
const authLinkClassName = cn(buttonVariants({ variant: "link" }), "h-auto px-0 align-baseline");
|
|
@@ -173,14 +176,14 @@ export function Signin(props) {
|
|
|
173
176
|
const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
|
|
174
177
|
const socialRedirectTarget = getSocialRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
|
|
175
178
|
const oauthQuery = getOAuthQuery(searchString);
|
|
176
|
-
const authOptions = projectConfig?.authOptions
|
|
179
|
+
const authOptions = projectConfig?.authOptions;
|
|
177
180
|
const onNavigate = (target) => navigateTarget(target, navigate);
|
|
178
181
|
const onTwoFactorRedirect = (href) => navigate({ href });
|
|
179
182
|
const options = {
|
|
180
|
-
emailPassword: authOptions
|
|
181
|
-
emailOtp: authOptions
|
|
182
|
-
google: authOptions
|
|
183
|
-
signUp: authOptions
|
|
183
|
+
emailPassword: authOptions?.emailPassword ?? true,
|
|
184
|
+
emailOtp: authOptions?.emailOtp ?? true,
|
|
185
|
+
google: authOptions?.google ?? true,
|
|
186
|
+
signUp: authOptions?.signUp ?? true,
|
|
184
187
|
};
|
|
185
188
|
const [emailSubmitted, setEmailSubmitted] = useState(false);
|
|
186
189
|
const [authMethod, setAuthMethod] = useState(() => lastLoginMethodToAuthMethod(authClient.getLastUsedLoginMethod?.()));
|
|
@@ -373,13 +376,13 @@ export function Signup(props) {
|
|
|
373
376
|
});
|
|
374
377
|
const projectConfig = useAuthProjectConfig(baseUrl, searchString, providedProjectConfig);
|
|
375
378
|
const redirectTarget = getRedirectTarget(searchString, projectConfig?.authDomain, projectConfig?.rootDomain);
|
|
376
|
-
const authOptions = projectConfig?.authOptions
|
|
379
|
+
const authOptions = projectConfig?.authOptions;
|
|
377
380
|
const onNavigate = (target) => navigate({ href: target });
|
|
378
381
|
const onVerifyEmail = (email) => navigate({ to: "/verify-email", search: { email } });
|
|
379
382
|
const options = {
|
|
380
|
-
google: authOptions
|
|
381
|
-
signUp: authOptions
|
|
382
|
-
signUpName: authOptions
|
|
383
|
+
google: authOptions?.google ?? true,
|
|
384
|
+
signUp: authOptions?.signUp ?? true,
|
|
385
|
+
signUpName: authOptions?.signUpName ?? true,
|
|
383
386
|
};
|
|
384
387
|
const form = useAppForm({
|
|
385
388
|
defaultValues: { name: "", email: "", password: "" },
|
|
@@ -566,7 +569,7 @@ export function TwoFactor(props) {
|
|
|
566
569
|
}
|
|
567
570
|
const OtpInput = ({ field, label }) => {
|
|
568
571
|
const invalid = !field.state.meta.isValid;
|
|
569
|
-
return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.name, children: label }), _jsxs(InputOTP, { id: field.name, name: field.name, maxLength: 6, value: field.state.value ?? "", onChange: (value) => field.handleChange(value), onBlur: field.handleBlur, autoComplete: "one-time-code", inputMode: "numeric", pattern: REGEXP_ONLY_DIGITS, required: true, children: [_jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 0, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 1, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 2, "aria-invalid": invalid })] }), _jsx(InputOTPSeparator, {}), _jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 3, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 4, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 5, "aria-invalid": invalid })] })] }), _jsx(FieldError, { errors: field.getMeta().errors })] }));
|
|
572
|
+
return (_jsxs(Field, { "data-invalid": invalid, children: [_jsx(FieldLabel, { htmlFor: field.name, children: label }), _jsxs(InputOTP, { id: field.name, name: field.name, maxLength: 6, value: field.state.value ?? "", onChange: (value) => field.handleChange(value), onBlur: field.handleBlur, autoComplete: "one-time-code", inputMode: "numeric", pattern: REGEXP_ONLY_DIGITS, required: true, children: [_jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 0, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 1, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 2, "aria-invalid": invalid })] }), _jsx(InputOTPSeparator, {}), _jsxs(InputOTPGroup, { children: [_jsx(InputOTPSlot, { index: 3, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 4, "aria-invalid": invalid }), _jsx(InputOTPSlot, { index: 5, "aria-invalid": invalid })] })] }), _jsx(FieldError, { errors: field.getMeta().errors ?? [] })] }));
|
|
570
573
|
};
|
|
571
574
|
const Divider = ({ label }) => (_jsxs("div", { className: "text-muted-foreground flex items-center gap-3 text-xs", children: [_jsx("span", { className: "bg-border h-px flex-1" }), label, _jsx("span", { className: "bg-border h-px flex-1" })] }));
|
|
572
575
|
const GoogleLogo = () => (_jsxs("svg", { "aria-hidden": "true", className: "size-[18px]", viewBox: "0 0 18 18", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M17.64 9.204c0-.638-.057-1.252-.164-1.84H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.874 2.684-6.616Z", fill: "#4285F4" }), _jsx("path", { d: "M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.583-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18Z", fill: "#34A853" }), _jsx("path", { d: "M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332Z", fill: "#FBBC05" }), _jsx("path", { d: "M9 3.58c1.321 0 2.508.454 3.44 1.346l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.162 6.656 3.58 9 3.58Z", fill: "#EA4335" })] }));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAuthProjectConfig, } from "./auth-provider";
|
|
2
2
|
export { createAuthUiClient } from "./auth-client";
|
|
3
3
|
export { OrganizationSwitcher } from "./organization-switcher";
|
|
4
|
+
export { MemberRequired } from "./member-required";
|
|
4
5
|
export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
|
|
5
6
|
export { UserButton } from "./user-button";
|
|
6
7
|
export { AdminOrganizationsTable } from "./admin-organizations";
|
|
@@ -11,3 +12,4 @@ export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProvi
|
|
|
11
12
|
export type { OrganizationSwitcherDialog, OrganizationSwitcherProps, } from "./organization-switcher";
|
|
12
13
|
export type { UserButtonDialog } from "./user-button";
|
|
13
14
|
export type { AuthUiClient } from "./auth-client";
|
|
15
|
+
export type { MemberRequiredMessages, MemberRequiredProps } from "./member-required";
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { KrakstackAuthProvider, useAuthClient, useKrakstackAuth, useKrakstackAuthProjectConfig, } from "./auth-provider";
|
|
2
2
|
export { createAuthUiClient } from "./auth-client";
|
|
3
3
|
export { OrganizationSwitcher } from "./organization-switcher";
|
|
4
|
+
export { MemberRequired } from "./member-required";
|
|
4
5
|
export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
|
|
5
6
|
export { UserButton } from "./user-button";
|
|
6
7
|
export { AdminOrganizationsTable } from "./admin-organizations";
|