@krak-stack/auth 0.1.61 → 0.1.62

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.
@@ -11,7 +11,9 @@ import { ExtraApiKeyPermissions } from "../extra/schema";
11
11
  const editApiKeyFormBuilder = FormBuilder.empty
12
12
  .addField("name", Schema.NonEmptyString)
13
13
  .addField("enabled", Schema.Boolean)
14
- .addField("referrers", Schema.String);
14
+ .addField("referrers", Schema.String)
15
+ .addField("permissions", Schema.Record(Schema.String, Schema.Boolean));
16
+ const ApiKeyPermissionsField = ({ field, props }) => (_jsx(ApiKeyPermissions, { description: props.description, idPrefix: props.idPrefix, permissions: props.permissions, labels: props.labels, selected: field.value, title: props.title, onChange: (id, checked) => field.onChange({ ...field.value, [id]: checked }) }));
15
17
  export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permissionLabels, onSaved, }) => {
16
18
  const permissionOptions = Object.entries(permissions).flatMap(([project, actions]) => actions.map((action) => ({
17
19
  id: `${project}:${action}`,
@@ -24,11 +26,8 @@ export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permi
24
26
  option.id,
25
27
  currentGrant[option.project]?.includes(option.action) ?? false,
26
28
  ]));
27
- const [selectedPermissions, setSelectedPermissions] = useState(initialSelectedPermissions);
28
- const selectedPermissionsRef = useRef(selectedPermissions);
29
29
  const permissionOptionsRef = useRef(permissionOptions);
30
30
  const permissionsRef = useRef(permissions);
31
- selectedPermissionsRef.current = selectedPermissions;
32
31
  permissionOptionsRef.current = permissionOptions;
33
32
  permissionsRef.current = permissions;
34
33
  const [form] = useState(() => FormReact.make(editApiKeyFormBuilder, {
@@ -36,6 +35,7 @@ export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permi
36
35
  name: TextField,
37
36
  enabled: CheckboxField,
38
37
  referrers: TextAreaField,
38
+ permissions: ApiKeyPermissionsField,
39
39
  },
40
40
  mode: { validation: "onSubmit" },
41
41
  onSubmit: (_, { decoded }) => Effect.tryPromise({
@@ -46,7 +46,7 @@ export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permi
46
46
  selectedGrant[project] = [];
47
47
  }
48
48
  for (const option of permissionOptionsRef.current) {
49
- if (!selectedPermissionsRef.current[option.id])
49
+ if (!decoded.permissions[option.id])
50
50
  continue;
51
51
  selectedGrant[option.project] = [
52
52
  ...(selectedGrant[option.project] ?? []),
@@ -72,12 +72,10 @@ export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permi
72
72
  name: keyData.name ?? "",
73
73
  enabled: keyData.enabled,
74
74
  referrers: apiKeyReferrers(keyData.metadata).join("\n"),
75
+ permissions: initialSelectedPermissions,
75
76
  }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
76
77
  event.preventDefault();
77
78
  event.stopPropagation();
78
79
  submit();
79
- }, children: [_jsx(form.name, { label: messages.name, required: true }), _jsx(form.enabled, { label: messages.enabled }), _jsx(form.referrers, { label: messages.referrers, description: messages.referrersDescription, placeholder: messages.referrersPlaceholder, rows: 3 }), _jsx(ApiKeyPermissions, { description: messages.permissionsDescription, idPrefix: "edit", permissions: permissions, labels: permissionLabels, selected: selectedPermissions, title: messages.permissions, onChange: (id, checked) => setSelectedPermissions((current) => ({
80
- ...current,
81
- [id]: checked,
82
- })) }), _jsx(SubmitError, { result: submitResult }), _jsx(SubmitButton, { form: form })] }) }) }));
80
+ }, children: [_jsx(form.name, { label: messages.name, required: true }), _jsx(form.enabled, { label: messages.enabled }), _jsx(form.referrers, { label: messages.referrers, description: messages.referrersDescription, placeholder: messages.referrersPlaceholder, rows: 3 }), _jsx(form.permissions, { description: messages.permissionsDescription, idPrefix: "edit", permissions: permissions, labels: permissionLabels, title: messages.permissions }), _jsx(SubmitError, { result: submitResult }), _jsx(SubmitButton, { form: form })] }) }) }));
83
81
  };
