@krak-stack/auth 0.1.48 → 0.1.50
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/components/admin-organizations.js +6 -2
- package/dist/components/admin-users.js +80 -73
- package/dist/components/auth-client-api.d.ts +132 -132
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +1 -1
- package/dist/components/invitation-expiration.d.ts +8 -0
- package/dist/components/invitation-expiration.js +24 -0
- package/dist/components/member-required.d.ts +45 -0
- package/dist/components/{admin-required.js → member-required.js} +56 -54
- package/dist/components/organization-switcher.d.ts +16 -6
- package/dist/components/organization-switcher.js +153 -59
- package/dist/components/user-button.js +10 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/components/admin-required.d.ts +0 -43
|
@@ -96,13 +96,17 @@ export function AdminOrganizationsTable({ from, reloadKey = 0, search, }) {
|
|
|
96
96
|
onFailure: () => false,
|
|
97
97
|
onSuccess: () => false,
|
|
98
98
|
});
|
|
99
|
-
return (_jsxs("div", { className: "flex flex-col gap-4", children: [error ? _jsx(ErrorMessage, { text: error }) : null, _jsx(DataTable, { columns: organizationColumns(m, locale, baseUrl), data: organizations,
|
|
99
|
+
return (_jsxs("div", { className: "flex flex-col gap-4", children: [error ? _jsx(ErrorMessage, { text: error }) : null, _jsx(DataTable, { columns: organizationColumns(m, locale, baseUrl), data: organizations, features: {
|
|
100
|
+
export: { baseName: "organizations" },
|
|
101
|
+
gallery: false,
|
|
102
|
+
pagination: { mode: "server", rowCount: total },
|
|
103
|
+
}, ...(from ? { routeFrom: from } : {}), ...(!search
|
|
100
104
|
? {
|
|
101
105
|
search: tableSearch,
|
|
102
106
|
onSearchChange: setLocalSearch,
|
|
103
107
|
searchState: "local",
|
|
104
108
|
}
|
|
105
|
-
: {}),
|
|
109
|
+
: {}), onRefresh: () => setRefreshKey((current) => current + 1), state: { loading: isLoading } })] }));
|
|
106
110
|
}
|
|
107
111
|
const organizationColumns = (m, locale, baseUrl) => [
|
|
108
112
|
{
|
|
@@ -171,84 +171,91 @@ export function AdminUsersTable({ from, reloadKey = 0, search, }) {
|
|
|
171
171
|
await navigate({ to: "/" });
|
|
172
172
|
await router.invalidate();
|
|
173
173
|
};
|
|
174
|
-
return (_jsxs(_Fragment, { children: [error ? _jsx(ErrorMessage, { text: error }) : null, impersonateError ? _jsx(ErrorMessage, { text: impersonateError }) : null, _jsx(DataTable, { columns: userColumns(m), data: users,
|
|
174
|
+
return (_jsxs(_Fragment, { children: [error ? _jsx(ErrorMessage, { text: error }) : null, impersonateError ? _jsx(ErrorMessage, { text: impersonateError }) : null, _jsx(DataTable, { columns: userColumns(m), data: users, features: {
|
|
175
|
+
export: { baseName: "users" },
|
|
176
|
+
gallery: false,
|
|
177
|
+
pagination: { mode: "server", rowCount: total },
|
|
178
|
+
rowActions: {
|
|
179
|
+
items: [
|
|
180
|
+
{
|
|
181
|
+
name: m.admin_action_impersonate,
|
|
182
|
+
icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(UserCog, { className: "size-4" })),
|
|
183
|
+
onClick: async (user) => {
|
|
184
|
+
setImpersonateError("");
|
|
185
|
+
setImpersonatingUserId(user.id);
|
|
186
|
+
try {
|
|
187
|
+
if (!authClient)
|
|
188
|
+
throw new Error(m.admin_error_access_required);
|
|
189
|
+
await impersonateUser(authClient, user.id, m);
|
|
190
|
+
await refreshSessionAndNavigate();
|
|
191
|
+
}
|
|
192
|
+
catch (cause) {
|
|
193
|
+
setImpersonateError(cause instanceof Error
|
|
194
|
+
? cause.message
|
|
195
|
+
: m.admin_error_impersonate);
|
|
196
|
+
}
|
|
197
|
+
finally {
|
|
198
|
+
setImpersonatingUserId(null);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
visible: (user) => !user.banned,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: m.admin_action_impersonate_organization,
|
|
205
|
+
icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Building2, { className: "size-4" })),
|
|
206
|
+
onClick: async (user) => {
|
|
207
|
+
setImpersonateError("");
|
|
208
|
+
setImpersonatingUserId(user.id);
|
|
209
|
+
try {
|
|
210
|
+
if (!session?.user?.id) {
|
|
211
|
+
throw new Error(m.admin_error_access_required);
|
|
212
|
+
}
|
|
213
|
+
const organizationId = activeOrganizationId(session);
|
|
214
|
+
if (!organizationId) {
|
|
215
|
+
throw new Error(m.admin_error_organization_required);
|
|
216
|
+
}
|
|
217
|
+
await impersonateOrganizationUser({
|
|
218
|
+
payload: {
|
|
219
|
+
organizationId,
|
|
220
|
+
actorUserId: session.user.id,
|
|
221
|
+
targetUserId: user.id,
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
await refreshSessionAndNavigate();
|
|
225
|
+
}
|
|
226
|
+
catch (cause) {
|
|
227
|
+
setImpersonateError(cause instanceof Error
|
|
228
|
+
? cause.message
|
|
229
|
+
: m.admin_error_impersonate_organization);
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
setImpersonatingUserId(null);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
visible: (user) => !user.banned,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: m.admin_action_ban,
|
|
239
|
+
icon: _jsx(Ban, { className: "size-4" }),
|
|
240
|
+
variant: "destructive",
|
|
241
|
+
onClick: (user) => setBanningUser(user),
|
|
242
|
+
visible: (user) => !user.banned,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: m.admin_action_unban,
|
|
246
|
+
icon: _jsx(ShieldOff, { className: "size-4" }),
|
|
247
|
+
onClick: (user) => setUnbanningUser(user),
|
|
248
|
+
visible: (user) => !!user.banned,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
}, ...(from ? { routeFrom: from } : {}), ...(!search
|
|
175
253
|
? {
|
|
176
254
|
search: tableSearch,
|
|
177
255
|
onSearchChange: setLocalSearch,
|
|
178
256
|
searchState: "local",
|
|
179
257
|
}
|
|
180
|
-
: {}),
|
|
181
|
-
{
|
|
182
|
-
name: m.admin_action_impersonate,
|
|
183
|
-
icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(UserCog, { className: "size-4" })),
|
|
184
|
-
onClick: async (user) => {
|
|
185
|
-
setImpersonateError("");
|
|
186
|
-
setImpersonatingUserId(user.id);
|
|
187
|
-
try {
|
|
188
|
-
if (!authClient)
|
|
189
|
-
throw new Error(m.admin_error_access_required);
|
|
190
|
-
await impersonateUser(authClient, user.id, m);
|
|
191
|
-
await refreshSessionAndNavigate();
|
|
192
|
-
}
|
|
193
|
-
catch (cause) {
|
|
194
|
-
setImpersonateError(cause instanceof Error
|
|
195
|
-
? cause.message
|
|
196
|
-
: m.admin_error_impersonate);
|
|
197
|
-
}
|
|
198
|
-
finally {
|
|
199
|
-
setImpersonatingUserId(null);
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
visible: (user) => !user.banned,
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
name: m.admin_action_impersonate_organization,
|
|
206
|
-
icon: impersonatingUserId ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(Building2, { className: "size-4" })),
|
|
207
|
-
onClick: async (user) => {
|
|
208
|
-
setImpersonateError("");
|
|
209
|
-
setImpersonatingUserId(user.id);
|
|
210
|
-
try {
|
|
211
|
-
if (!session?.user?.id) {
|
|
212
|
-
throw new Error(m.admin_error_access_required);
|
|
213
|
-
}
|
|
214
|
-
const organizationId = activeOrganizationId(session);
|
|
215
|
-
if (!organizationId) {
|
|
216
|
-
throw new Error(m.admin_error_organization_required);
|
|
217
|
-
}
|
|
218
|
-
await impersonateOrganizationUser({
|
|
219
|
-
payload: {
|
|
220
|
-
organizationId,
|
|
221
|
-
actorUserId: session.user.id,
|
|
222
|
-
targetUserId: user.id,
|
|
223
|
-
},
|
|
224
|
-
});
|
|
225
|
-
await refreshSessionAndNavigate();
|
|
226
|
-
}
|
|
227
|
-
catch (cause) {
|
|
228
|
-
setImpersonateError(cause instanceof Error
|
|
229
|
-
? cause.message
|
|
230
|
-
: m.admin_error_impersonate_organization);
|
|
231
|
-
}
|
|
232
|
-
finally {
|
|
233
|
-
setImpersonatingUserId(null);
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
visible: (user) => !user.banned,
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: m.admin_action_ban,
|
|
240
|
-
icon: _jsx(Ban, { className: "size-4" }),
|
|
241
|
-
variant: "destructive",
|
|
242
|
-
onClick: (user) => setBanningUser(user),
|
|
243
|
-
visible: (user) => !user.banned,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: m.admin_action_unban,
|
|
247
|
-
icon: _jsx(ShieldOff, { className: "size-4" }),
|
|
248
|
-
onClick: (user) => setUnbanningUser(user),
|
|
249
|
-
visible: (user) => !!user.banned,
|
|
250
|
-
},
|
|
251
|
-
] }), banningUser ? (_jsx(BanUserDialog, { labels: m, authClient: authClient, user: banningUser, onBanned: () => setRefreshKey((current) => current + 1), onClose: () => setBanningUser(null) })) : null, unbanningUser ? (_jsx(UnbanUserDialog, { labels: m, authClient: authClient, user: unbanningUser, onUnbanned: () => setRefreshKey((current) => current + 1), onClose: () => setUnbanningUser(null) })) : null] }));
|
|
258
|
+
: {}), onRefresh: () => setRefreshKey((current) => current + 1), state: { loading: isLoading } }), banningUser ? (_jsx(BanUserDialog, { labels: m, authClient: authClient, user: banningUser, onBanned: () => setRefreshKey((current) => current + 1), onClose: () => setBanningUser(null) })) : null, unbanningUser ? (_jsx(UnbanUserDialog, { labels: m, authClient: authClient, user: unbanningUser, onUnbanned: () => setRefreshKey((current) => current + 1), onClose: () => setUnbanningUser(null) })) : null] }));
|
|
252
259
|
}
|
|
253
260
|
export function useAdminUsersTotal(search) {
|
|
254
261
|
const auth = useKrakstackAuth();
|
|
@@ -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,134 +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<"getOrganizationPublicProfile", "GET", "/api/auth/organization-profile", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
384
|
-
readonly organizationId: import("effect/Schema").String;
|
|
385
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
386
|
-
readonly id: import("effect/Schema").String;
|
|
387
|
-
readonly name: import("effect/Schema").String;
|
|
388
|
-
readonly slug: import("effect/Schema").String;
|
|
389
|
-
readonly displayName: import("effect/Schema").String;
|
|
390
|
-
readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
391
|
-
readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
392
|
-
readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
393
|
-
}>>, 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<{
|
|
394
|
-
readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
395
|
-
readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
396
|
-
readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
397
|
-
readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
398
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
399
|
-
readonly projectKey: import("effect/Schema").String;
|
|
400
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
401
|
-
readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
402
|
-
readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
403
|
-
readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
404
|
-
readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
405
|
-
readonly authOptions: import("effect/Schema").Struct<{
|
|
406
|
-
readonly emailPassword: import("effect/Schema").Boolean;
|
|
407
|
-
readonly emailOtp: import("effect/Schema").Boolean;
|
|
408
|
-
readonly google: import("effect/Schema").Boolean;
|
|
409
|
-
readonly signUp: import("effect/Schema").Boolean;
|
|
410
|
-
readonly signUpName: import("effect/Schema").Boolean;
|
|
411
|
-
}>;
|
|
412
|
-
}>>, 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<{
|
|
413
|
-
readonly newPassword: import("effect/Schema").NonEmptyString;
|
|
414
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
415
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
416
|
-
}>>, 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<{
|
|
417
|
-
readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
|
|
418
|
-
}>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
419
|
-
readonly url: import("effect/Schema").String;
|
|
420
|
-
}>>, 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<{
|
|
421
|
-
readonly key: import("effect/Schema").NonEmptyString;
|
|
422
|
-
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">]>>;
|
|
423
|
-
readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
424
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
425
|
-
readonly valid: import("effect/Schema").Boolean;
|
|
426
|
-
readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
427
|
-
readonly message: import("effect/Schema").String;
|
|
428
|
-
readonly code: import("effect/Schema").String;
|
|
429
|
-
}>>;
|
|
430
|
-
readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
|
|
431
|
-
readonly id: import("effect/Schema").String;
|
|
432
|
-
readonly configId: import("effect/Schema").String;
|
|
433
|
-
readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
434
|
-
readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
435
|
-
readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
436
|
-
readonly referenceId: import("effect/Schema").String;
|
|
437
|
-
readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
|
|
438
|
-
readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
|
|
439
|
-
readonly createdAt: import("effect/Schema").Date;
|
|
440
|
-
readonly updatedAt: import("effect/Schema").Date;
|
|
441
|
-
readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
|
|
442
|
-
readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
|
|
443
|
-
}>>;
|
|
444
|
-
}>>, 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<{
|
|
445
|
-
readonly password: import("effect/Schema").NonEmptyString;
|
|
446
|
-
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
447
|
-
readonly ok: import("effect/Schema").Boolean;
|
|
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").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,7 +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 {
|
|
4
|
+
export { MemberRequired } from "./member-required";
|
|
5
5
|
export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
|
|
6
6
|
export { UserButton } from "./user-button";
|
|
7
7
|
export { AdminOrganizationsTable } from "./admin-organizations";
|
|
@@ -12,4 +12,4 @@ export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProvi
|
|
|
12
12
|
export type { OrganizationSwitcherDialog, OrganizationSwitcherProps, } from "./organization-switcher";
|
|
13
13
|
export type { UserButtonDialog } from "./user-button";
|
|
14
14
|
export type { AuthUiClient } from "./auth-client";
|
|
15
|
-
export type {
|
|
15
|
+
export type { MemberRequiredMessages, MemberRequiredProps } from "./member-required";
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +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 {
|
|
4
|
+
export { MemberRequired } from "./member-required";
|
|
5
5
|
export { ResetPassword, Signin, Signup, TwoFactor } from "./auth-forms";
|
|
6
6
|
export { UserButton } from "./user-button";
|
|
7
7
|
export { AdminOrganizationsTable } from "./admin-organizations";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type ExpiringInvitation = {
|
|
2
|
+
status: string;
|
|
3
|
+
expiresAt: Date | string;
|
|
4
|
+
};
|
|
5
|
+
export declare const isInvitationExpired: (invitation: ExpiringInvitation, now?: number) => boolean;
|
|
6
|
+
export declare const invitationDisplayStatus: (invitation: ExpiringInvitation, now?: number) => string;
|
|
7
|
+
export declare const useInvitationExpirationClock: (invitations: readonly ExpiringInvitation[]) => number;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
const expirationTime = (invitation) => new Date(invitation.expiresAt).getTime();
|
|
3
|
+
export const isInvitationExpired = (invitation, now = Date.now()) => invitation.status === "pending" && expirationTime(invitation) <= now;
|
|
4
|
+
export const invitationDisplayStatus = (invitation, now = Date.now()) => (isInvitationExpired(invitation, now) ? "expired" : invitation.status);
|
|
5
|
+
export const useInvitationExpirationClock = (invitations) => {
|
|
6
|
+
const [now, setNow] = useState(Date.now);
|
|
7
|
+
const nextExpiration = invitations.reduce((next, invitation) => {
|
|
8
|
+
const expiresAt = expirationTime(invitation);
|
|
9
|
+
if (invitation.status !== "pending" ||
|
|
10
|
+
!Number.isFinite(expiresAt) ||
|
|
11
|
+
expiresAt <= now) {
|
|
12
|
+
return next;
|
|
13
|
+
}
|
|
14
|
+
return next === undefined ? expiresAt : Math.min(next, expiresAt);
|
|
15
|
+
}, undefined);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (nextExpiration === undefined)
|
|
18
|
+
return;
|
|
19
|
+
const delay = Math.min(Math.max(nextExpiration - Date.now() + 1, 0), 2_147_483_647);
|
|
20
|
+
const timeout = globalThis.setTimeout(() => setNow(Date.now()), delay);
|
|
21
|
+
return () => globalThis.clearTimeout(timeout);
|
|
22
|
+
}, [nextExpiration]);
|
|
23
|
+
return now;
|
|
24
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { AuthUiClient } from "./auth-client";
|
|
3
|
+
declare const defaultMessages: {
|
|
4
|
+
readonly en: {
|
|
5
|
+
readonly member_required_title: "Organization access required";
|
|
6
|
+
readonly member_required_description: "You need organization access to continue.";
|
|
7
|
+
readonly member_required_org_description: "You need access to {organization} before opening the admin area.";
|
|
8
|
+
readonly member_required_no_permission: "Your account is signed in, but it does not have access to this organization.";
|
|
9
|
+
readonly member_required_invite_found: "You have a pending invitation to {organization}. Accept it to continue.";
|
|
10
|
+
readonly member_required_invite_expired: "Your invitation to {organization} has expired. Contact the organization administrator for a new invitation.";
|
|
11
|
+
readonly member_required_accept_invite: "Accept invitation";
|
|
12
|
+
readonly member_required_accepting_invite: "Accepting...";
|
|
13
|
+
readonly member_required_accept_error: "Could not accept the invitation.";
|
|
14
|
+
readonly member_required_contact: "Contact organization";
|
|
15
|
+
readonly member_required_contact_description: "If you expected access, contact the organization administrator.";
|
|
16
|
+
readonly member_required_copy_email: "Copy email";
|
|
17
|
+
readonly member_required_copied_email: "Copied email";
|
|
18
|
+
};
|
|
19
|
+
readonly fr: {
|
|
20
|
+
readonly member_required_title: "Accès à l'organisation requis";
|
|
21
|
+
readonly member_required_description: "Vous devez disposer d'un accès à l'organisation pour continuer.";
|
|
22
|
+
readonly member_required_org_description: "Vous devez avoir accès à {organization} avant d'ouvrir l'administration.";
|
|
23
|
+
readonly member_required_no_permission: "Votre compte est connecté, mais il ne dispose pas d'un accès à cette organisation.";
|
|
24
|
+
readonly member_required_invite_found: "Vous avez une invitation en attente pour {organization}. Acceptez-la pour continuer.";
|
|
25
|
+
readonly member_required_invite_expired: "Votre invitation pour {organization} a expiré. Contactez l'administrateur de l'organisation pour obtenir une nouvelle invitation.";
|
|
26
|
+
readonly member_required_accept_invite: "Accepter l'invitation";
|
|
27
|
+
readonly member_required_accepting_invite: "Acceptation...";
|
|
28
|
+
readonly member_required_accept_error: "Impossible d'accepter l'invitation.";
|
|
29
|
+
readonly member_required_contact: "Contacter l'organisation";
|
|
30
|
+
readonly member_required_contact_description: "Si vous pensiez avoir accès, contactez l'administrateur de l'organisation.";
|
|
31
|
+
readonly member_required_copy_email: "Copier l'e-mail";
|
|
32
|
+
readonly member_required_copied_email: "E-mail copié";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type MemberRequiredLabels = (typeof defaultMessages)["en"];
|
|
36
|
+
export type MemberRequiredMessages = Partial<MemberRequiredLabels>;
|
|
37
|
+
export type MemberRequiredProps = {
|
|
38
|
+
authClient?: AuthUiClient | undefined;
|
|
39
|
+
organizationId: string;
|
|
40
|
+
contactEmail?: string | undefined;
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
messages?: MemberRequiredMessages | undefined;
|
|
43
|
+
};
|
|
44
|
+
export declare function MemberRequired({ authClient: providedAuthClient, organizationId, contactEmail, children, messages, }: MemberRequiredProps): import("react").JSX.Element;
|
|
45
|
+
export {};
|