@mano8/astro-auth-m8 0.1.0-alpha.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/LICENSE +201 -0
- package/README.md +100 -0
- package/dist/bin/astro-auth-m8.d.ts +3 -0
- package/dist/bin/astro-auth-m8.d.ts.map +1 -0
- package/dist/bin/astro-auth-m8.js +53 -0
- package/dist/bin/astro-auth-m8.js.map +1 -0
- package/dist/src/integration.d.ts +42 -0
- package/dist/src/integration.d.ts.map +1 -0
- package/dist/src/integration.js +54 -0
- package/dist/src/integration.js.map +1 -0
- package/dist/src/lib/csp.d.ts +19 -0
- package/dist/src/lib/csp.d.ts.map +1 -0
- package/dist/src/lib/csp.js +49 -0
- package/dist/src/lib/csp.js.map +1 -0
- package/dist/src/middleware.d.ts +4 -0
- package/dist/src/middleware.d.ts.map +1 -0
- package/dist/src/middleware.js +24 -0
- package/dist/src/middleware.js.map +1 -0
- package/dist/src/runtime/api/apiKeys.d.ts +7 -0
- package/dist/src/runtime/api/apiKeys.d.ts.map +1 -0
- package/dist/src/runtime/api/apiKeys.js +26 -0
- package/dist/src/runtime/api/apiKeys.js.map +1 -0
- package/dist/src/runtime/api/auth.d.ts +6 -0
- package/dist/src/runtime/api/auth.d.ts.map +1 -0
- package/dist/src/runtime/api/auth.js +53 -0
- package/dist/src/runtime/api/auth.js.map +1 -0
- package/dist/src/runtime/api/dashboard.d.ts +4 -0
- package/dist/src/runtime/api/dashboard.d.ts.map +1 -0
- package/dist/src/runtime/api/dashboard.js +9 -0
- package/dist/src/runtime/api/dashboard.js.map +1 -0
- package/dist/src/runtime/api/index.d.ts +9 -0
- package/dist/src/runtime/api/index.d.ts.map +1 -0
- package/dist/src/runtime/api/index.js +9 -0
- package/dist/src/runtime/api/index.js.map +1 -0
- package/dist/src/runtime/api/oauth.d.ts +17 -0
- package/dist/src/runtime/api/oauth.d.ts.map +1 -0
- package/dist/src/runtime/api/oauth.js +41 -0
- package/dist/src/runtime/api/oauth.js.map +1 -0
- package/dist/src/runtime/api/ops.d.ts +4 -0
- package/dist/src/runtime/api/ops.d.ts.map +1 -0
- package/dist/src/runtime/api/ops.js +9 -0
- package/dist/src/runtime/api/ops.js.map +1 -0
- package/dist/src/runtime/api/profile.d.ts +6 -0
- package/dist/src/runtime/api/profile.d.ts.map +1 -0
- package/dist/src/runtime/api/profile.js +15 -0
- package/dist/src/runtime/api/profile.js.map +1 -0
- package/dist/src/runtime/api/sessions.d.ts +9 -0
- package/dist/src/runtime/api/sessions.d.ts.map +1 -0
- package/dist/src/runtime/api/sessions.js +24 -0
- package/dist/src/runtime/api/sessions.js.map +1 -0
- package/dist/src/runtime/api/users.d.ts +8 -0
- package/dist/src/runtime/api/users.d.ts.map +1 -0
- package/dist/src/runtime/api/users.js +21 -0
- package/dist/src/runtime/api/users.js.map +1 -0
- package/dist/src/runtime/client.d.ts +17 -0
- package/dist/src/runtime/client.d.ts.map +1 -0
- package/dist/src/runtime/client.js +92 -0
- package/dist/src/runtime/client.js.map +1 -0
- package/dist/src/runtime/compatibility.d.ts +32 -0
- package/dist/src/runtime/compatibility.d.ts.map +1 -0
- package/dist/src/runtime/compatibility.js +97 -0
- package/dist/src/runtime/compatibility.js.map +1 -0
- package/dist/src/runtime/config.d.ts +10 -0
- package/dist/src/runtime/config.d.ts.map +1 -0
- package/dist/src/runtime/config.js +18 -0
- package/dist/src/runtime/config.js.map +1 -0
- package/dist/src/runtime/errors.d.ts +20 -0
- package/dist/src/runtime/errors.d.ts.map +1 -0
- package/dist/src/runtime/errors.js +44 -0
- package/dist/src/runtime/errors.js.map +1 -0
- package/dist/src/runtime/hooks/index.d.ts +8 -0
- package/dist/src/runtime/hooks/index.d.ts.map +1 -0
- package/dist/src/runtime/hooks/index.js +8 -0
- package/dist/src/runtime/hooks/index.js.map +1 -0
- package/dist/src/runtime/hooks/useApiKeys.d.ts +74 -0
- package/dist/src/runtime/hooks/useApiKeys.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useApiKeys.js +53 -0
- package/dist/src/runtime/hooks/useApiKeys.js.map +1 -0
- package/dist/src/runtime/hooks/useDashboard.d.ts +43 -0
- package/dist/src/runtime/hooks/useDashboard.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useDashboard.js +29 -0
- package/dist/src/runtime/hooks/useDashboard.js.map +1 -0
- package/dist/src/runtime/hooks/useGoogleLogin.d.ts +6 -0
- package/dist/src/runtime/hooks/useGoogleLogin.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useGoogleLogin.js +24 -0
- package/dist/src/runtime/hooks/useGoogleLogin.js.map +1 -0
- package/dist/src/runtime/hooks/useProfile.d.ts +98 -0
- package/dist/src/runtime/hooks/useProfile.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useProfile.js +57 -0
- package/dist/src/runtime/hooks/useProfile.js.map +1 -0
- package/dist/src/runtime/hooks/useSessions.d.ts +77 -0
- package/dist/src/runtime/hooks/useSessions.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useSessions.js +56 -0
- package/dist/src/runtime/hooks/useSessions.js.map +1 -0
- package/dist/src/runtime/hooks/useUsers.d.ts +171 -0
- package/dist/src/runtime/hooks/useUsers.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useUsers.js +87 -0
- package/dist/src/runtime/hooks/useUsers.js.map +1 -0
- package/dist/src/runtime/listParams.d.ts +27 -0
- package/dist/src/runtime/listParams.d.ts.map +1 -0
- package/dist/src/runtime/listParams.js +66 -0
- package/dist/src/runtime/listParams.js.map +1 -0
- package/dist/src/runtime/queryKeys.d.ts +10 -0
- package/dist/src/runtime/queryKeys.d.ts.map +1 -0
- package/dist/src/runtime/queryKeys.js +11 -0
- package/dist/src/runtime/queryKeys.js.map +1 -0
- package/dist/src/runtime/react/AuthProvider.d.ts +18 -0
- package/dist/src/runtime/react/AuthProvider.d.ts.map +1 -0
- package/dist/src/runtime/react/AuthProvider.js +121 -0
- package/dist/src/runtime/react/AuthProvider.js.map +1 -0
- package/dist/src/runtime/react/AuthQueryProvider.d.ts +8 -0
- package/dist/src/runtime/react/AuthQueryProvider.d.ts.map +1 -0
- package/dist/src/runtime/react/AuthQueryProvider.js +11 -0
- package/dist/src/runtime/react/AuthQueryProvider.js.map +1 -0
- package/dist/src/runtime/react/RequireAuth.d.ts +6 -0
- package/dist/src/runtime/react/RequireAuth.d.ts.map +1 -0
- package/dist/src/runtime/react/RequireAuth.js +8 -0
- package/dist/src/runtime/react/RequireAuth.js.map +1 -0
- package/dist/src/runtime/react/RequireRole.d.ts +9 -0
- package/dist/src/runtime/react/RequireRole.d.ts.map +1 -0
- package/dist/src/runtime/react/RequireRole.js +12 -0
- package/dist/src/runtime/react/RequireRole.js.map +1 -0
- package/dist/src/runtime/react/default-ui/AccountView.d.ts +2 -0
- package/dist/src/runtime/react/default-ui/AccountView.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/AccountView.js +16 -0
- package/dist/src/runtime/react/default-ui/AccountView.js.map +1 -0
- package/dist/src/runtime/react/default-ui/CallbackView.d.ts +2 -0
- package/dist/src/runtime/react/default-ui/CallbackView.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/CallbackView.js +22 -0
- package/dist/src/runtime/react/default-ui/CallbackView.js.map +1 -0
- package/dist/src/runtime/react/default-ui/LoginForm.d.ts +44 -0
- package/dist/src/runtime/react/default-ui/LoginForm.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/LoginForm.js +58 -0
- package/dist/src/runtime/react/default-ui/LoginForm.js.map +1 -0
- package/dist/src/runtime/react/default-ui/LoginView.d.ts +6 -0
- package/dist/src/runtime/react/default-ui/LoginView.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/LoginView.js +8 -0
- package/dist/src/runtime/react/default-ui/LoginView.js.map +1 -0
- package/dist/src/runtime/react/default-ui/SignupView.d.ts +2 -0
- package/dist/src/runtime/react/default-ui/SignupView.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/SignupView.js +5 -0
- package/dist/src/runtime/react/default-ui/SignupView.js.map +1 -0
- package/dist/src/runtime/react/default-ui/index.d.ts +6 -0
- package/dist/src/runtime/react/default-ui/index.d.ts.map +1 -0
- package/dist/src/runtime/react/default-ui/index.js +6 -0
- package/dist/src/runtime/react/default-ui/index.js.map +1 -0
- package/dist/src/runtime/react/index.d.ts +5 -0
- package/dist/src/runtime/react/index.d.ts.map +1 -0
- package/dist/src/runtime/react/index.js +5 -0
- package/dist/src/runtime/react/index.js.map +1 -0
- package/dist/src/runtime/routes.d.ts +19 -0
- package/dist/src/runtime/routes.d.ts.map +1 -0
- package/dist/src/runtime/routes.js +33 -0
- package/dist/src/runtime/routes.js.map +1 -0
- package/dist/src/runtime/schemas.d.ts +299 -0
- package/dist/src/runtime/schemas.d.ts.map +1 -0
- package/dist/src/runtime/schemas.js +184 -0
- package/dist/src/runtime/schemas.js.map +1 -0
- package/dist/src/runtime/tokenStore.d.ts +5 -0
- package/dist/src/runtime/tokenStore.d.ts.map +1 -0
- package/dist/src/runtime/tokenStore.js +20 -0
- package/dist/src/runtime/tokenStore.js.map +1 -0
- package/package.json +82 -0
- package/registry/r/account-dashboard.json +21 -0
- package/registry/r/activity-bar-chart.json +21 -0
- package/registry/r/admin-users-panel.json +24 -0
- package/registry/r/api-keys-panel.json +21 -0
- package/registry/r/dashboard-overview.json +20 -0
- package/registry/r/data-table.json +23 -0
- package/registry/r/profile-panel.json +21 -0
- package/registry/r/registry.json +55 -0
- package/registry/r/sessions-panel.json +22 -0
- package/registry.json +132 -0
- package/src/routes/account.astro +8 -0
- package/src/routes/callback.astro +5 -0
- package/src/routes/login.astro +8 -0
- package/src/routes/logout.astro +18 -0
- package/src/routes/signup.astro +5 -0
- package/src/scaffold/styles/auth.css +49 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const RoleTypeSchema: z.ZodEnum<{
|
|
3
|
+
superadmin: "superadmin";
|
|
4
|
+
admin: "admin";
|
|
5
|
+
writer: "writer";
|
|
6
|
+
reader: "reader";
|
|
7
|
+
user: "user";
|
|
8
|
+
}>;
|
|
9
|
+
export type RoleType = z.infer<typeof RoleTypeSchema>;
|
|
10
|
+
export declare const AuthProviderTypeSchema: z.ZodEnum<{
|
|
11
|
+
password: "password";
|
|
12
|
+
google: "google";
|
|
13
|
+
}>;
|
|
14
|
+
export type AuthProviderType = z.infer<typeof AuthProviderTypeSchema>;
|
|
15
|
+
export declare const TokenSchema: z.ZodObject<{
|
|
16
|
+
access_token: z.ZodString;
|
|
17
|
+
token_type: z.ZodDefault<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export type Token = z.infer<typeof TokenSchema>;
|
|
20
|
+
export declare const MessageSchema: z.ZodObject<{
|
|
21
|
+
message: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type Message = z.infer<typeof MessageSchema>;
|
|
24
|
+
export declare const ResponseMessageSchema: z.ZodObject<{
|
|
25
|
+
success: z.ZodBoolean;
|
|
26
|
+
msg: z.ZodString;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export type ResponseMessage = z.infer<typeof ResponseMessageSchema>;
|
|
29
|
+
export declare const UserPublicSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
32
|
+
password: "password";
|
|
33
|
+
google: "google";
|
|
34
|
+
}>>;
|
|
35
|
+
email: z.ZodString;
|
|
36
|
+
full_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
avatar: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
is_active: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
email_verified: z.ZodDefault<z.ZodBoolean>;
|
|
40
|
+
is_superuser: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
42
|
+
superadmin: "superadmin";
|
|
43
|
+
admin: "admin";
|
|
44
|
+
writer: "writer";
|
|
45
|
+
reader: "reader";
|
|
46
|
+
user: "user";
|
|
47
|
+
}>>;
|
|
48
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
49
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export type UserPublic = z.infer<typeof UserPublicSchema>;
|
|
52
|
+
export declare const ResponseUserSchema: z.ZodObject<{
|
|
53
|
+
success: z.ZodBoolean;
|
|
54
|
+
user: z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
57
|
+
password: "password";
|
|
58
|
+
google: "google";
|
|
59
|
+
}>>;
|
|
60
|
+
email: z.ZodString;
|
|
61
|
+
full_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
avatar: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
63
|
+
is_active: z.ZodDefault<z.ZodBoolean>;
|
|
64
|
+
email_verified: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
is_superuser: z.ZodDefault<z.ZodBoolean>;
|
|
66
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
67
|
+
superadmin: "superadmin";
|
|
68
|
+
admin: "admin";
|
|
69
|
+
writer: "writer";
|
|
70
|
+
reader: "reader";
|
|
71
|
+
user: "user";
|
|
72
|
+
}>>;
|
|
73
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
74
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export type ResponseUser = z.infer<typeof ResponseUserSchema>;
|
|
78
|
+
export declare const UsersPublicSchema: z.ZodObject<{
|
|
79
|
+
data: z.ZodArray<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
82
|
+
password: "password";
|
|
83
|
+
google: "google";
|
|
84
|
+
}>>;
|
|
85
|
+
email: z.ZodString;
|
|
86
|
+
full_name: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
87
|
+
avatar: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
88
|
+
is_active: z.ZodDefault<z.ZodBoolean>;
|
|
89
|
+
email_verified: z.ZodDefault<z.ZodBoolean>;
|
|
90
|
+
is_superuser: z.ZodDefault<z.ZodBoolean>;
|
|
91
|
+
role: z.ZodDefault<z.ZodEnum<{
|
|
92
|
+
superadmin: "superadmin";
|
|
93
|
+
admin: "admin";
|
|
94
|
+
writer: "writer";
|
|
95
|
+
reader: "reader";
|
|
96
|
+
user: "user";
|
|
97
|
+
}>>;
|
|
98
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
99
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
count: z.ZodNumber;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
export type UsersPublic = z.infer<typeof UsersPublicSchema>;
|
|
104
|
+
export declare const UserRegisterSchema: z.ZodObject<{
|
|
105
|
+
email: z.ZodString;
|
|
106
|
+
password: z.ZodString;
|
|
107
|
+
full_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export type UserRegister = z.infer<typeof UserRegisterSchema>;
|
|
110
|
+
export declare const UserCreateSchema: z.ZodObject<{
|
|
111
|
+
provider: z.ZodDefault<z.ZodEnum<{
|
|
112
|
+
password: "password";
|
|
113
|
+
google: "google";
|
|
114
|
+
}>>;
|
|
115
|
+
email: z.ZodString;
|
|
116
|
+
full_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
117
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
is_active: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
email_verified: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
is_superuser: z.ZodOptional<z.ZodBoolean>;
|
|
121
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
superadmin: "superadmin";
|
|
123
|
+
admin: "admin";
|
|
124
|
+
writer: "writer";
|
|
125
|
+
reader: "reader";
|
|
126
|
+
user: "user";
|
|
127
|
+
}>>;
|
|
128
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
129
|
+
oauth_user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export type UserCreate = z.infer<typeof UserCreateSchema>;
|
|
132
|
+
export declare const UserUpdateSchema: z.ZodObject<{
|
|
133
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
+
full_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
135
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
137
|
+
oauth_user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
+
role: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
139
|
+
superadmin: "superadmin";
|
|
140
|
+
admin: "admin";
|
|
141
|
+
writer: "writer";
|
|
142
|
+
reader: "reader";
|
|
143
|
+
user: "user";
|
|
144
|
+
}>>>;
|
|
145
|
+
provider: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
146
|
+
password: "password";
|
|
147
|
+
google: "google";
|
|
148
|
+
}>>>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
export type UserUpdate = z.infer<typeof UserUpdateSchema>;
|
|
151
|
+
export declare const UserUpdateMeSchema: z.ZodObject<{
|
|
152
|
+
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
+
full_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
154
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
export type UserUpdateMe = z.infer<typeof UserUpdateMeSchema>;
|
|
157
|
+
export declare const UpdatePasswordSchema: z.ZodObject<{
|
|
158
|
+
current_password: z.ZodString;
|
|
159
|
+
new_password: z.ZodString;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
export type UpdatePassword = z.infer<typeof UpdatePasswordSchema>;
|
|
162
|
+
export declare const ApiKeyPublicSchema: z.ZodObject<{
|
|
163
|
+
id: z.ZodString;
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
166
|
+
revoked: z.ZodDefault<z.ZodBoolean>;
|
|
167
|
+
last_used_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
168
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
169
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
export type ApiKeyPublic = z.infer<typeof ApiKeyPublicSchema>;
|
|
172
|
+
export declare const ApiKeyCreateSchema: z.ZodObject<{
|
|
173
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
174
|
+
ttl_hours: z.ZodDefault<z.ZodNumber>;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
export type ApiKeyCreate = z.infer<typeof ApiKeyCreateSchema>;
|
|
177
|
+
export declare const ApiKeyCreatedSchema: z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
181
|
+
revoked: z.ZodDefault<z.ZodBoolean>;
|
|
182
|
+
last_used_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
183
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
184
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
185
|
+
plaintext: z.ZodString;
|
|
186
|
+
}, z.core.$strict>;
|
|
187
|
+
export type ApiKeyCreated = z.infer<typeof ApiKeyCreatedSchema>;
|
|
188
|
+
export declare const ClientSessionPublicSchema: z.ZodObject<{
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
provider: z.ZodEnum<{
|
|
191
|
+
password: "password";
|
|
192
|
+
google: "google";
|
|
193
|
+
}>;
|
|
194
|
+
jwt_jti: z.ZodString;
|
|
195
|
+
jwt_expires_at: z.ZodString;
|
|
196
|
+
refresh_expires_at: z.ZodString;
|
|
197
|
+
revoked: z.ZodBoolean;
|
|
198
|
+
external_token_expires_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
199
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
200
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
201
|
+
}, z.core.$strict>;
|
|
202
|
+
export type ClientSessionPublic = z.infer<typeof ClientSessionPublicSchema>;
|
|
203
|
+
export declare const ClientSessionsPublicSchema: z.ZodObject<{
|
|
204
|
+
data: z.ZodArray<z.ZodObject<{
|
|
205
|
+
id: z.ZodString;
|
|
206
|
+
provider: z.ZodEnum<{
|
|
207
|
+
password: "password";
|
|
208
|
+
google: "google";
|
|
209
|
+
}>;
|
|
210
|
+
jwt_jti: z.ZodString;
|
|
211
|
+
jwt_expires_at: z.ZodString;
|
|
212
|
+
refresh_expires_at: z.ZodString;
|
|
213
|
+
revoked: z.ZodBoolean;
|
|
214
|
+
external_token_expires_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
216
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strict>>;
|
|
218
|
+
count: z.ZodNumber;
|
|
219
|
+
}, z.core.$strict>;
|
|
220
|
+
export type ClientSessionsPublic = z.infer<typeof ClientSessionsPublicSchema>;
|
|
221
|
+
export declare const ClientSessionUpdateExternalSchema: z.ZodObject<{
|
|
222
|
+
external_access_token: z.ZodOptional<z.ZodString>;
|
|
223
|
+
external_refresh_token: z.ZodOptional<z.ZodString>;
|
|
224
|
+
external_token_expires_at: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
export type ClientSessionUpdateExternal = z.infer<typeof ClientSessionUpdateExternalSchema>;
|
|
227
|
+
export declare const ActivityCounterSchema: z.ZodObject<{
|
|
228
|
+
model: z.ZodString;
|
|
229
|
+
updated: z.ZodNumber;
|
|
230
|
+
added: z.ZodNumber;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
export type ActivityCounter = z.infer<typeof ActivityCounterSchema>;
|
|
233
|
+
export declare const ActivityStatsSchema: z.ZodObject<{
|
|
234
|
+
min: z.ZodNumber;
|
|
235
|
+
max: z.ZodNumber;
|
|
236
|
+
activity: z.ZodArray<z.ZodObject<{
|
|
237
|
+
model: z.ZodString;
|
|
238
|
+
updated: z.ZodNumber;
|
|
239
|
+
added: z.ZodNumber;
|
|
240
|
+
}, z.core.$strict>>;
|
|
241
|
+
}, z.core.$strict>;
|
|
242
|
+
export type ActivityStats = z.infer<typeof ActivityStatsSchema>;
|
|
243
|
+
export declare const UsersActivitySchema: z.ZodObject<{
|
|
244
|
+
nb_users: z.ZodNumber;
|
|
245
|
+
activity: z.ZodObject<{
|
|
246
|
+
min: z.ZodNumber;
|
|
247
|
+
max: z.ZodNumber;
|
|
248
|
+
activity: z.ZodArray<z.ZodObject<{
|
|
249
|
+
model: z.ZodString;
|
|
250
|
+
updated: z.ZodNumber;
|
|
251
|
+
added: z.ZodNumber;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
}, z.core.$strict>;
|
|
254
|
+
}, z.core.$strict>;
|
|
255
|
+
export type UsersActivity = z.infer<typeof UsersActivitySchema>;
|
|
256
|
+
export declare const HealthSchema: z.ZodObject<{
|
|
257
|
+
status: z.ZodString;
|
|
258
|
+
token_mode: z.ZodString;
|
|
259
|
+
effective_mode: z.ZodString;
|
|
260
|
+
redis: z.ZodUnknown;
|
|
261
|
+
circuit_breaker: z.ZodUnknown;
|
|
262
|
+
database: z.ZodUnknown;
|
|
263
|
+
revocation_available: z.ZodBoolean;
|
|
264
|
+
rate_limiting_available: z.ZodBoolean;
|
|
265
|
+
degraded_since: z.ZodNullable<z.ZodString>;
|
|
266
|
+
degradation_modes: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
267
|
+
}, z.core.$loose>;
|
|
268
|
+
export type Health = z.infer<typeof HealthSchema>;
|
|
269
|
+
export declare const JwkSchema: z.ZodObject<{
|
|
270
|
+
kty: z.ZodString;
|
|
271
|
+
}, z.core.$loose>;
|
|
272
|
+
export declare const JwksSchema: z.ZodObject<{
|
|
273
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
274
|
+
kty: z.ZodString;
|
|
275
|
+
}, z.core.$loose>>;
|
|
276
|
+
}, z.core.$loose>;
|
|
277
|
+
export type Jwks = z.infer<typeof JwksSchema>;
|
|
278
|
+
export declare const GoogleLoginUrlResponseSchema: z.ZodObject<{
|
|
279
|
+
url: z.ZodString;
|
|
280
|
+
}, z.core.$strict>;
|
|
281
|
+
export type GoogleLoginUrlResponse = z.infer<typeof GoogleLoginUrlResponseSchema>;
|
|
282
|
+
export declare const GoogleExchangeResponseSchema: z.ZodObject<{
|
|
283
|
+
version: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
284
|
+
auth_provider: z.ZodString;
|
|
285
|
+
access_token: z.ZodString;
|
|
286
|
+
expires_at: z.ZodNumber;
|
|
287
|
+
user: z.ZodObject<{
|
|
288
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
email: z.ZodString;
|
|
290
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
291
|
+
}, z.core.$strict>;
|
|
292
|
+
}, z.core.$strict>;
|
|
293
|
+
export type GoogleExchangeResponse = z.infer<typeof GoogleExchangeResponseSchema>;
|
|
294
|
+
export declare const LoginFormSchema: z.ZodObject<{
|
|
295
|
+
username: z.ZodString;
|
|
296
|
+
password: z.ZodString;
|
|
297
|
+
}, z.core.$strict>;
|
|
298
|
+
export type LoginForm = z.infer<typeof LoginFormSchema>;
|
|
299
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/runtime/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;;;;EAA8D,CAAC;AAC1F,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,sBAAsB;;;EAAiC,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAKtE,eAAO,MAAM,WAAW;;;kBAGb,CAAC;AACZ,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,aAAa;;kBAEf,CAAC;AACZ,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,qBAAqB;;;kBAGvB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;kBAYlB,CAAC;AACZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;kBAGpB,CAAC;AACZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;kBAGnB,CAAC;AACZ,MAAM,MAAM,WAA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F,eAAO,MAAM,eAAe;;;kBAGjB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const RoleTypeSchema = z.enum(["superadmin", "admin", "writer", "reader", "user"]);
|
|
3
|
+
export const AuthProviderTypeSchema = z.enum(["password", "google"]);
|
|
4
|
+
const isoDate = z.string();
|
|
5
|
+
const nullableIsoDate = isoDate.nullable();
|
|
6
|
+
export const TokenSchema = z.object({
|
|
7
|
+
access_token: z.string(),
|
|
8
|
+
token_type: z.string().default("bearer")
|
|
9
|
+
}).strict();
|
|
10
|
+
export const MessageSchema = z.object({
|
|
11
|
+
message: z.string()
|
|
12
|
+
}).strict();
|
|
13
|
+
export const ResponseMessageSchema = z.object({
|
|
14
|
+
success: z.boolean(),
|
|
15
|
+
msg: z.string()
|
|
16
|
+
}).strict();
|
|
17
|
+
export const UserPublicSchema = z.object({
|
|
18
|
+
id: z.string().uuid(),
|
|
19
|
+
provider: AuthProviderTypeSchema.default("password"),
|
|
20
|
+
email: z.string().email(),
|
|
21
|
+
full_name: z.string().max(100).nullable().default(null),
|
|
22
|
+
avatar: z.string().max(255).url().nullable().default(null),
|
|
23
|
+
is_active: z.boolean().default(true),
|
|
24
|
+
email_verified: z.boolean().default(false),
|
|
25
|
+
is_superuser: z.boolean().default(false),
|
|
26
|
+
role: RoleTypeSchema.default("user"),
|
|
27
|
+
created_at: isoDate.optional(),
|
|
28
|
+
updated_at: isoDate.optional()
|
|
29
|
+
}).strict();
|
|
30
|
+
export const ResponseUserSchema = z.object({
|
|
31
|
+
success: z.boolean(),
|
|
32
|
+
user: UserPublicSchema
|
|
33
|
+
}).strict();
|
|
34
|
+
export const UsersPublicSchema = z.object({
|
|
35
|
+
data: z.array(UserPublicSchema),
|
|
36
|
+
count: z.number().int().nonnegative()
|
|
37
|
+
}).strict();
|
|
38
|
+
export const UserRegisterSchema = z.object({
|
|
39
|
+
email: z.string().email().max(255),
|
|
40
|
+
password: z.string().min(8).max(128),
|
|
41
|
+
full_name: z.string().max(100).nullable().optional()
|
|
42
|
+
}).strict();
|
|
43
|
+
const userCreateBase = z.object({
|
|
44
|
+
provider: AuthProviderTypeSchema.default("password"),
|
|
45
|
+
email: z.string().email().max(255),
|
|
46
|
+
full_name: z.string().max(100).nullable().optional(),
|
|
47
|
+
avatar: z.string().max(255).url().nullable().optional(),
|
|
48
|
+
is_active: z.boolean().optional(),
|
|
49
|
+
email_verified: z.boolean().optional(),
|
|
50
|
+
is_superuser: z.boolean().optional(),
|
|
51
|
+
role: RoleTypeSchema.optional(),
|
|
52
|
+
password: z.string().min(8).max(128).nullable().optional(),
|
|
53
|
+
oauth_user_id: z.string().max(256).nullable().optional()
|
|
54
|
+
}).strict();
|
|
55
|
+
export const UserCreateSchema = userCreateBase.superRefine((value, ctx) => {
|
|
56
|
+
if (value.provider === "password") {
|
|
57
|
+
if (!value.password) {
|
|
58
|
+
ctx.addIssue({ code: "custom", path: ["password"], message: "Password required for password provider" });
|
|
59
|
+
}
|
|
60
|
+
if (value.oauth_user_id != null) {
|
|
61
|
+
ctx.addIssue({ code: "custom", path: ["oauth_user_id"], message: "oauth_user_id is only supported for Google users" });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (value.provider === "google") {
|
|
65
|
+
if (!value.oauth_user_id) {
|
|
66
|
+
ctx.addIssue({ code: "custom", path: ["oauth_user_id"], message: "oauth_user_id required for Google provider" });
|
|
67
|
+
}
|
|
68
|
+
if (value.password != null) {
|
|
69
|
+
ctx.addIssue({ code: "custom", path: ["password"], message: "password is not supported for Google users" });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
export const UserUpdateSchema = z.object({
|
|
74
|
+
email: z.string().email().max(255).nullable().optional(),
|
|
75
|
+
full_name: z.string().max(100).nullable().optional(),
|
|
76
|
+
avatar: z.string().max(255).url().nullable().optional(),
|
|
77
|
+
password: z.string().min(8).max(128).nullable().optional(),
|
|
78
|
+
oauth_user_id: z.string().max(256).nullable().optional(),
|
|
79
|
+
role: RoleTypeSchema.nullable().optional(),
|
|
80
|
+
provider: AuthProviderTypeSchema.nullable().optional()
|
|
81
|
+
}).strict().superRefine((value, ctx) => {
|
|
82
|
+
if (value.provider === "password" && value.oauth_user_id != null) {
|
|
83
|
+
ctx.addIssue({ code: "custom", path: ["oauth_user_id"], message: "oauth_user_id is not supported for password users" });
|
|
84
|
+
}
|
|
85
|
+
if (value.provider === "google" && value.password != null) {
|
|
86
|
+
ctx.addIssue({ code: "custom", path: ["password"], message: "password is not supported for Google users" });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
export const UserUpdateMeSchema = z.object({
|
|
90
|
+
email: z.string().email().max(255).nullable().optional(),
|
|
91
|
+
full_name: z.string().max(100).nullable().optional(),
|
|
92
|
+
avatar: z.string().max(255).url().nullable().optional()
|
|
93
|
+
}).strict();
|
|
94
|
+
export const UpdatePasswordSchema = z.object({
|
|
95
|
+
current_password: z.string().min(8).max(128),
|
|
96
|
+
new_password: z.string().min(8).max(128)
|
|
97
|
+
}).strict();
|
|
98
|
+
export const ApiKeyPublicSchema = z.object({
|
|
99
|
+
id: z.string().uuid(),
|
|
100
|
+
name: z.string().min(3).max(100),
|
|
101
|
+
expires_at: nullableIsoDate,
|
|
102
|
+
revoked: z.boolean().default(false),
|
|
103
|
+
last_used_at: nullableIsoDate.default(null),
|
|
104
|
+
created_at: isoDate.optional(),
|
|
105
|
+
updated_at: isoDate.optional()
|
|
106
|
+
}).strict();
|
|
107
|
+
export const ApiKeyCreateSchema = z.object({
|
|
108
|
+
name: z.string().min(3).max(100).nullable().optional(),
|
|
109
|
+
ttl_hours: z.number().int().positive().default(24)
|
|
110
|
+
}).strict();
|
|
111
|
+
export const ApiKeyCreatedSchema = ApiKeyPublicSchema.extend({
|
|
112
|
+
plaintext: z.string()
|
|
113
|
+
}).strict();
|
|
114
|
+
export const ClientSessionPublicSchema = z.object({
|
|
115
|
+
id: z.string(),
|
|
116
|
+
provider: AuthProviderTypeSchema,
|
|
117
|
+
jwt_jti: z.string(),
|
|
118
|
+
jwt_expires_at: isoDate,
|
|
119
|
+
refresh_expires_at: isoDate,
|
|
120
|
+
revoked: z.boolean(),
|
|
121
|
+
external_token_expires_at: nullableIsoDate.default(null),
|
|
122
|
+
created_at: isoDate.optional(),
|
|
123
|
+
updated_at: isoDate.optional()
|
|
124
|
+
}).strict();
|
|
125
|
+
export const ClientSessionsPublicSchema = z.object({
|
|
126
|
+
data: z.array(ClientSessionPublicSchema),
|
|
127
|
+
count: z.number().int().nonnegative()
|
|
128
|
+
}).strict();
|
|
129
|
+
export const ClientSessionUpdateExternalSchema = z.object({
|
|
130
|
+
external_access_token: z.string().max(2048).optional(),
|
|
131
|
+
external_refresh_token: z.string().max(2048).optional(),
|
|
132
|
+
external_token_expires_at: isoDate.optional()
|
|
133
|
+
}).strict();
|
|
134
|
+
export const ActivityCounterSchema = z.object({
|
|
135
|
+
model: z.string(),
|
|
136
|
+
updated: z.number(),
|
|
137
|
+
added: z.number()
|
|
138
|
+
}).strict();
|
|
139
|
+
export const ActivityStatsSchema = z.object({
|
|
140
|
+
min: z.number(),
|
|
141
|
+
max: z.number(),
|
|
142
|
+
activity: z.array(ActivityCounterSchema)
|
|
143
|
+
}).strict();
|
|
144
|
+
export const UsersActivitySchema = z.object({
|
|
145
|
+
nb_users: z.number(),
|
|
146
|
+
activity: ActivityStatsSchema
|
|
147
|
+
}).strict();
|
|
148
|
+
export const HealthSchema = z.object({
|
|
149
|
+
status: z.string(),
|
|
150
|
+
token_mode: z.string(),
|
|
151
|
+
effective_mode: z.string(),
|
|
152
|
+
redis: z.unknown(),
|
|
153
|
+
circuit_breaker: z.unknown(),
|
|
154
|
+
database: z.unknown(),
|
|
155
|
+
revocation_available: z.boolean(),
|
|
156
|
+
rate_limiting_available: z.boolean(),
|
|
157
|
+
degraded_since: z.string().nullable(),
|
|
158
|
+
degradation_modes: z.record(z.string(), z.string())
|
|
159
|
+
}).passthrough();
|
|
160
|
+
export const JwkSchema = z.object({
|
|
161
|
+
kty: z.string()
|
|
162
|
+
}).passthrough();
|
|
163
|
+
export const JwksSchema = z.object({
|
|
164
|
+
keys: z.array(JwkSchema)
|
|
165
|
+
}).passthrough();
|
|
166
|
+
export const GoogleLoginUrlResponseSchema = z.object({
|
|
167
|
+
url: z.string().url()
|
|
168
|
+
}).strict();
|
|
169
|
+
export const GoogleExchangeResponseSchema = z.object({
|
|
170
|
+
version: z.union([z.string(), z.number()]),
|
|
171
|
+
auth_provider: z.string(),
|
|
172
|
+
access_token: z.string(),
|
|
173
|
+
expires_at: z.number(),
|
|
174
|
+
user: z.object({
|
|
175
|
+
name: z.string().nullable().optional(),
|
|
176
|
+
email: z.string().email(),
|
|
177
|
+
avatar: z.string().url().nullable().optional()
|
|
178
|
+
}).strict()
|
|
179
|
+
}).strict();
|
|
180
|
+
export const LoginFormSchema = z.object({
|
|
181
|
+
username: z.string().email(),
|
|
182
|
+
password: z.string().min(1)
|
|
183
|
+
}).strict();
|
|
184
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/runtime/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AAG1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGrE,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,MAAM,eAAe,GAAG,OAAO,C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@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getToken(): string | null;
|
|
2
|
+
export declare function setToken(token: string | null): void;
|
|
3
|
+
export declare function clearToken(): void;
|
|
4
|
+
export declare function runRefresh(refresher: () => Promise<string | null>): Promise<string | null>;
|
|
5
|
+
//# sourceMappingURL=tokenStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenStore.d.ts","sourceRoot":"","sources":["../../../src/runtime/tokenStore.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAExC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEnD;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOhG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let accessToken = null;
|
|
2
|
+
let refreshPromise = null;
|
|
3
|
+
export function getToken() {
|
|
4
|
+
return accessToken;
|
|
5
|
+
}
|
|
6
|
+
export function setToken(token) {
|
|
7
|
+
accessToken = token;
|
|
8
|
+
}
|
|
9
|
+
export function clearToken() {
|
|
10
|
+
accessToken = null;
|
|
11
|
+
}
|
|
12
|
+
export async function runRefresh(refresher) {
|
|
13
|
+
if (!refreshPromise) {
|
|
14
|
+
refreshPromise = refresher().finally(() => {
|
|
15
|
+
refreshPromise = null;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return refreshPromise;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=tokenStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenStore.js","sourceRoot":"","sources":["../../../src/runtime/tokenStore.ts"],"names":[],"mappings":"AAAA,IAAI,WAAW,GAAkB,IAAI,CAAC;AACtC,IAAI,cAAc,GAAkC,IAAI,CAAC;AAEzD,MAAM,UAAU,QAAQ;IACtB,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAAuC;IACtE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;YACxC,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mano8/astro-auth-m8",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"description": "Astro integration and headless client for fa-auth-m8.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mano8/astro-auth-m8.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"astro-integration",
|
|
16
|
+
"astro",
|
|
17
|
+
"auth",
|
|
18
|
+
"fa-auth-m8"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src/routes",
|
|
23
|
+
"src/scaffold/styles",
|
|
24
|
+
"registry.json",
|
|
25
|
+
"registry/r",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"bin": {
|
|
30
|
+
"astro-auth-m8": "dist/bin/astro-auth-m8.js"
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": "./dist/src/integration.js",
|
|
34
|
+
"./api": "./dist/src/runtime/api/index.js",
|
|
35
|
+
"./client": "./dist/src/runtime/client.js",
|
|
36
|
+
"./schemas": "./dist/src/runtime/schemas.js",
|
|
37
|
+
"./hooks": "./dist/src/runtime/hooks/index.js",
|
|
38
|
+
"./list-params": "./dist/src/runtime/listParams.js",
|
|
39
|
+
"./react": "./dist/src/runtime/react/index.js",
|
|
40
|
+
"./default-ui": "./dist/src/runtime/react/default-ui/index.js",
|
|
41
|
+
"./routes": "./dist/src/runtime/routes.js",
|
|
42
|
+
"./routes/login.astro": "./src/routes/login.astro",
|
|
43
|
+
"./routes/signup.astro": "./src/routes/signup.astro",
|
|
44
|
+
"./routes/logout.astro": "./src/routes/logout.astro",
|
|
45
|
+
"./routes/callback.astro": "./src/routes/callback.astro",
|
|
46
|
+
"./routes/account.astro": "./src/routes/account.astro",
|
|
47
|
+
"./middleware": "./dist/src/middleware.js",
|
|
48
|
+
"./compatibility": "./dist/src/runtime/compatibility.js"
|
|
49
|
+
},
|
|
50
|
+
"types": "./dist/src/integration.d.ts",
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.json && npm run build:registry",
|
|
53
|
+
"build:registry": "node scripts/build-registry.mjs",
|
|
54
|
+
"test": "vitest run --coverage",
|
|
55
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
|
+
"test:unit": "vitest run"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"astro": "^5.0.0 || ^6.0.0",
|
|
60
|
+
"@tanstack/react-query": "5.101.1",
|
|
61
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
62
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
63
|
+
"zod": "^4.0.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^22.0.0",
|
|
67
|
+
"@types/react": "^19.0.0",
|
|
68
|
+
"@tanstack/react-query": "5.101.1",
|
|
69
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
70
|
+
"jsdom": "^29.1.1",
|
|
71
|
+
"typescript": "^5.8.0",
|
|
72
|
+
"vitest": "^4.1.9"
|
|
73
|
+
},
|
|
74
|
+
"overrides": {
|
|
75
|
+
"esbuild": "^0.28.1"
|
|
76
|
+
},
|
|
77
|
+
"faAuthM8": {
|
|
78
|
+
"contract": "fa-auth-m8@0.9",
|
|
79
|
+
"testedServiceVersion": "0.9.8",
|
|
80
|
+
"serviceVersionRange": ">=0.9.8 <0.10.0"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "account-dashboard",
|
|
4
|
+
"type": "registry:component",
|
|
5
|
+
"title": "Account Dashboard",
|
|
6
|
+
"description": "fa-auth account view whose first/landing tab is the activity dashboard; secondary tabs are wired by the consumer. Requires @fa-m8/astro-auth-m8 installed.",
|
|
7
|
+
"registryDependencies": [
|
|
8
|
+
"button",
|
|
9
|
+
"skeleton",
|
|
10
|
+
"navigation-menu",
|
|
11
|
+
"./node_modules/@fa-m8/astro-auth-m8/registry/r/dashboard-overview.json"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
{
|
|
15
|
+
"path": "registry/blocks/account/account-dashboard.tsx",
|
|
16
|
+
"content": "\"use client\";\n\n// fa-auth account view whose FIRST/landing tab is the activity dashboard.\n// Headless auth state comes from the package (@fa-m8/astro-auth-m8/react); this\n// file is only the shadcn skin and is copied into the consumer via the\n// @fa-m8-auth registry. Secondary tabs (profile/sessions/api-keys/admin) are\n// passed in by the consumer via `extraTabs`, so locale + app-specific panels\n// stay owned by the app. Edit freely per app.\nimport * as React from \"react\";\nimport { LayoutDashboard, LogOut } from \"lucide-react\";\nimport {\n AuthProvider,\n useAuth,\n type AuthContextValue,\n} from \"@fa-m8/astro-auth-m8/react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport {\n NavigationMenu,\n NavigationMenuItem,\n NavigationMenuList,\n} from \"@/components/ui/navigation-menu\";\nimport {\n DashboardOverview,\n type DashboardOverviewLabels,\n} from \"@/components/fa-auth/dashboard-overview\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface AccountTab {\n id: string;\n label: string;\n icon?: React.ComponentType<{ className?: string }>;\n content: React.ReactNode;\n /** Only render this tab when the signed-in user is a superuser. */\n superuserOnly?: boolean;\n}\n\nexport interface AccountDashboardLabels {\n dashboardTab: string;\n signOut: string;\n signInRequired: string;\n dashboard: Partial<DashboardOverviewLabels>;\n}\n\nconst DEFAULT_LABELS: AccountDashboardLabels = {\n dashboardTab: \"Dashboard\",\n signOut: \"Sign out\",\n signInRequired: \"Please sign in to view your account.\",\n dashboard: {},\n};\n\nexport interface AccountDashboardProps {\n /** Auth API base path; defaults to PUBLIC_FA_AUTH_API_BASE or \"/user\". */\n apiBase?: string;\n /** Dashboard scope: \"me\" (default) or \"global\" for superuser fleet stats. */\n scope?: \"me\" | \"global\";\n extraTabs?: AccountTab[];\n labels?: Partial<AccountDashboardLabels>;\n /** Rendered when the user is not authenticated. */\n signIn?: React.ReactNode;\n}\n\nfunction AccountShell({\n scope,\n extraTabs,\n labels,\n signIn,\n}: Required<Pick<AccountDashboardProps, \"scope\" | \"extraTabs\">> & {\n labels: AccountDashboardLabels;\n signIn?: React.ReactNode;\n}) {\n const { user, loading, logout }: AuthContextValue = useAuth();\n\n if (loading) {\n return (\n <div className=\"not-content mx-auto w-full max-w-6xl space-y-4\" aria-busy=\"true\">\n <Skeleton className=\"h-10 w-64\" />\n <Skeleton className=\"h-9 w-full max-w-md\" />\n <Skeleton className=\"h-72 w-full\" />\n </div>\n );\n }\n\n if (!user) {\n return (\n <div className=\"not-content mx-auto w-full max-w-md py-10 text-center text-sm text-muted-foreground\">\n {signIn ?? labels.signInRequired}\n </div>\n );\n }\n\n const visibleTabs = extraTabs.filter(\n (tab) => !tab.superuserOnly || user.is_superuser,\n );\n const [activeTab, setActiveTab] = React.useState<string>(\"dashboard\");\n const navItems = [\n {\n id: \"dashboard\",\n label: labels.dashboardTab,\n icon: LayoutDashboard,\n content: <DashboardOverview scope={scope} labels={labels.dashboard} />,\n },\n ...visibleTabs,\n ];\n const columnClass = navItems.length >= 5 ? \"lg:grid-cols-5\" : \"lg:grid-cols-4\";\n\n return (\n <div className=\"not-content mx-auto w-full max-w-6xl space-y-6\">\n <div className=\"flex flex-col gap-4 border-b pb-5 lg:flex-row lg:items-end lg:justify-between\">\n <div className=\"min-w-0 space-y-2\">\n <h1 className=\"text-2xl font-semibold tracking-tight md:text-3xl\">\n {user.email}\n </h1>\n <div className=\"flex flex-wrap items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n {user.role}\n </span>\n {user.is_superuser ? (\n <span className=\"rounded-md border px-2 py-0.5 text-xs uppercase tracking-wide\">\n superuser\n </span>\n ) : null}\n </div>\n </div>\n <Button\n variant=\"outline\"\n onClick={() => void logout()}\n className=\"w-full justify-center gap-2 sm:w-auto\"\n >\n <LogOut className=\"size-4\" />\n {labels.signOut}\n </Button>\n </div>\n\n <div className=\"space-y-4\">\n <NavigationMenu viewport={false} className=\"w-full max-w-none justify-stretch\">\n <NavigationMenuList\n className={cn(\n \"grid h-auto w-full grid-cols-1 items-stretch justify-stretch rounded-lg border border-border bg-muted/40 p-1 sm:grid-cols-2\",\n columnClass,\n )}\n >\n {navItems.map((tab) => {\n const Icon = tab.icon;\n const active = activeTab === tab.id;\n return (\n <NavigationMenuItem key={tab.id}>\n <button\n type=\"button\"\n aria-current={active ? \"page\" : undefined}\n className=\"inline-flex h-9 w-full min-w-0 items-center justify-center gap-2 rounded-md px-3 text-sm font-medium whitespace-nowrap transition-colors outline-none select-none hover:bg-background hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 data-[active=true]:bg-background data-[active=true]:text-foreground data-[active=true]:shadow-xs\"\n data-active={active}\n onClick={() => setActiveTab(tab.id)}\n >\n {Icon ? <Icon className=\"size-4 shrink-0\" /> : null}\n <span className=\"truncate\">{tab.label}</span>\n </button>\n </NavigationMenuItem>\n );\n })}\n </NavigationMenuList>\n </NavigationMenu>\n\n {navItems.map((tab) =>\n activeTab === tab.id ? <React.Fragment key={tab.id}>{tab.content}</React.Fragment> : null,\n )}\n </div>\n </div>\n );\n}\n\nexport default function AccountDashboard({\n apiBase,\n scope = \"me\",\n extraTabs = [],\n labels,\n signIn,\n}: AccountDashboardProps) {\n const resolved: AccountDashboardLabels = {\n ...DEFAULT_LABELS,\n ...labels,\n dashboard: { ...DEFAULT_LABELS.dashboard, ...labels?.dashboard },\n };\n const config = apiBase ? { apiBase } : undefined;\n return (\n <AuthProvider config={config}>\n <AccountShell\n scope={scope}\n extraTabs={extraTabs}\n labels={resolved}\n signIn={signIn}\n />\n </AuthProvider>\n );\n}\n",
|
|
17
|
+
"type": "registry:component",
|
|
18
|
+
"target": "components/fa-auth/account-dashboard.tsx"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|