@@ -1,5 +1,188 @@
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<"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<{
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
+ readonly referrers: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").String>>;
65
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
66
+ readonly id: import("effect/Schema").String;
67
+ readonly key: import("effect/Schema").String;
68
+ }>>, 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<{
69
+ readonly organizationId: import("effect/Schema").String;
70
+ readonly locale: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>>;
71
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
72
+ readonly id: import("effect/Schema").String;
73
+ readonly name: import("effect/Schema").String;
74
+ readonly slug: import("effect/Schema").String;
75
+ readonly displayName: import("effect/Schema").String;
76
+ readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
77
+ readonly emails: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
78
+ readonly email: import("effect/Schema").NonEmptyString;
79
+ readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
80
+ readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
81
+ readonly label: import("effect/Schema").NonEmptyString;
82
+ }>>;
83
+ }>>>;
84
+ readonly phones: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
85
+ readonly number: import("effect/Schema").NonEmptyString;
86
+ readonly extension: import("effect/Schema").optional<import("effect/Schema").String>;
87
+ readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
88
+ readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
89
+ readonly label: import("effect/Schema").NonEmptyString;
90
+ }>>;
91
+ }>>>;
92
+ readonly websites: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
93
+ readonly url: import("effect/Schema").NonEmptyString;
94
+ readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
95
+ readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
96
+ readonly label: import("effect/Schema").NonEmptyString;
97
+ }>>;
98
+ }>>>;
99
+ readonly socials: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
100
+ readonly platform: import("effect/Schema").Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
101
+ readonly url: import("effect/Schema").NonEmptyString;
102
+ readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
103
+ readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
104
+ readonly label: import("effect/Schema").NonEmptyString;
105
+ }>>;
106
+ }>>>;
107
+ readonly addresses: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
108
+ readonly streetAddress: import("effect/Schema").optional<import("effect/Schema").String>;
109
+ readonly locality: import("effect/Schema").optional<import("effect/Schema").String>;
110
+ readonly region: import("effect/Schema").optional<import("effect/Schema").String>;
111
+ readonly postalCode: import("effect/Schema").optional<import("effect/Schema").String>;
112
+ readonly country: import("effect/Schema").optional<import("effect/Schema").String>;
113
+ readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
114
+ readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
115
+ readonly label: import("effect/Schema").NonEmptyString;
116
+ }>>;
117
+ readonly formatted: import("effect/Schema").String;
118
+ }>>>;
119
+ readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
120
+ readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
121
+ }>>, 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<{
122
+ readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
123
+ readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
124
+ readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
125
+ readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
126
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
127
+ readonly projectKey: import("effect/Schema").String;
128
+ readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
129
+ readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
130
+ readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
131
+ readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
132
+ readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
133
+ readonly authOptions: import("effect/Schema").Struct<{
134
+ readonly emailPassword: import("effect/Schema").Boolean;
135
+ readonly emailOtp: import("effect/Schema").Boolean;
136
+ readonly google: import("effect/Schema").Boolean;
137
+ readonly signUp: import("effect/Schema").Boolean;
138
+ readonly signUpName: import("effect/Schema").Boolean;
139
+ }>;
140
+ }>>, 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<{
141
+ readonly newPassword: import("effect/Schema").NonEmptyString;
142
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
143
+ readonly ok: import("effect/Schema").Boolean;
144
+ }>>, 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<"updateApiKey", "PATCH", "/api/auth/api-key/:keyId", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
145
+ readonly keyId: import("effect/Schema").NonEmptyString;
146
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
147
+ readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
148
+ readonly name: import("effect/Schema").NonEmptyString;
149
+ readonly enabled: import("effect/Schema").Boolean;
150
+ readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
151
+ readonly referrers: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").String>>;
152
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
153
+ readonly ok: import("effect/Schema").Boolean;
154
+ }>>, 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<{
155
+ readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
156
+ }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
157
+ readonly url: import("effect/Schema").String;
158
+ }>>, 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<{
159
+ readonly key: import("effect/Schema").NonEmptyString;
160
+ 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">]>>;
161
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
162
+ readonly valid: import("effect/Schema").Boolean;
163
+ readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
164
+ readonly message: import("effect/Schema").String;
165
+ readonly code: import("effect/Schema").String;
166
+ }>>;
167
+ readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
168
+ readonly id: import("effect/Schema").String;
169
+ readonly configId: import("effect/Schema").String;
170
+ readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
171
+ readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
172
+ readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
173
+ readonly referenceId: import("effect/Schema").String;
174
+ readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
175
+ readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
176
+ readonly createdAt: import("effect/Schema").Date;
177
+ readonly updatedAt: import("effect/Schema").Date;
178
+ readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
179
+ readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
180
+ }>>;
181
+ }>>, 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<{
182
+ readonly password: import("effect/Schema").NonEmptyString;
183
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
184
+ readonly ok: import("effect/Schema").Boolean;
185
+ }>>, 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
186
  readonly hostname: import("effect/Schema").NonEmptyString;
