@krak-stack/auth 0.1.44 → 0.1.45
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/README.md +10 -2
- package/dist/admin/api.group.d.ts +13 -13
- package/dist/admin/schema.d.ts +13 -13
- package/dist/api.d.ts +104 -15
- package/dist/api.js +1 -1
- package/dist/better-auth/api.group.d.ts +33 -1
- package/dist/better-auth/api.group.js +15 -1
- package/dist/better-auth/schema.d.ts +36 -0
- package/dist/better-auth/schema.js +56 -0
- package/dist/components/admin-users.js +60 -4
- package/dist/components/auth-client-api.d.ts +135 -78
- package/dist/components/auth-client.js +3 -1
- package/dist/components/auth-provider.d.ts +17 -15
- package/dist/components/auth-provider.js +16 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/organization-switcher.d.ts +5 -2
- package/dist/components/organization-switcher.js +64 -32
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/roles.d.ts +10 -0
- package/dist/roles.js +31 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +2 -0
- package/dist/service.d.ts +500 -424
- package/package.json +5 -1
|
@@ -1,5 +1,125 @@
|
|
|
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").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("../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<{
|
|
68
|
+
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
69
|
+
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
70
|
+
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
71
|
+
readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
72
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
73
|
+
readonly projectKey: import("effect/Schema").String;
|
|
74
|
+
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
75
|
+
readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
76
|
+
readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
77
|
+
readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
78
|
+
readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
79
|
+
readonly authOptions: import("effect/Schema").Struct<{
|
|
80
|
+
readonly emailPassword: import("effect/Schema").Boolean;
|
|
81
|
+
readonly emailOtp: import("effect/Schema").Boolean;
|
|
82
|
+
readonly google: import("effect/Schema").Boolean;
|
|
83
|
+
readonly signUp: import("effect/Schema").Boolean;
|
|
84
|
+
readonly signUpName: import("effect/Schema").Boolean;
|
|
85
|
+
}>;
|
|
86
|
+
}>>, 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<{
|
|
87
|
+
readonly newPassword: import("effect/Schema").NonEmptyString;
|
|
88
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
89
|
+
readonly ok: import("effect/Schema").Boolean;
|
|
90
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<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<{
|
|
91
|
+
readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
|
|
92
|
+
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
93
|
+
readonly url: import("effect/Schema").String;
|
|
94
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | 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<{
|
|
95
|
+
readonly key: import("effect/Schema").NonEmptyString;
|
|
96
|
+
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">]>>;
|
|
97
|
+
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
98
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
99
|
+
readonly valid: import("effect/Schema").Boolean;
|
|
100
|
+
readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
101
|
+
readonly message: import("effect/Schema").String;
|
|
102
|
+
readonly code: import("effect/Schema").String;
|
|
103
|
+
}>>;
|
|
104
|
+
readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
105
|
+
readonly id: import("effect/Schema").String;
|
|
106
|
+
readonly configId: import("effect/Schema").String;
|
|
107
|
+
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
108
|
+
readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
109
|
+
readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
110
|
+
readonly referenceId: import("effect/Schema").String;
|
|
111
|
+
readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
112
|
+
readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
|
|
113
|
+
readonly createdAt: import("effect/Schema").Date;
|
|
114
|
+
readonly updatedAt: import("effect/Schema").Date;
|
|
115
|
+
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
116
|
+
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
117
|
+
}>>;
|
|
118
|
+
}>>, 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<{
|
|
119
|
+
readonly password: import("effect/Schema").NonEmptyString;
|
|
120
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
121
|
+
readonly ok: import("effect/Schema").Boolean;
|
|
122
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<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
123
|
readonly hostname: import("effect/Schema").NonEmptyString;
|
|
4
124
|
readonly rootHostname: import("effect/Schema").NonEmptyString;
|
|
5
125
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
@@ -141,19 +261,19 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
|
|
|
141
261
|
}>>, import("effect/Schema").String, never, never>, never, never>>;
|
|
142
262
|
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
143
263
|
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
144
|
-
readonly data: import("effect/Schema").$Array<import("effect/Schema").Schema<
|
|
145
|
-
readonly id:
|
|
146
|
-
readonly name:
|
|
147
|
-
readonly email:
|
|
148
|
-
readonly emailVerified:
|
|
149
|
-
readonly image:
|
|
150
|
-
readonly createdAt:
|
|
151
|
-
readonly lastSignedIn:
|
|
152
|
-
readonly role:
|
|
153
|
-
readonly banned:
|
|
154
|
-
readonly banReason:
|
|
155
|
-
readonly banExpires:
|
|
156
|
-
}
|
|
264
|
+
readonly data: import("effect/Schema").$Array<import("effect/Schema").Schema<{
|
|
265
|
+
readonly id: string;
|
|
266
|
+
readonly name: string;
|
|
267
|
+
readonly email: string;
|
|
268
|
+
readonly emailVerified: boolean;
|
|
269
|
+
readonly image: string | null;
|
|
270
|
+
readonly createdAt: Date;
|
|
271
|
+
readonly lastSignedIn: Date | null;
|
|
272
|
+
readonly role: string | null;
|
|
273
|
+
readonly banned: boolean | null;
|
|
274
|
+
readonly banReason: string | null;
|
|
275
|
+
readonly banExpires: Date | null;
|
|
276
|
+
}>>;
|
|
157
277
|
readonly meta: import("effect/Schema").Struct<{
|
|
158
278
|
readonly page: import("effect/Schema").Int;
|
|
159
279
|
readonly pageSize: import("effect/Schema").Int;
|
|
@@ -197,67 +317,4 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
|
|
|
197
317
|
readonly metadata: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
|
|
198
318
|
readonly memberCount: import("effect/Schema").optional<import("effect/Schema").Number>;
|
|
199
319
|
readonly createdAt: import("effect/Schema").Date;
|
|
200
|
-
}>>, 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
|
|
201
|
-
readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
|
|
202
|
-
readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
|
|
203
|
-
readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
204
|
-
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
205
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
206
|
-
readonly id: import("effect/Schema").String;
|
|
207
|
-
readonly key: import("effect/Schema").String;
|
|
208
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<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<{
|
|
209
|
-
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
210
|
-
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
211
|
-
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
212
|
-
readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
213
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
214
|
-
readonly projectKey: import("effect/Schema").String;
|
|
215
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
216
|
-
readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
217
|
-
readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
218
|
-
readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
219
|
-
readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
220
|
-
readonly authOptions: import("effect/Schema").Struct<{
|
|
221
|
-
readonly emailPassword: import("effect/Schema").Boolean;
|
|
222
|
-
readonly emailOtp: import("effect/Schema").Boolean;
|
|
223
|
-
readonly google: import("effect/Schema").Boolean;
|
|
224
|
-
readonly signUp: import("effect/Schema").Boolean;
|
|
225
|
-
readonly signUpName: import("effect/Schema").Boolean;
|
|
226
|
-
}>;
|
|
227
|
-
}>>, 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<{
|
|
228
|
-
readonly newPassword: import("effect/Schema").NonEmptyString;
|
|
229
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
230
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
231
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<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<{
|
|
232
|
-
readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
|
|
233
|
-
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
234
|
-
readonly url: import("effect/Schema").String;
|
|
235
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("effect/unstable/httpapi/HttpApiError").Unauthorized | 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<{
|
|
236
|
-
readonly key: import("effect/Schema").NonEmptyString;
|
|
237
|
-
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">]>>;
|
|
238
|
-
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
239
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
240
|
-
readonly valid: import("effect/Schema").Boolean;
|
|
241
|
-
readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
242
|
-
readonly message: import("effect/Schema").String;
|
|
243
|
-
readonly code: import("effect/Schema").String;
|
|
244
|
-
}>>;
|
|
245
|
-
readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
246
|
-
readonly id: import("effect/Schema").String;
|
|
247
|
-
readonly configId: import("effect/Schema").String;
|
|
248
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
249
|
-
readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
250
|
-
readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
251
|
-
readonly referenceId: import("effect/Schema").String;
|
|
252
|
-
readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
253
|
-
readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
|
|
254
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
255
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
256
|
-
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
257
|
-
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
258
|
-
}>>;
|
|
259
|
-
}>>, 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<{
|
|
260
|
-
readonly password: import("effect/Schema").NonEmptyString;
|
|
261
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
262
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
263
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../extra/schema").ExtraBadRequest>, never, never>, false>>;
|
|
320
|
+
}>>, 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>>;
|
|
@@ -6,7 +6,9 @@ export const createAuthUiClient = (baseUrl) => createAuthClient({
|
|
|
6
6
|
plugins: [
|
|
7
7
|
adminClient(),
|
|
8
8
|
emailOTPClient(),
|
|
9
|
-
lastLoginMethodClient(
|
|
9
|
+
lastLoginMethodClient({
|
|
10
|
+
cookieName: "krakstack-auth.last_used_login_method",
|
|
11
|
+
}),
|
|
10
12
|
organizationClient(),
|
|
11
13
|
twoFactorClient(),
|
|
12
14
|
apiKeyClient(),
|
|
@@ -15,22 +15,24 @@ export type KrakstackAuthContextValue = {
|
|
|
15
15
|
projectId?: string | null | undefined;
|
|
16
16
|
authClient: AuthUiClient;
|
|
17
17
|
projectConfig: ExtraProjectPublicConfig | null;
|
|
18
|
+
authRefreshVersion: number;
|
|
19
|
+
refreshAuth: () => void;
|
|
18
20
|
};
|
|
19
21
|
export declare function KrakstackAuthProvider({ children, locale, baseUrl, projectId, authClient, }: KrakstackAuthProviderProps): import("react").JSX.Element;
|
|
20
22
|
export declare const useKrakstackAuth: () => KrakstackAuthContextValue | null;
|
|
21
23
|
export declare const useAuthClient: () => AuthUiClient;
|
|
22
|
-
export declare const useKrakstackAuthProjectConfig: () =>
|
|
23
|
-
readonly projectKey:
|
|
24
|
-
readonly name:
|
|
25
|
-
readonly logoUrl:
|
|
26
|
-
readonly authDomain:
|
|
27
|
-
readonly rootDomain:
|
|
28
|
-
readonly themeCss:
|
|
29
|
-
readonly authOptions:
|
|
30
|
-
readonly emailPassword:
|
|
31
|
-
readonly emailOtp:
|
|
32
|
-
readonly google:
|
|
33
|
-
readonly signUp:
|
|
34
|
-
readonly signUpName:
|
|
35
|
-
}
|
|
36
|
-
}
|
|
24
|
+
export declare const useKrakstackAuthProjectConfig: () => {
|
|
25
|
+
readonly projectKey: string;
|
|
26
|
+
readonly name: string | null;
|
|
27
|
+
readonly logoUrl: string | null;
|
|
28
|
+
readonly authDomain: string | null;
|
|
29
|
+
readonly rootDomain: string | null;
|
|
30
|
+
readonly themeCss: string | null;
|
|
31
|
+
readonly authOptions: {
|
|
32
|
+
readonly emailPassword: boolean;
|
|
33
|
+
readonly emailOtp: boolean;
|
|
34
|
+
readonly google: boolean;
|
|
35
|
+
readonly signUp: boolean;
|
|
36
|
+
readonly signUpName: boolean;
|
|
37
|
+
};
|
|
38
|
+
} | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useAtomSuspense } from "@effect/atom-react";
|
|
3
3
|
import { useRouterState } from "@tanstack/react-router";
|
|
4
|
-
import { createContext, useContext, useEffect, useMemo, } from "react";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
5
5
|
import { createAuthUiClient } from "./auth-client";
|
|
6
6
|
import { authClientApi } from "./auth-client-api";
|
|
7
7
|
const KrakstackAuthContext = createContext(null);
|
|
@@ -74,6 +74,10 @@ export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projec
|
|
|
74
74
|
const resolvedProjectId = projectId ?? getSearchParam(searchString, "projectId");
|
|
75
75
|
const resolvedAuthClient = useMemo(() => authClient ?? createAuthUiClient(baseUrl), [authClient, baseUrl]);
|
|
76
76
|
const projectConfig = useProjectConfig(baseUrl, projectId);
|
|
77
|
+
const [authRefreshVersion, setAuthRefreshVersion] = useState(0);
|
|
78
|
+
const refreshAuth = useCallback(() => {
|
|
79
|
+
setAuthRefreshVersion((current) => current + 1);
|
|
80
|
+
}, []);
|
|
77
81
|
useEffect(() => {
|
|
78
82
|
setProjectContextCookie(resolvedProjectId);
|
|
79
83
|
}, [resolvedProjectId]);
|
|
@@ -83,7 +87,17 @@ export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projec
|
|
|
83
87
|
locale,
|
|
84
88
|
projectId: resolvedProjectId,
|
|
85
89
|
projectConfig,
|
|
86
|
-
|
|
90
|
+
authRefreshVersion,
|
|
91
|
+
refreshAuth,
|
|
92
|
+
}), [
|
|
93
|
+
resolvedAuthClient,
|
|
94
|
+
baseUrl,
|
|
95
|
+
locale,
|
|
96
|
+
resolvedProjectId,
|
|
97
|
+
projectConfig,
|
|
98
|
+
authRefreshVersion,
|
|
99
|
+
refreshAuth,
|
|
100
|
+
]);
|
|
87
101
|
return (_jsx(KrakstackAuthContext.Provider, { value: value, children: children }));
|
|
88
102
|
}
|
|
89
103
|
export const useKrakstackAuth = () => useContext(KrakstackAuthContext);
|
|
@@ -8,6 +8,6 @@ export { AdminOrganizationForm } from "./admin-organization-form";
|
|
|
8
8
|
export { AdminUsersTable, useAdminUsersTotal } from "./admin-users";
|
|
9
9
|
export { assetUrl } from "./utils";
|
|
10
10
|
export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProviderProps, } from "./auth-provider";
|
|
11
|
-
export type { OrganizationSwitcherDialog } from "./organization-switcher";
|
|
11
|
+
export type { OrganizationSwitcherDialog, OrganizationSwitcherProps, } from "./organization-switcher";
|
|
12
12
|
export type { UserButtonDialog } from "./user-button";
|
|
13
13
|
export type { AuthUiClient } from "./auth-client";
|
|
@@ -53,6 +53,7 @@ declare const messages: {
|
|
|
53
53
|
readonly organization_role_admin: "Admin";
|
|
54
54
|
readonly organization_role_member: "Member";
|
|
55
55
|
readonly organization_role_owner: "Owner";
|
|
56
|
+
readonly organization_role_support: "Support";
|
|
56
57
|
readonly organization_slug: "Organization slug";
|
|
57
58
|
readonly organization_slug_description: "Leave blank to generate one from the name.";
|
|
58
59
|
readonly organization_switcher_empty: "You do not belong to any organizations yet.";
|
|
@@ -132,6 +133,7 @@ declare const messages: {
|
|
|
132
133
|
readonly organization_role_admin: "Admin";
|
|
133
134
|
readonly organization_role_member: "Membre";
|
|
134
135
|
readonly organization_role_owner: "Propriétaire";
|
|
136
|
+
readonly organization_role_support: "Support";
|
|
135
137
|
readonly organization_slug: "Slug de l'organisation";
|
|
136
138
|
readonly organization_slug_description: "Laissez vide pour en générer un à partir du nom.";
|
|
137
139
|
readonly organization_switcher_empty: "Vous n'appartenez encore à aucune organisation.";
|
|
@@ -163,13 +165,14 @@ declare const messages: {
|
|
|
163
165
|
};
|
|
164
166
|
type OrganizationSwitcherMessageKey = keyof (typeof messages)["en"];
|
|
165
167
|
export type OrganizationSwitcherMessages = Partial<Record<OrganizationSwitcherMessageKey, string>>;
|
|
166
|
-
type OrganizationSwitcherProps = {
|
|
168
|
+
export type OrganizationSwitcherProps = {
|
|
167
169
|
authClient?: AuthUiClient;
|
|
168
170
|
baseUrl?: string | undefined;
|
|
169
171
|
side?: ComponentProps<typeof DropdownMenuContent>["side"];
|
|
170
172
|
className?: string;
|
|
171
173
|
defaultDialog?: OrganizationSwitcherDialog | null;
|
|
172
174
|
hideTrigger?: boolean;
|
|
175
|
+
menuActions?: ReactNode;
|
|
173
176
|
renderUnauthenticated?: () => ReactNode;
|
|
174
177
|
locked?: boolean;
|
|
175
178
|
messages?: OrganizationSwitcherMessages;
|
|
@@ -185,5 +188,5 @@ type OrganizationSummary = {
|
|
|
185
188
|
metadata?: unknown;
|
|
186
189
|
};
|
|
187
190
|
export type OrganizationSwitcherDialog = "create" | "manage" | "members" | "apiKeys" | "invitations";
|
|
188
|
-
export declare function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl, side, className, defaultDialog, hideTrigger, renderUnauthenticated, locked, messages, dialog: controlledDialog, onChange, onCreate, onDialogChange, }: OrganizationSwitcherProps): import("react").JSX.Element;
|
|
191
|
+
export declare function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl, side, className, defaultDialog, hideTrigger, menuActions, renderUnauthenticated, locked, messages, dialog: controlledDialog, onChange, onCreate, onDialogChange, }: OrganizationSwitcherProps): import("react").JSX.Element;
|
|
189
192
|
export {};
|