@krak-stack/auth 0.1.71 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/access.d.ts +5 -7
- package/dist/access.js +11 -7
- package/dist/admin/api.group.d.ts +53 -53
- package/dist/admin/api.group.js +15 -15
- package/dist/admin/schema.d.ts +18 -18
- package/dist/admin/schema.js +3 -3
- package/dist/api.d.ts +1995 -533
- package/dist/api.js +7 -7
- package/dist/auth/api.group.d.ts +793 -0
- package/dist/auth/api.group.js +241 -0
- package/dist/auth/schema.d.ts +808 -0
- package/dist/auth/schema.js +628 -0
- package/dist/components/admin-organization-form.d.ts +1 -1
- package/dist/components/admin-organization-form.js +17 -18
- package/dist/components/admin-organizations.d.ts +4 -5
- package/dist/components/admin-organizations.js +83 -73
- package/dist/components/admin-users.d.ts +5 -6
- package/dist/components/admin-users.js +160 -181
- package/dist/components/api-key-edit-form.d.ts +4 -3
- package/dist/components/api-key-edit-form.js +33 -27
- package/dist/components/api-key-permissions.d.ts +1 -1
- package/dist/components/api-key-rate-limit.d.ts +1 -1
- package/dist/components/api-key-referrers.d.ts +3 -2
- package/dist/components/api-key-referrers.js +2 -3
- package/dist/components/api-key.d.ts +0 -9
- package/dist/components/api-key.js +0 -39
- package/dist/components/auth-atoms.d.ts +178 -0
- package/dist/components/auth-atoms.js +46 -0
- package/dist/components/auth-client-api.d.ts +1371 -556
- package/dist/components/auth-client-api.js +22 -14
- package/dist/components/auth-forms.d.ts +1 -3
- package/dist/components/auth-forms.js +173 -195
- package/dist/components/auth-provider.d.ts +16 -20
- package/dist/components/auth-provider.js +56 -30
- package/dist/components/has-permission.js +1 -1
- package/dist/components/index.d.ts +19 -20
- package/dist/components/index.js +13 -13
- package/dist/components/member-required.d.ts +1 -3
- package/dist/components/member-required.js +102 -78
- package/dist/components/organization-switcher.d.ts +4 -6
- package/dist/components/organization-switcher.js +539 -390
- package/dist/components/project-access-matrix.d.ts +1 -1
- package/dist/components/project-access-matrix.js +9 -13
- package/dist/components/user-button.d.ts +5 -3
- package/dist/components/user-button.js +291 -336
- package/dist/components/utils.d.ts +3 -1
- package/dist/components/utils.js +4 -11
- package/dist/extra/api.group.d.ts +22 -22
- package/dist/extra/api.group.js +9 -9
- package/dist/extra/schema.d.ts +1 -2
- package/dist/extra/schema.js +2 -3
- package/dist/index.d.ts +11 -12
- package/dist/index.js +11 -12
- package/dist/query.d.ts +2 -2
- package/dist/query.js +5 -5
- package/dist/roles.d.ts +5 -4
- package/dist/roles.js +11 -7
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +26 -19
- package/dist/server/actor.d.ts +20 -22
- package/dist/server/actor.js +14 -17
- package/dist/server/api.group.d.ts +29 -29
- package/dist/server/api.group.js +14 -14
- package/dist/server/index.d.ts +14 -14
- package/dist/server/index.js +8 -8
- package/dist/server/middleware.d.ts +1 -1
- package/dist/server/middleware.js +1 -1
- package/dist/server/schema.js +1 -1
- package/dist/service.d.ts +1997 -583
- package/dist/service.js +23 -16
- package/package.json +10 -9
- package/dist/better-auth/api.group.d.ts +0 -62
- package/dist/better-auth/api.group.js +0 -39
- package/dist/better-auth/schema.d.ts +0 -72
- package/dist/better-auth/schema.js +0 -110
- package/dist/components/auth-client.d.ts +0 -50
- package/dist/components/auth-client.js +0 -46
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
const JsonRecord = Schema.Record(Schema.String, Schema.Json);
|
|
3
|
+
const StringArrayRecord = Schema.Record(Schema.String, Schema.Array(Schema.String));
|
|
4
|
+
export const AuthUser = Schema.Struct({
|
|
5
|
+
id: Schema.String,
|
|
6
|
+
name: Schema.String,
|
|
7
|
+
email: Schema.String,
|
|
8
|
+
emailVerified: Schema.Boolean,
|
|
9
|
+
image: Schema.NullOr(Schema.String),
|
|
10
|
+
role: Schema.NullOr(Schema.String),
|
|
11
|
+
banned: Schema.NullOr(Schema.Boolean),
|
|
12
|
+
banReason: Schema.optional(Schema.NullOr(Schema.String)),
|
|
13
|
+
banExpires: Schema.optional(Schema.NullOr(Schema.DateFromString)),
|
|
14
|
+
twoFactorEnabled: Schema.optional(Schema.Boolean),
|
|
15
|
+
lastLoginMethod: Schema.optional(Schema.NullOr(Schema.String)),
|
|
16
|
+
createdAt: Schema.DateFromString,
|
|
17
|
+
updatedAt: Schema.DateFromString,
|
|
18
|
+
}).annotate({
|
|
19
|
+
identifier: "AuthUser",
|
|
20
|
+
title: "Auth user",
|
|
21
|
+
description: "User record returned by the authentication service.",
|
|
22
|
+
});
|
|
23
|
+
export const AuthSession = Schema.Struct({
|
|
24
|
+
id: Schema.String,
|
|
25
|
+
expiresAt: Schema.DateFromString,
|
|
26
|
+
token: Schema.String,
|
|
27
|
+
createdAt: Schema.DateFromString,
|
|
28
|
+
updatedAt: Schema.DateFromString,
|
|
29
|
+
ipAddress: Schema.optional(Schema.NullOr(Schema.String)),
|
|
30
|
+
userAgent: Schema.optional(Schema.NullOr(Schema.String)),
|
|
31
|
+
userId: Schema.String,
|
|
32
|
+
impersonatedBy: Schema.optional(Schema.NullOr(Schema.String)),
|
|
33
|
+
impersonatedByOrganizationId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
34
|
+
activeOrganizationId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
35
|
+
}).annotate({
|
|
36
|
+
identifier: "AuthSession",
|
|
37
|
+
title: "Auth session",
|
|
38
|
+
description: "Browser authentication session.",
|
|
39
|
+
});
|
|
40
|
+
export const AuthSessionResponse = Schema.Struct({
|
|
41
|
+
session: AuthSession,
|
|
42
|
+
user: AuthUser,
|
|
43
|
+
}).annotate({
|
|
44
|
+
identifier: "AuthSessionResponse",
|
|
45
|
+
title: "Auth session response",
|
|
46
|
+
});
|
|
47
|
+
export const GetSessionResponse = Schema.NullOr(AuthSessionResponse).annotate({
|
|
48
|
+
identifier: "GetSessionResponse",
|
|
49
|
+
title: "Get session response",
|
|
50
|
+
description: "Current session and user, or null when signed out.",
|
|
51
|
+
});
|
|
52
|
+
export const GetSessionQuery = Schema.Struct({
|
|
53
|
+
disableCookieCache: Schema.optional(Schema.String),
|
|
54
|
+
disableRefresh: Schema.optional(Schema.String),
|
|
55
|
+
}).annotate({
|
|
56
|
+
identifier: "GetSessionQuery",
|
|
57
|
+
title: "Get session query",
|
|
58
|
+
});
|
|
59
|
+
export const AuthStatusResponse = Schema.Struct({
|
|
60
|
+
status: Schema.Boolean,
|
|
61
|
+
}).annotate({ identifier: "AuthStatusResponse", title: "Status response" });
|
|
62
|
+
export const AuthSuccessResponse = Schema.Struct({
|
|
63
|
+
success: Schema.Boolean,
|
|
64
|
+
}).annotate({ identifier: "AuthSuccessResponse", title: "Success response" });
|
|
65
|
+
export const AuthErrorBody = Schema.Struct({
|
|
66
|
+
code: Schema.optional(Schema.String),
|
|
67
|
+
message: Schema.optional(Schema.String),
|
|
68
|
+
error: Schema.optional(Schema.String),
|
|
69
|
+
error_description: Schema.optional(Schema.String),
|
|
70
|
+
}).annotate({
|
|
71
|
+
identifier: "AuthErrorBody",
|
|
72
|
+
title: "Auth error",
|
|
73
|
+
description: "Wire error returned by an authentication endpoint.",
|
|
74
|
+
});
|
|
75
|
+
const authErrorFields = (tag) => ({
|
|
76
|
+
_tag: Schema.tagDefaultOmit(tag),
|
|
77
|
+
...AuthErrorBody.fields,
|
|
78
|
+
});
|
|
79
|
+
export class AuthBadRequest extends Schema.TaggedError()("AuthBadRequest", authErrorFields("AuthBadRequest"), {
|
|
80
|
+
identifier: "AuthBadRequest",
|
|
81
|
+
title: "Bad request",
|
|
82
|
+
httpApiStatus: 400,
|
|
83
|
+
}) {
|
|
84
|
+
}
|
|
85
|
+
export class AuthUnauthorized extends Schema.TaggedError()("AuthUnauthorized", authErrorFields("AuthUnauthorized"), {
|
|
86
|
+
identifier: "AuthUnauthorized",
|
|
87
|
+
title: "Unauthorized",
|
|
88
|
+
httpApiStatus: 401,
|
|
89
|
+
}) {
|
|
90
|
+
}
|
|
91
|
+
export class AuthForbidden extends Schema.TaggedError()("AuthForbidden", authErrorFields("AuthForbidden"), {
|
|
92
|
+
identifier: "AuthForbidden",
|
|
93
|
+
title: "Forbidden",
|
|
94
|
+
httpApiStatus: 403,
|
|
95
|
+
}) {
|
|
96
|
+
}
|
|
97
|
+
export class AuthNotFound extends Schema.TaggedError()("AuthNotFound", authErrorFields("AuthNotFound"), {
|
|
98
|
+
identifier: "AuthNotFound",
|
|
99
|
+
title: "Not found",
|
|
100
|
+
httpApiStatus: 404,
|
|
101
|
+
}) {
|
|
102
|
+
}
|
|
103
|
+
export class AuthConflict extends Schema.TaggedError()("AuthConflict", authErrorFields("AuthConflict"), {
|
|
104
|
+
identifier: "AuthConflict",
|
|
105
|
+
title: "Conflict",
|
|
106
|
+
httpApiStatus: 409,
|
|
107
|
+
}) {
|
|
108
|
+
}
|
|
109
|
+
export class AuthExpectationFailed extends Schema.TaggedError()("AuthExpectationFailed", authErrorFields("AuthExpectationFailed"), {
|
|
110
|
+
identifier: "AuthExpectationFailed",
|
|
111
|
+
title: "Expectation failed",
|
|
112
|
+
httpApiStatus: 417,
|
|
113
|
+
}) {
|
|
114
|
+
}
|
|
115
|
+
export class AuthTooManyRequests extends Schema.TaggedError()("AuthTooManyRequests", authErrorFields("AuthTooManyRequests"), {
|
|
116
|
+
identifier: "AuthTooManyRequests",
|
|
117
|
+
title: "Too many requests",
|
|
118
|
+
httpApiStatus: 429,
|
|
119
|
+
}) {
|
|
120
|
+
}
|
|
121
|
+
export class AuthInternalServerError extends Schema.TaggedError()("AuthInternalServerError", authErrorFields("AuthInternalServerError"), {
|
|
122
|
+
identifier: "AuthInternalServerError",
|
|
123
|
+
title: "Internal server error",
|
|
124
|
+
httpApiStatus: 500,
|
|
125
|
+
}) {
|
|
126
|
+
}
|
|
127
|
+
export const UpdateUserPayload = Schema.Struct({
|
|
128
|
+
name: Schema.optional(Schema.String),
|
|
129
|
+
image: Schema.optional(Schema.NullOr(Schema.String)),
|
|
130
|
+
}).annotate({ identifier: "UpdateUserPayload", title: "Update user payload" });
|
|
131
|
+
export const SignInEmailPayload = Schema.Struct({
|
|
132
|
+
email: Schema.String,
|
|
133
|
+
password: Schema.String,
|
|
134
|
+
callbackURL: Schema.optional(Schema.String),
|
|
135
|
+
rememberMe: Schema.optional(Schema.Boolean),
|
|
136
|
+
oauth_query: Schema.optional(Schema.String),
|
|
137
|
+
}).annotate({
|
|
138
|
+
identifier: "SignInEmailPayload",
|
|
139
|
+
title: "Email sign-in payload",
|
|
140
|
+
});
|
|
141
|
+
export const SignInEmailResponse = Schema.Union([
|
|
142
|
+
Schema.Struct({
|
|
143
|
+
redirect: Schema.Boolean,
|
|
144
|
+
token: Schema.String,
|
|
145
|
+
url: Schema.optional(Schema.NullOr(Schema.String)),
|
|
146
|
+
user: AuthUser,
|
|
147
|
+
}),
|
|
148
|
+
Schema.Struct({
|
|
149
|
+
twoFactorRedirect: Schema.Literal(true),
|
|
150
|
+
twoFactorMethods: Schema.Array(Schema.String),
|
|
151
|
+
url: Schema.optional(Schema.NullOr(Schema.String)),
|
|
152
|
+
}),
|
|
153
|
+
]).annotate({
|
|
154
|
+
identifier: "SignInEmailResponse",
|
|
155
|
+
title: "Email sign-in response",
|
|
156
|
+
});
|
|
157
|
+
export const SignInEmailOtpPayload = Schema.Struct({
|
|
158
|
+
email: Schema.String,
|
|
159
|
+
otp: Schema.String,
|
|
160
|
+
name: Schema.optional(Schema.String),
|
|
161
|
+
image: Schema.optional(Schema.String),
|
|
162
|
+
}).annotate({
|
|
163
|
+
identifier: "SignInEmailOtpPayload",
|
|
164
|
+
title: "Email OTP sign-in payload",
|
|
165
|
+
});
|
|
166
|
+
export const SignInResponse = Schema.Struct({
|
|
167
|
+
token: Schema.optional(Schema.String),
|
|
168
|
+
user: AuthUser,
|
|
169
|
+
}).annotate({ identifier: "SignInResponse", title: "Sign-in response" });
|
|
170
|
+
export const SocialIdToken = Schema.Struct({
|
|
171
|
+
token: Schema.String,
|
|
172
|
+
nonce: Schema.optional(Schema.String),
|
|
173
|
+
accessToken: Schema.optional(Schema.String),
|
|
174
|
+
refreshToken: Schema.optional(Schema.String),
|
|
175
|
+
expiresAt: Schema.optional(Schema.Number),
|
|
176
|
+
user: Schema.optional(Schema.Struct({
|
|
177
|
+
name: Schema.optional(Schema.Struct({
|
|
178
|
+
firstName: Schema.optional(Schema.String),
|
|
179
|
+
lastName: Schema.optional(Schema.String),
|
|
180
|
+
})),
|
|
181
|
+
email: Schema.optional(Schema.String),
|
|
182
|
+
})),
|
|
183
|
+
}).annotate({ identifier: "SocialIdToken", title: "Social identity token" });
|
|
184
|
+
export const SignInSocialPayload = Schema.Struct({
|
|
185
|
+
callbackURL: Schema.optional(Schema.String),
|
|
186
|
+
newUserCallbackURL: Schema.optional(Schema.String),
|
|
187
|
+
errorCallbackURL: Schema.optional(Schema.String),
|
|
188
|
+
provider: Schema.String,
|
|
189
|
+
disableRedirect: Schema.optional(Schema.Boolean),
|
|
190
|
+
idToken: Schema.optional(SocialIdToken),
|
|
191
|
+
scopes: Schema.optional(Schema.Array(Schema.String)),
|
|
192
|
+
requestSignUp: Schema.optional(Schema.Boolean),
|
|
193
|
+
loginHint: Schema.optional(Schema.String),
|
|
194
|
+
additionalData: Schema.optional(JsonRecord),
|
|
195
|
+
oauth_query: Schema.optional(Schema.String),
|
|
196
|
+
}).annotate({
|
|
197
|
+
identifier: "SignInSocialPayload",
|
|
198
|
+
title: "Social sign-in payload",
|
|
199
|
+
});
|
|
200
|
+
export const SocialRedirectResponse = Schema.Struct({
|
|
201
|
+
url: Schema.optional(Schema.String),
|
|
202
|
+
redirect: Schema.Boolean,
|
|
203
|
+
token: Schema.optional(Schema.String),
|
|
204
|
+
user: Schema.optional(AuthUser),
|
|
205
|
+
status: Schema.optional(Schema.Boolean),
|
|
206
|
+
}).annotate({
|
|
207
|
+
identifier: "SocialRedirectResponse",
|
|
208
|
+
title: "Social redirect response",
|
|
209
|
+
});
|
|
210
|
+
export const SendVerificationOtpPayload = Schema.Struct({
|
|
211
|
+
email: Schema.String,
|
|
212
|
+
type: Schema.Literals(["sign-in", "email-verification", "forget-password"]),
|
|
213
|
+
}).annotate({
|
|
214
|
+
identifier: "SendVerificationOtpPayload",
|
|
215
|
+
title: "Send verification OTP payload",
|
|
216
|
+
});
|
|
217
|
+
export const VerifyEmailOtpPayload = Schema.Struct({
|
|
218
|
+
email: Schema.String,
|
|
219
|
+
otp: Schema.String,
|
|
220
|
+
}).annotate({
|
|
221
|
+
identifier: "VerifyEmailOtpPayload",
|
|
222
|
+
title: "Verify email OTP payload",
|
|
223
|
+
});
|
|
224
|
+
export const VerifyEmailOtpResponse = Schema.Struct({
|
|
225
|
+
status: Schema.Literal(true),
|
|
226
|
+
token: Schema.NullOr(Schema.String),
|
|
227
|
+
user: AuthUser,
|
|
228
|
+
}).annotate({
|
|
229
|
+
identifier: "VerifyEmailOtpResponse",
|
|
230
|
+
title: "Verify email OTP response",
|
|
231
|
+
});
|
|
232
|
+
export const RequestPasswordResetPayload = Schema.Struct({
|
|
233
|
+
email: Schema.String,
|
|
234
|
+
redirectTo: Schema.optional(Schema.String),
|
|
235
|
+
}).annotate({
|
|
236
|
+
identifier: "RequestPasswordResetPayload",
|
|
237
|
+
title: "Request password reset payload",
|
|
238
|
+
});
|
|
239
|
+
export const RequestPasswordResetResponse = Schema.Struct({
|
|
240
|
+
status: Schema.Boolean,
|
|
241
|
+
message: Schema.String,
|
|
242
|
+
}).annotate({
|
|
243
|
+
identifier: "RequestPasswordResetResponse",
|
|
244
|
+
title: "Request password reset response",
|
|
245
|
+
});
|
|
246
|
+
export const ResetPasswordPayload = Schema.Struct({
|
|
247
|
+
newPassword: Schema.String,
|
|
248
|
+
token: Schema.optional(Schema.String),
|
|
249
|
+
}).annotate({
|
|
250
|
+
identifier: "ResetPasswordPayload",
|
|
251
|
+
title: "Reset password payload",
|
|
252
|
+
});
|
|
253
|
+
export const ChangePasswordPayload = Schema.Struct({
|
|
254
|
+
newPassword: Schema.String,
|
|
255
|
+
currentPassword: Schema.String,
|
|
256
|
+
revokeOtherSessions: Schema.optional(Schema.Boolean),
|
|
257
|
+
}).annotate({
|
|
258
|
+
identifier: "ChangePasswordPayload",
|
|
259
|
+
title: "Change password payload",
|
|
260
|
+
});
|
|
261
|
+
export const ChangePasswordResponse = Schema.Struct({
|
|
262
|
+
token: Schema.optional(Schema.NullOr(Schema.String)),
|
|
263
|
+
user: AuthUser,
|
|
264
|
+
}).annotate({
|
|
265
|
+
identifier: "ChangePasswordResponse",
|
|
266
|
+
title: "Change password response",
|
|
267
|
+
});
|
|
268
|
+
export const LinkedAccount = Schema.Struct({
|
|
269
|
+
id: Schema.String,
|
|
270
|
+
providerId: Schema.String,
|
|
271
|
+
createdAt: Schema.DateFromString,
|
|
272
|
+
updatedAt: Schema.DateFromString,
|
|
273
|
+
accountId: Schema.String,
|
|
274
|
+
userId: Schema.String,
|
|
275
|
+
scopes: Schema.Array(Schema.String),
|
|
276
|
+
}).annotate({ identifier: "LinkedAccount", title: "Linked account" });
|
|
277
|
+
export const LinkSocialPayload = Schema.Struct({
|
|
278
|
+
callbackURL: Schema.optional(Schema.String),
|
|
279
|
+
provider: Schema.String,
|
|
280
|
+
idToken: Schema.optional(Schema.Struct({
|
|
281
|
+
token: Schema.String,
|
|
282
|
+
nonce: Schema.optional(Schema.String),
|
|
283
|
+
accessToken: Schema.optional(Schema.String),
|
|
284
|
+
refreshToken: Schema.optional(Schema.String),
|
|
285
|
+
scopes: Schema.optional(Schema.Array(Schema.String)),
|
|
286
|
+
})),
|
|
287
|
+
requestSignUp: Schema.optional(Schema.Boolean),
|
|
288
|
+
scopes: Schema.optional(Schema.Array(Schema.String)),
|
|
289
|
+
errorCallbackURL: Schema.optional(Schema.String),
|
|
290
|
+
disableRedirect: Schema.optional(Schema.Boolean),
|
|
291
|
+
additionalData: Schema.optional(JsonRecord),
|
|
292
|
+
}).annotate({ identifier: "LinkSocialPayload", title: "Link social payload" });
|
|
293
|
+
export const UnlinkAccountPayload = Schema.Struct({
|
|
294
|
+
providerId: Schema.String,
|
|
295
|
+
accountId: Schema.optional(Schema.String),
|
|
296
|
+
}).annotate({
|
|
297
|
+
identifier: "UnlinkAccountPayload",
|
|
298
|
+
title: "Unlink account payload",
|
|
299
|
+
});
|
|
300
|
+
export const TwoFactorSendPayload = Schema.Struct({
|
|
301
|
+
trustDevice: Schema.optional(Schema.Boolean),
|
|
302
|
+
}).annotate({
|
|
303
|
+
identifier: "TwoFactorSendPayload",
|
|
304
|
+
title: "Two-factor send payload",
|
|
305
|
+
});
|
|
306
|
+
export const TwoFactorVerifyPayload = Schema.Struct({
|
|
307
|
+
code: Schema.String,
|
|
308
|
+
trustDevice: Schema.optional(Schema.Boolean),
|
|
309
|
+
oauth_query: Schema.optional(Schema.String),
|
|
310
|
+
}).annotate({
|
|
311
|
+
identifier: "TwoFactorVerifyPayload",
|
|
312
|
+
title: "Two-factor verification payload",
|
|
313
|
+
});
|
|
314
|
+
export const TwoFactorBackupVerifyPayload = Schema.Struct({
|
|
315
|
+
code: Schema.String,
|
|
316
|
+
disableSession: Schema.optional(Schema.Boolean),
|
|
317
|
+
trustDevice: Schema.optional(Schema.Boolean),
|
|
318
|
+
oauth_query: Schema.optional(Schema.String),
|
|
319
|
+
}).annotate({
|
|
320
|
+
identifier: "TwoFactorBackupVerifyPayload",
|
|
321
|
+
title: "Two-factor backup verification payload",
|
|
322
|
+
});
|
|
323
|
+
export const TwoFactorEnablePayload = Schema.Struct({
|
|
324
|
+
password: Schema.optional(Schema.String),
|
|
325
|
+
issuer: Schema.optional(Schema.String),
|
|
326
|
+
}).annotate({
|
|
327
|
+
identifier: "TwoFactorEnablePayload",
|
|
328
|
+
title: "Enable two-factor payload",
|
|
329
|
+
});
|
|
330
|
+
export const TwoFactorEnableResponse = Schema.Struct({
|
|
331
|
+
totpURI: Schema.String,
|
|
332
|
+
backupCodes: Schema.Array(Schema.String),
|
|
333
|
+
}).annotate({
|
|
334
|
+
identifier: "TwoFactorEnableResponse",
|
|
335
|
+
title: "Enable two-factor response",
|
|
336
|
+
});
|
|
337
|
+
export const TwoFactorDisablePayload = Schema.Struct({
|
|
338
|
+
password: Schema.optional(Schema.String),
|
|
339
|
+
}).annotate({
|
|
340
|
+
identifier: "TwoFactorDisablePayload",
|
|
341
|
+
title: "Disable two-factor payload",
|
|
342
|
+
});
|
|
343
|
+
export const AuthOrganization = Schema.Struct({
|
|
344
|
+
id: Schema.String,
|
|
345
|
+
name: Schema.String,
|
|
346
|
+
slug: Schema.String,
|
|
347
|
+
logo: Schema.optional(Schema.NullOr(Schema.String)),
|
|
348
|
+
metadata: Schema.optional(Schema.NullOr(Schema.Union([JsonRecord, Schema.String]))),
|
|
349
|
+
userId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
350
|
+
parentId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
351
|
+
createdAt: Schema.DateFromString,
|
|
352
|
+
}).annotate({
|
|
353
|
+
identifier: "AuthOrganization",
|
|
354
|
+
title: "Auth organization",
|
|
355
|
+
});
|
|
356
|
+
export const AuthMemberRecord = Schema.Struct({
|
|
357
|
+
id: Schema.String,
|
|
358
|
+
organizationId: Schema.String,
|
|
359
|
+
userId: Schema.String,
|
|
360
|
+
role: Schema.String,
|
|
361
|
+
createdAt: Schema.DateFromString,
|
|
362
|
+
}).annotate({
|
|
363
|
+
identifier: "AuthMemberRecord",
|
|
364
|
+
title: "Organization member record",
|
|
365
|
+
});
|
|
366
|
+
export const AuthMember = Schema.Struct({
|
|
367
|
+
...AuthMemberRecord.fields,
|
|
368
|
+
user: AuthUser,
|
|
369
|
+
}).annotate({ identifier: "AuthMember", title: "Organization member" });
|
|
370
|
+
export const AuthInvitation = Schema.Struct({
|
|
371
|
+
id: Schema.String,
|
|
372
|
+
email: Schema.String,
|
|
373
|
+
role: Schema.String,
|
|
374
|
+
organizationId: Schema.String,
|
|
375
|
+
organizationName: Schema.optional(Schema.NullOr(Schema.String)),
|
|
376
|
+
inviterId: Schema.String,
|
|
377
|
+
teamId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
378
|
+
status: Schema.String,
|
|
379
|
+
expiresAt: Schema.DateFromString,
|
|
380
|
+
createdAt: Schema.optional(Schema.DateFromString),
|
|
381
|
+
}).annotate({ identifier: "AuthInvitation", title: "Organization invitation" });
|
|
382
|
+
export const FullAuthOrganization = Schema.Struct({
|
|
383
|
+
...AuthOrganization.fields,
|
|
384
|
+
members: Schema.Array(AuthMember),
|
|
385
|
+
invitations: Schema.Array(AuthInvitation),
|
|
386
|
+
}).annotate({
|
|
387
|
+
identifier: "FullAuthOrganization",
|
|
388
|
+
title: "Full auth organization",
|
|
389
|
+
});
|
|
390
|
+
export const GetFullOrganizationQuery = Schema.Struct({
|
|
391
|
+
organizationId: Schema.optional(Schema.String),
|
|
392
|
+
organizationSlug: Schema.optional(Schema.String),
|
|
393
|
+
membersLimit: Schema.optional(Schema.NumberFromString),
|
|
394
|
+
}).annotate({
|
|
395
|
+
identifier: "GetFullOrganizationQuery",
|
|
396
|
+
title: "Get full organization query",
|
|
397
|
+
});
|
|
398
|
+
export const SetActiveOrganizationPayload = Schema.Struct({
|
|
399
|
+
organizationId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
400
|
+
organizationSlug: Schema.optional(Schema.String),
|
|
401
|
+
}).annotate({
|
|
402
|
+
identifier: "SetActiveOrganizationPayload",
|
|
403
|
+
title: "Set active organization payload",
|
|
404
|
+
});
|
|
405
|
+
export const CreateOrganizationPayload = Schema.Struct({
|
|
406
|
+
name: Schema.NonEmptyString,
|
|
407
|
+
slug: Schema.NonEmptyString,
|
|
408
|
+
logo: Schema.optional(Schema.NullOr(Schema.String)),
|
|
409
|
+
metadata: Schema.optional(JsonRecord),
|
|
410
|
+
parentId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
411
|
+
keepCurrentActiveOrganization: Schema.optional(Schema.Boolean),
|
|
412
|
+
}).annotate({
|
|
413
|
+
identifier: "CreateOrganizationPayload",
|
|
414
|
+
title: "Create organization payload",
|
|
415
|
+
});
|
|
416
|
+
export const UpdateOrganizationPayload = Schema.Struct({
|
|
417
|
+
organizationId: Schema.optional(Schema.String),
|
|
418
|
+
data: Schema.Struct({
|
|
419
|
+
name: Schema.optional(Schema.NonEmptyString),
|
|
420
|
+
slug: Schema.optional(Schema.NonEmptyString),
|
|
421
|
+
logo: Schema.optional(Schema.NullOr(Schema.String)),
|
|
422
|
+
metadata: Schema.optional(JsonRecord),
|
|
423
|
+
parentId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
424
|
+
}),
|
|
425
|
+
}).annotate({
|
|
426
|
+
identifier: "UpdateOrganizationPayload",
|
|
427
|
+
title: "Update organization payload",
|
|
428
|
+
});
|
|
429
|
+
export const OrganizationListMembersQuery = Schema.Struct({
|
|
430
|
+
limit: Schema.optional(Schema.NumberFromString),
|
|
431
|
+
offset: Schema.optional(Schema.NumberFromString),
|
|
432
|
+
sortBy: Schema.optional(Schema.String),
|
|
433
|
+
sortDirection: Schema.optional(Schema.Literals(["asc", "desc"])),
|
|
434
|
+
filterField: Schema.optional(Schema.String),
|
|
435
|
+
filterValue: Schema.optional(Schema.String),
|
|
436
|
+
filterOperator: Schema.optional(Schema.String),
|
|
437
|
+
organizationId: Schema.optional(Schema.String),
|
|
438
|
+
organizationSlug: Schema.optional(Schema.String),
|
|
439
|
+
}).annotate({
|
|
440
|
+
identifier: "OrganizationListMembersQuery",
|
|
441
|
+
title: "List organization members query",
|
|
442
|
+
});
|
|
443
|
+
export const OrganizationListMembersResponse = Schema.Struct({
|
|
444
|
+
members: Schema.Array(AuthMember),
|
|
445
|
+
total: Schema.Number,
|
|
446
|
+
}).annotate({
|
|
447
|
+
identifier: "OrganizationListMembersResponse",
|
|
448
|
+
title: "List organization members response",
|
|
449
|
+
});
|
|
450
|
+
export const InviteMemberPayload = Schema.Struct({
|
|
451
|
+
email: Schema.String,
|
|
452
|
+
role: Schema.Union([Schema.String, Schema.Array(Schema.String)]),
|
|
453
|
+
organizationId: Schema.optional(Schema.String),
|
|
454
|
+
resend: Schema.optional(Schema.Boolean),
|
|
455
|
+
teamId: Schema.optional(Schema.Union([Schema.String, Schema.Array(Schema.String)])),
|
|
456
|
+
}).annotate({
|
|
457
|
+
identifier: "InviteMemberPayload",
|
|
458
|
+
title: "Invite member payload",
|
|
459
|
+
});
|
|
460
|
+
export const UpdateMemberRolePayload = Schema.Struct({
|
|
461
|
+
role: Schema.Union([Schema.String, Schema.Array(Schema.String)]),
|
|
462
|
+
memberId: Schema.String,
|
|
463
|
+
organizationId: Schema.optional(Schema.String),
|
|
464
|
+
}).annotate({
|
|
465
|
+
identifier: "UpdateMemberRolePayload",
|
|
466
|
+
title: "Update member role payload",
|
|
467
|
+
});
|
|
468
|
+
export const RemoveMemberPayload = Schema.Struct({
|
|
469
|
+
memberIdOrEmail: Schema.String,
|
|
470
|
+
organizationId: Schema.optional(Schema.String),
|
|
471
|
+
}).annotate({
|
|
472
|
+
identifier: "RemoveMemberPayload",
|
|
473
|
+
title: "Remove member payload",
|
|
474
|
+
});
|
|
475
|
+
export const LeaveOrganizationPayload = Schema.Struct({
|
|
476
|
+
organizationId: Schema.String,
|
|
477
|
+
}).annotate({
|
|
478
|
+
identifier: "LeaveOrganizationPayload",
|
|
479
|
+
title: "Leave organization payload",
|
|
480
|
+
});
|
|
481
|
+
export const MemberResponse = Schema.Struct({
|
|
482
|
+
member: AuthMemberRecord,
|
|
483
|
+
}).annotate({ identifier: "MemberResponse", title: "Member response" });
|
|
484
|
+
export const OrganizationInvitationsQuery = Schema.Struct({
|
|
485
|
+
organizationId: Schema.optional(Schema.String),
|
|
486
|
+
}).annotate({
|
|
487
|
+
identifier: "OrganizationInvitationsQuery",
|
|
488
|
+
title: "Organization invitations query",
|
|
489
|
+
});
|
|
490
|
+
export const UserInvitationsQuery = Schema.Struct({}).annotate({
|
|
491
|
+
identifier: "UserInvitationsQuery",
|
|
492
|
+
title: "User invitations query",
|
|
493
|
+
});
|
|
494
|
+
export const InvitationIdPayload = Schema.Struct({
|
|
495
|
+
invitationId: Schema.String,
|
|
496
|
+
}).annotate({
|
|
497
|
+
identifier: "InvitationIdPayload",
|
|
498
|
+
title: "Invitation ID payload",
|
|
499
|
+
});
|
|
500
|
+
export const GetInvitationQuery = Schema.Struct({ id: Schema.String }).annotate({
|
|
501
|
+
identifier: "GetInvitationQuery",
|
|
502
|
+
title: "Get invitation query",
|
|
503
|
+
});
|
|
504
|
+
export const GetInvitationResponse = Schema.Struct({
|
|
505
|
+
...AuthInvitation.fields,
|
|
506
|
+
organizationName: Schema.String,
|
|
507
|
+
organizationSlug: Schema.String,
|
|
508
|
+
inviterEmail: Schema.String,
|
|
509
|
+
}).annotate({
|
|
510
|
+
identifier: "GetInvitationResponse",
|
|
511
|
+
title: "Get invitation response",
|
|
512
|
+
});
|
|
513
|
+
export const InvitationActionResponse = Schema.Struct({
|
|
514
|
+
invitation: Schema.NullOr(AuthInvitation),
|
|
515
|
+
member: Schema.NullOr(AuthMemberRecord),
|
|
516
|
+
}).annotate({
|
|
517
|
+
identifier: "InvitationActionResponse",
|
|
518
|
+
title: "Invitation action response",
|
|
519
|
+
});
|
|
520
|
+
export const OrganizationImpersonateUserPayload = Schema.Struct({
|
|
521
|
+
organizationId: Schema.NonEmptyString,
|
|
522
|
+
actorUserId: Schema.NonEmptyString,
|
|
523
|
+
targetUserId: Schema.NonEmptyString,
|
|
524
|
+
expiresInSeconds: Schema.optional(Schema.Number),
|
|
525
|
+
}).annotate({
|
|
526
|
+
identifier: "OrganizationImpersonateUserPayload",
|
|
527
|
+
title: "Organization impersonate user payload",
|
|
528
|
+
description: "Creates an organization-scoped impersonation session.",
|
|
529
|
+
});
|
|
530
|
+
export const OrganizationImpersonateUserResponse = AuthSessionResponse.annotate({
|
|
531
|
+
identifier: "OrganizationImpersonateUserResponse",
|
|
532
|
+
title: "Organization impersonate user response",
|
|
533
|
+
});
|
|
534
|
+
export const AuthApiKey = Schema.Struct({
|
|
535
|
+
id: Schema.String,
|
|
536
|
+
name: Schema.NullOr(Schema.String),
|
|
537
|
+
start: Schema.NullOr(Schema.String),
|
|
538
|
+
prefix: Schema.NullOr(Schema.String),
|
|
539
|
+
userId: Schema.optional(Schema.String),
|
|
540
|
+
referenceId: Schema.String,
|
|
541
|
+
configId: Schema.String,
|
|
542
|
+
refillInterval: Schema.NullOr(Schema.Number),
|
|
543
|
+
refillAmount: Schema.NullOr(Schema.Number),
|
|
544
|
+
lastRefillAt: Schema.NullOr(Schema.DateFromString),
|
|
545
|
+
enabled: Schema.Boolean,
|
|
546
|
+
rateLimitEnabled: Schema.Boolean,
|
|
547
|
+
rateLimitTimeWindow: Schema.NullOr(Schema.Number),
|
|
548
|
+
rateLimitMax: Schema.NullOr(Schema.Number),
|
|
549
|
+
requestCount: Schema.Number,
|
|
550
|
+
remaining: Schema.NullOr(Schema.Number),
|
|
551
|
+
lastRequest: Schema.NullOr(Schema.DateFromString),
|
|
552
|
+
expiresAt: Schema.NullOr(Schema.DateFromString),
|
|
553
|
+
createdAt: Schema.DateFromString,
|
|
554
|
+
updatedAt: Schema.DateFromString,
|
|
555
|
+
metadata: Schema.NullOr(JsonRecord),
|
|
556
|
+
permissions: Schema.optional(Schema.NullOr(StringArrayRecord)),
|
|
557
|
+
referrers: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))),
|
|
558
|
+
}).annotate({ identifier: "AuthApiKey", title: "Auth API key" });
|
|
559
|
+
export const ListApiKeysQuery = Schema.Struct({
|
|
560
|
+
configId: Schema.optional(Schema.String),
|
|
561
|
+
organizationId: Schema.optional(Schema.String),
|
|
562
|
+
limit: Schema.optional(Schema.NumberFromString),
|
|
563
|
+
offset: Schema.optional(Schema.NumberFromString),
|
|
564
|
+
sortBy: Schema.optional(Schema.String),
|
|
565
|
+
sortDirection: Schema.optional(Schema.Literals(["asc", "desc"])),
|
|
566
|
+
}).annotate({ identifier: "ListApiKeysQuery", title: "List API keys query" });
|
|
567
|
+
export const ListApiKeysResponse = Schema.Struct({
|
|
568
|
+
apiKeys: Schema.Array(AuthApiKey),
|
|
569
|
+
total: Schema.Number,
|
|
570
|
+
limit: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
571
|
+
offset: Schema.optional(Schema.NullOr(Schema.Number)),
|
|
572
|
+
}).annotate({
|
|
573
|
+
identifier: "ListApiKeysResponse",
|
|
574
|
+
title: "List API keys response",
|
|
575
|
+
});
|
|
576
|
+
export const DeleteApiKeyPayload = Schema.Struct({
|
|
577
|
+
configId: Schema.optional(Schema.String),
|
|
578
|
+
keyId: Schema.String,
|
|
579
|
+
}).annotate({
|
|
580
|
+
identifier: "DeleteApiKeyPayload",
|
|
581
|
+
title: "Delete API key payload",
|
|
582
|
+
});
|
|
583
|
+
export const AdminUserIdPayload = Schema.Struct({
|
|
584
|
+
userId: Schema.String,
|
|
585
|
+
}).annotate({
|
|
586
|
+
identifier: "AdminUserIdPayload",
|
|
587
|
+
title: "Admin user ID payload",
|
|
588
|
+
});
|
|
589
|
+
export const AdminBanUserPayload = Schema.Struct({
|
|
590
|
+
userId: Schema.String,
|
|
591
|
+
banReason: Schema.optional(Schema.String),
|
|
592
|
+
banExpiresIn: Schema.optional(Schema.Number),
|
|
593
|
+
}).annotate({ identifier: "AdminBanUserPayload", title: "Ban user payload" });
|
|
594
|
+
export const AdminUserResponse = Schema.Struct({ user: AuthUser }).annotate({
|
|
595
|
+
identifier: "AdminUserResponse",
|
|
596
|
+
title: "Admin user response",
|
|
597
|
+
});
|
|
598
|
+
export const OAuthConsentPayload = Schema.Struct({
|
|
599
|
+
accept: Schema.Boolean,
|
|
600
|
+
scope: Schema.optional(Schema.String),
|
|
601
|
+
oauth_query: Schema.optional(Schema.String),
|
|
602
|
+
}).annotate({
|
|
603
|
+
identifier: "OAuthConsentPayload",
|
|
604
|
+
title: "OAuth consent payload",
|
|
605
|
+
});
|
|
606
|
+
export const OAuthRedirectResponse = Schema.Struct({
|
|
607
|
+
redirect: Schema.Boolean,
|
|
608
|
+
url: Schema.String,
|
|
609
|
+
}).annotate({
|
|
610
|
+
identifier: "OAuthRedirectResponse",
|
|
611
|
+
title: "OAuth redirect response",
|
|
612
|
+
});
|
|
613
|
+
export const OAuthPublicClientQuery = Schema.Struct({
|
|
614
|
+
client_id: Schema.String,
|
|
615
|
+
}).annotate({
|
|
616
|
+
identifier: "OAuthPublicClientQuery",
|
|
617
|
+
title: "OAuth public client query",
|
|
618
|
+
});
|
|
619
|
+
export const OAuthPublicClient = Schema.Struct({
|
|
620
|
+
client_id: Schema.String,
|
|
621
|
+
client_name: Schema.optional(Schema.String),
|
|
622
|
+
client_uri: Schema.optional(Schema.String),
|
|
623
|
+
logo_uri: Schema.optional(Schema.String),
|
|
624
|
+
contacts: Schema.optional(Schema.Array(Schema.String)),
|
|
625
|
+
tos_uri: Schema.optional(Schema.String),
|
|
626
|
+
policy_uri: Schema.optional(Schema.String),
|
|
627
|
+
redirect_uris: Schema.Array(Schema.String),
|
|
628
|
+
}).annotate({ identifier: "OAuthPublicClient", title: "OAuth public client" });
|