4
187
  readonly rootHostname: import("effect/Schema").NonEmptyString;
5
188
  readonly projectId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
@@ -382,187 +565,4 @@ export declare const authClientApi: (baseUrl?: string | undefined) => AtomHttpAp
382
565
  readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
383
566
  }>>>;
384
567
  readonly createdAt: import("effect/Schema").Date;
385
- }>>, 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> | 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<{
386
- readonly session: import("effect/Schema").Struct<{
387
- readonly id: import("effect/Schema").String;
388
- readonly expiresAt: import("effect/Schema").Date;
389
- readonly token: import("effect/Schema").String;
390
- readonly createdAt: import("effect/Schema").Date;
391
- readonly updatedAt: import("effect/Schema").Date;
392
- readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
393
- readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
394
- readonly userId: import("effect/Schema").String;
395
- readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
396
- readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
397
- readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
398
- }>;
399
- readonly user: import("effect/Schema").Struct<{
400
- readonly id: import("effect/Schema").String;
401
- readonly name: import("effect/Schema").String;
402
- readonly email: import("effect/Schema").String;
403
- readonly emailVerified: import("effect/Schema").Boolean;
404
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
405
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
406
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
407
- readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
408
- readonly createdAt: import("effect/Schema").Date;
409
- readonly updatedAt: import("effect/Schema").Date;
410
- }>;
411
- }>>>, 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<{
412
- readonly organizationId: import("effect/Schema").NonEmptyString;
413
- readonly actorUserId: import("effect/Schema").NonEmptyString;
414
- readonly targetUserId: import("effect/Schema").NonEmptyString;
415
- readonly expiresInSeconds: import("effect/Schema").optional<import("effect/Schema").Number>;
416
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
417
- readonly session: import("effect/Schema").Struct<{
418
- readonly id: import("effect/Schema").String;
419
- readonly expiresAt: import("effect/Schema").Date;
420
- readonly token: import("effect/Schema").String;
421
- readonly createdAt: import("effect/Schema").Date;
422
- readonly updatedAt: import("effect/Schema").Date;
423
- readonly ipAddress: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
424
- readonly userAgent: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
425
- readonly userId: import("effect/Schema").String;
426
- readonly impersonatedBy: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
427
- readonly impersonatedByOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
428
- readonly activeOrganizationId: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
429
- }>;
430
- readonly user: import("effect/Schema").Struct<{
431
- readonly id: import("effect/Schema").String;
432
- readonly name: import("effect/Schema").String;
433
- readonly email: import("effect/Schema").String;
434
- readonly emailVerified: import("effect/Schema").Boolean;
435
- readonly image: import("effect/Schema").NullOr<import("effect/Schema").String>;
436
- readonly role: import("effect/Schema").NullOr<import("effect/Schema").String>;
437
- readonly banned: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
438
- readonly lastLoginMethod: import("effect/Schema").optional<import("effect/Schema").NullOr<import("effect/Schema").String>>;
439
- readonly createdAt: import("effect/Schema").Date;
440
- readonly updatedAt: import("effect/Schema").Date;
441
- }>;
442
- }>>, 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<{
443
- readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
444
- readonly name: import("effect/Schema").optional<import("effect/Schema").NonEmptyString>;
445
- readonly organizationId: import("effect/Schema").optional<import("effect/Schema").String>;
446
- readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
447
- readonly referrers: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").String>>;
448
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
449
- readonly id: import("effect/Schema").String;
450
- readonly key: import("effect/Schema").String;
451
- }>>, 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<{
452
- readonly organizationId: import("effect/Schema").String;
453
- readonly locale: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>>;
454
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
455
- readonly id: import("effect/Schema").String;
456
- readonly name: import("effect/Schema").String;
457
- readonly slug: import("effect/Schema").String;
458
- readonly displayName: import("effect/Schema").String;
459
- readonly contactEmail: import("effect/Schema").NullOr<import("effect/Schema").String>;
460
- readonly emails: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
461
- readonly email: import("effect/Schema").NonEmptyString;
462
- readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
463
- readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
464
- readonly label: import("effect/Schema").NonEmptyString;
465
- }>>;
466
- }>>>;
467
- readonly phones: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
468
- readonly number: import("effect/Schema").NonEmptyString;
469
- readonly extension: import("effect/Schema").optional<import("effect/Schema").String>;
470
- readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
471
- readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
472
- readonly label: import("effect/Schema").NonEmptyString;
473
- }>>;
474
- }>>>;
475
- readonly websites: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
476
- readonly url: import("effect/Schema").NonEmptyString;
477
- readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
478
- readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
479
- readonly label: import("effect/Schema").NonEmptyString;
480
- }>>;
481
- }>>>;
482
- readonly socials: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
483
- readonly platform: import("effect/Schema").Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
484
- readonly url: import("effect/Schema").NonEmptyString;
485
- readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
486
- readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
487
- readonly label: import("effect/Schema").NonEmptyString;
488
- }>>;
489
- }>>>;
490
- readonly addresses: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
491
- readonly streetAddress: import("effect/Schema").optional<import("effect/Schema").String>;
492
- readonly locality: import("effect/Schema").optional<import("effect/Schema").String>;
493
- readonly region: import("effect/Schema").optional<import("effect/Schema").String>;
494
- readonly postalCode: import("effect/Schema").optional<import("effect/Schema").String>;
495
- readonly country: import("effect/Schema").optional<import("effect/Schema").String>;
496
- readonly translations: import("effect/Schema").$Array<import("effect/Schema").Struct<{
497
- readonly locale: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"en">, import("effect/Schema").Literal<"fr">]>;
498
- readonly label: import("effect/Schema").NonEmptyString;
499
- }>>;
500
- readonly formatted: import("effect/Schema").String;
501
- }>>>;
502
- readonly logo: import("effect/Schema").NullOr<import("effect/Schema").String>;
503
- readonly icon: import("effect/Schema").NullOr<import("effect/Schema").String>;
504
- }>>, 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<{
505
- readonly projectId: import("effect/Schema").optional<import("effect/Schema").String>;
506
- readonly clientId: import("effect/Schema").optional<import("effect/Schema").String>;
507
- readonly host: import("effect/Schema").optional<import("effect/Schema").String>;
508
- readonly rootHost: import("effect/Schema").optional<import("effect/Schema").String>;
509
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
510
- readonly projectKey: import("effect/Schema").String;
511
- readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
512
- readonly logoUrl: import("effect/Schema").NullOr<import("effect/Schema").String>;
513
- readonly authDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
514
- readonly rootDomain: import("effect/Schema").NullOr<import("effect/Schema").String>;
515
- readonly themeCss: import("effect/Schema").NullOr<import("effect/Schema").String>;
516
- readonly authOptions: import("effect/Schema").Struct<{
517
- readonly emailPassword: import("effect/Schema").Boolean;
518
- readonly emailOtp: import("effect/Schema").Boolean;
519
- readonly google: import("effect/Schema").Boolean;
520
- readonly signUp: import("effect/Schema").Boolean;
521
- readonly signUpName: import("effect/Schema").Boolean;
522
- }>;
523
- }>>, 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<{
524
- readonly newPassword: import("effect/Schema").NonEmptyString;
525
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
526
- readonly ok: import("effect/Schema").Boolean;
527
- }>>, 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<"updateApiKey", "PATCH", "/api/auth/api-key/:keyId", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
528
- readonly keyId: import("effect/Schema").NonEmptyString;
529
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
530
- readonly configId: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"organization">, import("effect/Schema").Literal<"service">]>;
531
- readonly name: import("effect/Schema").NonEmptyString;
532
- readonly enabled: import("effect/Schema").Boolean;
533
- readonly permissions: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
534
- readonly referrers: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").String>>;
535
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
536
- readonly ok: import("effect/Schema").Boolean;
537
- }>>, 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<{
538
- readonly file: import("effect/Schema").decodeTo<import("effect/unstable/http/Multipart").PersistedFileSchema, import("effect/Schema").$Array<import("effect/unstable/http/Multipart").PersistedFileSchema>, never, never>;
539
- }>>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
540
- readonly url: import("effect/Schema").String;
541
- }>>, 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<{
542
- readonly key: import("effect/Schema").NonEmptyString;
543
- 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">]>>;
544
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
545
- readonly valid: import("effect/Schema").Boolean;
546
- readonly error: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
547
- readonly message: import("effect/Schema").String;
548
- readonly code: import("effect/Schema").String;
549
- }>>;
550
- readonly key: import("effect/Schema").NullOr<import("effect/Schema").Struct<{
551
- readonly id: import("effect/Schema").String;
552
- readonly configId: import("effect/Schema").String;
553
- readonly name: import("effect/Schema").NullOr<import("effect/Schema").String>;
554
- readonly start: import("effect/Schema").NullOr<import("effect/Schema").String>;
555
- readonly prefix: import("effect/Schema").NullOr<import("effect/Schema").String>;
556
- readonly referenceId: import("effect/Schema").String;
557
- readonly enabled: import("effect/Schema").NullOr<import("effect/Schema").Boolean>;
558
- readonly expiresAt: import("effect/Schema").NullOr<import("effect/Schema").Date>;
559
- readonly createdAt: import("effect/Schema").Date;
560
- readonly updatedAt: import("effect/Schema").Date;
561
- readonly permissions: import("effect/Schema").NullOr<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>>>;
562
- readonly metadata: import("effect/Schema").NullOr<import("effect/Schema").Unknown>;
563
- }>>;
564
- }>>, 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<{
565
- readonly password: import("effect/Schema").NonEmptyString;
566
- }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
567
- readonly ok: import("effect/Schema").Boolean;
568
- }>>, 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>>;
568
+ }>>, 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>>;
@@ -8,6 +8,7 @@ type AuthFormProps = {
8
8
  export declare function Signin(props: AuthFormProps): import("react").JSX.Element;
9
9
  export declare function Signup(props: AuthFormProps): import("react").JSX.Element;
10
10
  export declare function VerifyEmail(props: AuthFormProps): import("react").JSX.Element;
11
+ export declare function ForgotPassword(props: AuthFormProps): import("react").JSX.Element;
11
12
  export declare function ResetPassword(props: AuthFormProps): import("react").JSX.Element;
12
13
  export declare function TwoFactor(props: AuthFormProps): import("react").JSX.Element;
13
14
  export {};
@@ -28,6 +28,7 @@ const signupFormBuilder = FormBuilder.empty
28
28
  const verifyEmailFormBuilder = FormBuilder.empty
29
29
  .addField("email", Schema.String)
30
30
  .addField("otp", Schema.String);
31
+ const forgotPasswordFormBuilder = FormBuilder.empty.addField("email", Schema.String);
31
32
  const resetPasswordFormBuilder = FormBuilder.empty.addField("password", Schema.String);
32
33
  const twoFactorFormBuilder = FormBuilder.empty
33
34
  .addField("code", Schema.String)
@@ -42,6 +43,11 @@ const defaultMessages = {
42
43
  field_name: "Name",
43
44
  field_password: "Password",
44
45
  forgot_password_back_to_sign_in: "Back to sign in",
46
+ forgot_password_description: "Enter your email and we will send a reset link if an account exists.",
47
+ forgot_password_error: "Unable to send password reset email.",
48
+ forgot_password_submit: "Send reset link",
49
+ forgot_password_success: "If an account exists for that email, a reset link has been sent.",
50
+ forgot_password_title: "Reset password",
45
51
  oauth_client_no_auth_methods: "No authentication methods are enabled for this application.",
46
52
  reset_password_description: "Enter a new password for your account.",
47
53
  reset_password_error: "Unable to reset password.",
@@ -100,6 +106,11 @@ const defaultMessages = {
100
106
  field_name: "Nom",
101
107
  field_password: "Mot de passe",
102
108
  forgot_password_back_to_sign_in: "Retour à la connexion",
109
+ forgot_password_description: "Saisissez votre courriel et nous enverrons un lien de réinitialisation si un compte existe.",
110
+ forgot_password_error: "Impossible d'envoyer le courriel de réinitialisation.",
111
+ forgot_password_submit: "Envoyer le lien",
112
+ forgot_password_success: "Si un compte existe pour ce courriel, un lien de réinitialisation a été envoyé.",
113
+ forgot_password_title: "Réinitialiser le mot de passe",
103
114
  oauth_client_no_auth_methods: "Aucune méthode d'authentification n'est activée pour cette application.",
104
115
  reset_password_description: "Saisissez un nouveau mot de passe pour votre compte.",
105
116
  reset_password_error: "Impossible de réinitialiser le mot de passe.",
@@ -377,7 +388,7 @@ export function Signin(props) {
377
388
  method: selectedAuthMethod,
378
389
  otpSent: Boolean(otpSentTo),
379
390
  });
380
- }, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/forgot-password", search: searchObject(searchString), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
391
+ }, children: [!emailSubmitted ? (_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true })) : null, emailSubmitted && selectedAuthMethod === "password" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.password, { label: m.field_password, type: "password", autoComplete: "current-password", required: true }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [_jsx(Link, { className: authLinkClassName, to: "/reset-password", search: searchObject(searchString), children: m.sign_in_forgot_password }), canChangeAuthMethod ? (_jsxs(Button, { type: "button", variant: "link", className: "h-auto px-0", onClick: switchAuthMethod, children: [_jsx(Mail, {}), m.sign_in_use_email_otp] })) : null] })] })) : null, emailSubmitted && selectedAuthMethod === "emailOtp" ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(form.otp, { label: m.sign_in_email_otp_code }), _jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm", children: [otpSentTo ? (_jsx(Button, { type: "button", variant: "link", className: "h-auto px-0", disabled: emailOtpResendSeconds > 0, onClick: resendEmailOtp, children: emailOtpResendSeconds > 0
381
392
  ? text(m.sign_in_email_otp_resend_countdown, {
382
393
  seconds: String(emailOtpResendSeconds),
383
394
  })
@@ -508,21 +519,54 @@ export function VerifyEmail(props) {
508
519
  submit("verify");
509
520
  }, children: [_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(form.otp, { label: m.verify_email_code }), _jsx(SubmitError, { result: submitResult }), resent ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.verify_email_resent })) : null, _jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, effectFormMessages().submit] }), _jsx(Button, { type: "button", variant: "ghost", disabled: submitResult.waiting, onClick: resendCode, children: m.verify_email_resend })] })] }) }), _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsx(Link, { className: authLinkClassName, to: "/sign-in", children: m.forgot_password_back_to_sign_in }) })] })] }));
510
521
  }
511
- export function ResetPassword(props) {
522
+ export function ForgotPassword(props) {
512
523
  const { authClient, labels: m } = useAuthFormOptions(props);
513
- const navigate = useNavigate();
514
524
  const searchString = useRouterState({
515
525
  select: (state) => state.location.searchStr,
516
526
  });
517
- const token = getSearchParam(searchString, "token") ?? "";
527
+ const [submitted, setSubmitted] = useState(false);
528
+ const [form] = useState(() => FormReact.make(forgotPasswordFormBuilder, {
529
+ fields: { email: TextField },
530
+ mode: { validation: "onSubmit" },
531
+ onSubmit: (_, { decoded: value }) => Effect.tryPromise({
532
+ try: async () => {
533
+ setSubmitted(false);
534
+ const result = await authClient.requestPasswordReset({
535
+ email: value.email.trim(),
536
+ redirectTo: `${window.location.origin}/reset-password`,
537
+ });
538
+ if (result.error) {
539
+ throw new Error(result.error.message ?? m.forgot_password_error);
540
+ }
541
+ setSubmitted(true);
542
+ },
543
+ catch: (cause) => cause instanceof Error ? cause : new Error(m.forgot_password_error),
544
+ }),
545
+ }));
546
+ const submit = useAtomSet(form.submit);
547
+ const submitResult = useAtomValue(form.submit);
548
+ return (_jsxs(Card, { className: "w-full max-w-md", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-3xl", children: m.forgot_password_title }), _jsx(CardDescription, { children: m.forgot_password_description })] }), _jsxs(CardContent, { children: [_jsx(form.Initialize, { defaultValues: { email: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
549
+ event.preventDefault();
550
+ event.stopPropagation();
551
+ submit();
552
+ }, children: [_jsx(form.email, { label: m.field_email, type: "email", autoComplete: "email", required: true }), _jsx(SubmitError, { result: submitResult }), submitted ? (_jsx("p", { className: "bg-card text-card-foreground rounded-lg border px-4 py-3 text-sm shadow-xs", children: m.forgot_password_success })) : null, _jsxs(Button, { type: "submit", disabled: submitResult.waiting, children: [submitResult.waiting ? (_jsx(Loader2, { className: "animate-spin", "data-icon": "inline-start" })) : null, m.forgot_password_submit] })] }) }), _jsx("p", { className: "text-muted-foreground mt-6 text-center text-sm", children: _jsx(Link, { className: authLinkClassName, to: "/sign-in", search: searchObject(searchString), children: m.forgot_password_back_to_sign_in }) })] })] }));
553
+ }
554
+ export function ResetPassword(props) {
555
+ const searchString = useRouterState({
556
+ select: (state) => state.location.searchStr,
557
+ });
558
+ const token = getSearchParam(searchString, "token");
559
+ return token ? (_jsx(ResetPasswordForm, { ...props, token: token })) : (_jsx(ForgotPassword, { ...props }));
560
+ }
561
+ function ResetPasswordForm({ token, ...props }) {
562
+ const { authClient, labels: m } = useAuthFormOptions(props);
563
+ const navigate = useNavigate();
518
564
  const onSuccess = () => navigate({ to: "/sign-in" });
519
565
  const [form] = useState(() => FormReact.make(resetPasswordFormBuilder, {
520
566
  fields: { password: TextField },
521
567
  mode: { validation: "onSubmit" },
522
568
  onSubmit: (_, { decoded: value }) => Effect.tryPromise({
523
569
  try: async () => {
524
- if (!token)
525
- throw new Error(m.reset_password_missing_token);
526
570
  const result = await authClient.resetPassword({
527
571
  newPassword: value.password,
528
572
  token,