@lastbrain/module-auth 2.0.27 → 2.0.31

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.
Files changed (179) hide show
  1. package/README.md +55 -7
  2. package/dist/api/admin/signup-stats.d.ts.map +1 -1
  3. package/dist/api/admin/signup-stats.js +2 -1
  4. package/dist/api/admin/storage/usage.d.ts +18 -0
  5. package/dist/api/admin/storage/usage.d.ts.map +1 -0
  6. package/dist/api/admin/storage/usage.js +100 -0
  7. package/dist/api/admin/users/[id]/notifications.d.ts.map +1 -1
  8. package/dist/api/admin/users/[id]/notifications.js +3 -2
  9. package/dist/api/admin/users/[id].d.ts.map +1 -1
  10. package/dist/api/admin/users/[id].js +3 -2
  11. package/dist/api/admin/users/reactivate/[id].d.ts +16 -0
  12. package/dist/api/admin/users/reactivate/[id].d.ts.map +1 -0
  13. package/dist/api/admin/users/reactivate/[id].js +59 -0
  14. package/dist/api/admin/users/suspend/[id].d.ts +16 -0
  15. package/dist/api/admin/users/suspend/[id].d.ts.map +1 -0
  16. package/dist/api/admin/users/suspend/[id].js +59 -0
  17. package/dist/api/admin/users-by-source.d.ts.map +1 -1
  18. package/dist/api/admin/users-by-source.js +2 -1
  19. package/dist/api/admin/users.d.ts.map +1 -1
  20. package/dist/api/admin/users.js +53 -2
  21. package/dist/api/auth/account/email-change.d.ts +7 -0
  22. package/dist/api/auth/account/email-change.d.ts.map +1 -0
  23. package/dist/api/auth/account/email-change.js +39 -0
  24. package/dist/api/auth/account/reset-password.d.ts +7 -0
  25. package/dist/api/auth/account/reset-password.d.ts.map +1 -0
  26. package/dist/api/auth/account/reset-password.js +36 -0
  27. package/dist/api/auth/check-username.d.ts +9 -0
  28. package/dist/api/auth/check-username.d.ts.map +1 -0
  29. package/dist/api/auth/check-username.js +35 -0
  30. package/dist/api/auth/establish-session.d.ts +2 -0
  31. package/dist/api/auth/establish-session.d.ts.map +1 -0
  32. package/dist/api/auth/establish-session.js +23 -0
  33. package/dist/api/auth/me.d.ts +4 -4
  34. package/dist/api/auth/me.d.ts.map +1 -1
  35. package/dist/api/auth/me.js +28 -6
  36. package/dist/api/auth/profile.d.ts.map +1 -1
  37. package/dist/api/auth/profile.js +6 -3
  38. package/dist/api/auth/storage/recalculate.d.ts +15 -0
  39. package/dist/api/auth/storage/recalculate.d.ts.map +1 -0
  40. package/dist/api/auth/storage/recalculate.js +68 -0
  41. package/dist/api/auth/storage/usage.d.ts +10 -0
  42. package/dist/api/auth/storage/usage.d.ts.map +1 -0
  43. package/dist/api/auth/storage/usage.js +86 -0
  44. package/dist/api/public/add-welcome-bonus.d.ts +16 -0
  45. package/dist/api/public/add-welcome-bonus.d.ts.map +1 -0
  46. package/dist/api/public/add-welcome-bonus.js +177 -0
  47. package/dist/api/public/callback.d.ts +3 -0
  48. package/dist/api/public/callback.d.ts.map +1 -0
  49. package/dist/api/public/callback.js +197 -0
  50. package/dist/api/public/reset-password.d.ts +3 -0
  51. package/dist/api/public/reset-password.d.ts.map +1 -0
  52. package/dist/api/public/reset-password.js +43 -0
  53. package/dist/api/public/set-session.d.ts +7 -0
  54. package/dist/api/public/set-session.d.ts.map +1 -0
  55. package/dist/api/public/set-session.js +55 -0
  56. package/dist/api/public/signin.d.ts.map +1 -1
  57. package/dist/api/public/signin.js +31 -0
  58. package/dist/api/public/signup.d.ts.map +1 -1
  59. package/dist/api/public/signup.js +38 -27
  60. package/dist/api/public/webhook/storage-addon.d.ts +9 -0
  61. package/dist/api/public/webhook/storage-addon.d.ts.map +1 -0
  62. package/dist/api/public/webhook/storage-addon.js +155 -0
  63. package/dist/api/storage.js +2 -2
  64. package/dist/auth.build.config.d.ts.map +1 -1
  65. package/dist/auth.build.config.js +126 -11
  66. package/dist/components/AccountButton.d.ts.map +1 -1
  67. package/dist/components/AccountButton.js +54 -28
  68. package/dist/components/Doc.d.ts.map +1 -1
  69. package/dist/components/Doc.js +1 -1
  70. package/dist/components/HasProfil.d.ts +4 -0
  71. package/dist/components/HasProfil.d.ts.map +1 -0
  72. package/dist/components/HasProfil.js +39 -0
  73. package/dist/components/auth/dashboard.d.ts +1 -1
  74. package/dist/components/auth/dashboard.d.ts.map +1 -1
  75. package/dist/components/auth/dashboard.js +34 -7
  76. package/dist/index.d.ts +2 -0
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +2 -0
  79. package/dist/lib/app-branding-data.d.ts +22 -0
  80. package/dist/lib/app-branding-data.d.ts.map +1 -0
  81. package/dist/lib/app-branding-data.js +49 -0
  82. package/dist/lib/auth-email-service.d.ts +57 -0
  83. package/dist/lib/auth-email-service.d.ts.map +1 -0
  84. package/dist/lib/auth-email-service.js +382 -0
  85. package/dist/lib/auth-email-templates.d.ts +2 -0
  86. package/dist/lib/auth-email-templates.d.ts.map +1 -0
  87. package/dist/lib/auth-email-templates.js +1 -0
  88. package/dist/lib/site-url.d.ts +3 -0
  89. package/dist/lib/site-url.d.ts.map +1 -0
  90. package/dist/lib/site-url.js +11 -0
  91. package/dist/sitemap/manifest.d.ts +9 -0
  92. package/dist/sitemap/manifest.d.ts.map +1 -0
  93. package/dist/sitemap/manifest.js +14 -0
  94. package/dist/web/admin/signup-stats.js +3 -3
  95. package/dist/web/admin/user-detail.d.ts.map +1 -1
  96. package/dist/web/admin/user-detail.js +135 -14
  97. package/dist/web/admin/users-by-signup-source.js +2 -2
  98. package/dist/web/admin/users.d.ts.map +1 -1
  99. package/dist/web/admin/users.js +26 -7
  100. package/dist/web/auth/folder.d.ts.map +1 -1
  101. package/dist/web/auth/folder.js +4 -3
  102. package/dist/web/auth/profile.d.ts.map +1 -1
  103. package/dist/web/auth/profile.js +132 -13
  104. package/dist/web/auth/reglage.d.ts.map +1 -1
  105. package/dist/web/auth/reglage.js +15 -8
  106. package/dist/web/public/ResetPassword.d.ts.map +1 -1
  107. package/dist/web/public/ResetPassword.js +172 -2
  108. package/dist/web/public/SignInPage.d.ts.map +1 -1
  109. package/dist/web/public/SignInPage.js +39 -3
  110. package/dist/web/public/SignUpPage.d.ts.map +1 -1
  111. package/dist/web/public/SignUpPage.js +7 -2
  112. package/dist/web/public/auth-code-error.d.ts +2 -0
  113. package/dist/web/public/auth-code-error.d.ts.map +1 -0
  114. package/dist/web/public/auth-code-error.js +14 -0
  115. package/dist/web/public/confirm.d.ts +2 -0
  116. package/dist/web/public/confirm.d.ts.map +1 -0
  117. package/dist/web/public/confirm.js +157 -0
  118. package/package.json +10 -5
  119. package/src/api/admin/signup-stats.ts +2 -1
  120. package/src/api/admin/storage/usage.ts +141 -0
  121. package/src/api/admin/users/[id]/notifications.ts +3 -2
  122. package/src/api/admin/users/[id].ts +3 -2
  123. package/src/api/admin/users/reactivate/[id].ts +88 -0
  124. package/src/api/admin/users/suspend/[id].ts +85 -0
  125. package/src/api/admin/users-by-source.ts +2 -1
  126. package/src/api/admin/users.ts +59 -2
  127. package/src/api/auth/account/email-change.ts +54 -0
  128. package/src/api/auth/account/reset-password.ts +47 -0
  129. package/src/api/auth/check-username.ts +52 -0
  130. package/src/api/auth/establish-session.ts +32 -0
  131. package/src/api/auth/me.ts +29 -7
  132. package/src/api/auth/profile.ts +6 -2
  133. package/src/api/auth/storage/recalculate.ts +108 -0
  134. package/src/api/auth/storage/usage.ts +113 -0
  135. package/src/api/public/add-welcome-bonus.ts +229 -0
  136. package/src/api/public/callback.ts +307 -0
  137. package/src/api/public/reset-password.ts +52 -0
  138. package/src/api/public/set-session.ts +73 -0
  139. package/src/api/public/signin.ts +36 -0
  140. package/src/api/public/signup.ts +44 -37
  141. package/src/api/public/webhook/storage-addon.ts +267 -0
  142. package/src/api/storage.ts +2 -2
  143. package/src/auth.build.config.ts +126 -11
  144. package/src/components/AccountButton.tsx +114 -90
  145. package/src/components/Doc.tsx +47 -9
  146. package/src/components/HasProfil.tsx +63 -0
  147. package/src/components/auth/dashboard.tsx +54 -13
  148. package/src/i18n/en.json +76 -8
  149. package/src/i18n/es.json +330 -0
  150. package/src/i18n/fr.json +74 -8
  151. package/src/index.ts +2 -0
  152. package/src/lib/app-branding-data.ts +90 -0
  153. package/src/lib/auth-email-service.ts +508 -0
  154. package/src/lib/auth-email-templates.ts +5 -0
  155. package/src/lib/site-url.ts +17 -0
  156. package/src/sitemap/manifest.ts +26 -0
  157. package/src/web/admin/signup-stats.tsx +3 -3
  158. package/src/web/admin/user-detail.tsx +314 -15
  159. package/src/web/admin/users-by-signup-source.tsx +2 -2
  160. package/src/web/admin/users.tsx +50 -14
  161. package/src/web/auth/folder.tsx +23 -5
  162. package/src/web/auth/profile.tsx +227 -13
  163. package/src/web/auth/reglage.tsx +55 -24
  164. package/src/web/public/ResetPassword.tsx +301 -1
  165. package/src/web/public/SignInPage.tsx +43 -3
  166. package/src/web/public/SignUpPage.tsx +14 -5
  167. package/src/web/public/auth-code-error.tsx +49 -0
  168. package/src/web/public/confirm.tsx +195 -0
  169. package/supabase/migrations/20251112000001_auto_profile_and_admin_view.sql +3 -1
  170. package/supabase/migrations/20251127100000_rename_body_to_message.sql +8 -3
  171. package/supabase/migrations/20260120150001_add_user_storage.sql +105 -0
  172. package/supabase/migrations/20260122131200_add_global_addons_system.sql +305 -0
  173. package/supabase/migrations/20260123100000_enable_vector_extension.sql +9 -0
  174. package/supabase/migrations/20260123140000_module_auth_fix_get_user_limits_null.sql +93 -0
  175. package/supabase/migrations/20260123145000_module_auth_fix_circular_storage_base.sql +89 -0
  176. package/supabase/migrations/20260129400000_add_username_to_user_profil.sql +33 -0
  177. package/dist/web/auth/dashboard.d.ts +0 -2
  178. package/dist/web/auth/dashboard.d.ts.map +0 -1
  179. package/dist/web/auth/dashboard.js +0 -48
@@ -0,0 +1,267 @@
1
+ /**
2
+ * POST /api/auth/webhook/storage-addon
3
+ * Webhook handler for storage addon subscription events
4
+ * Called by module-billing-pro when a storage addon subscription item is updated
5
+ */
6
+
7
+ import { getSupabaseServiceClient } from "@lastbrain/core/server";
8
+ import { logger } from "@lastbrain/core";
9
+
10
+ // Runtime config
11
+ export const runtime = "nodejs";
12
+ export const dynamic = "force-dynamic";
13
+
14
+ interface StorageAddonWebhookPayload {
15
+ eventType: string;
16
+ owner_id: string;
17
+ addon_key: string; // e.g., "storage_8gb"
18
+ stripe_subscription_id: string;
19
+ stripe_subscription_item_id: string;
20
+ stripe_customer_id?: string;
21
+ quantity?: number;
22
+ status: string; // active, trialing, canceled, past_due, etc.
23
+ current_period_start?: string;
24
+ current_period_end?: string;
25
+ }
26
+
27
+ export async function POST(request: Request) {
28
+ try {
29
+ const body: StorageAddonWebhookPayload = await request.json();
30
+
31
+ const {
32
+ eventType,
33
+ owner_id,
34
+ addon_key,
35
+ stripe_subscription_id,
36
+ stripe_subscription_item_id,
37
+ stripe_customer_id,
38
+ quantity = 1,
39
+ status,
40
+ current_period_start,
41
+ current_period_end,
42
+ } = body;
43
+
44
+ logger.debug(
45
+ `[Storage Addon Webhook] Processing ${eventType} for user ${owner_id}, addon ${addon_key}`
46
+ );
47
+
48
+ if (
49
+ !owner_id ||
50
+ !addon_key ||
51
+ !stripe_subscription_id ||
52
+ !stripe_subscription_item_id
53
+ ) {
54
+ logger.warn("[Storage Addon Webhook] Missing required fields in payload");
55
+ return Response.json({ received: true }, { status: 200 });
56
+ }
57
+
58
+ const supabase = await getSupabaseServiceClient();
59
+
60
+ // Find the addon by key
61
+ const { data: addon, error: addonError } = await supabase
62
+ .from("global_addons")
63
+ .select("id")
64
+ .eq("addon_key", addon_key)
65
+ .eq("addon_type", "storage")
66
+ .eq("is_active", true)
67
+ .single();
68
+
69
+ if (addonError || !addon) {
70
+ logger.warn(
71
+ `[Storage Addon Webhook] Addon not found for key: ${addon_key}`
72
+ );
73
+ return Response.json({ received: true }, { status: 200 });
74
+ }
75
+
76
+ // Handle different event types
77
+ switch (eventType) {
78
+ case "addon.created":
79
+ case "addon.updated": {
80
+ // Upsert user addon activation
81
+ // Use owner_id + addon_id as the unique key (one addon type per user)
82
+ // When a subscription is canceled and recreated, we update the same record with new stripe IDs
83
+ const { error: upsertError } = await supabase
84
+ .from("user_global_addons")
85
+ .upsert(
86
+ {
87
+ owner_id,
88
+ addon_id: addon.id,
89
+ quantity,
90
+ status,
91
+ current_period_start,
92
+ current_period_end,
93
+ stripe_customer_id,
94
+ stripe_subscription_id,
95
+ stripe_subscription_item_id,
96
+ updated_at: new Date().toISOString(),
97
+ },
98
+ {
99
+ // Use owner_id + addon_id as the unique key for idempotency
100
+ // This ensures one addon per user, even if subscription is recreated
101
+ onConflict: "owner_id,addon_id",
102
+ }
103
+ );
104
+
105
+ if (upsertError) {
106
+ logger.error(
107
+ "[Storage Addon Webhook] Error upserting addon:",
108
+ upsertError
109
+ );
110
+ return Response.json(
111
+ { error: "Failed to update storage addon" },
112
+ { status: 500 }
113
+ );
114
+ }
115
+
116
+ logger.debug(
117
+ `[Storage Addon Webhook] Storage addon ${addon_key} ${eventType} for user ${owner_id}: status=${status}, quantity=${quantity}`
118
+ );
119
+
120
+ // Update user_profil.stockage to reflect total (optional, since get_user_limits calculates dynamically)
121
+ // We'll keep this for backward compatibility with existing code
122
+ try {
123
+ const limitsResult = await supabase.rpc("get_user_limits", {
124
+ owner_id_param: owner_id,
125
+ });
126
+
127
+ logger.debug(
128
+ `[Storage Addon Webhook] get_user_limits raw result:`,
129
+ JSON.stringify(limitsResult, null, 2)
130
+ );
131
+
132
+ if (limitsResult.error) {
133
+ logger.error(
134
+ `[Storage Addon Webhook] get_user_limits error:`,
135
+ limitsResult.error
136
+ );
137
+ }
138
+
139
+ if (limitsResult.data) {
140
+ // Supabase RPC returns JSON as string, need to parse if string
141
+ const limitsData =
142
+ typeof limitsResult.data === "string"
143
+ ? JSON.parse(limitsResult.data)
144
+ : limitsResult.data;
145
+
146
+ logger.debug(
147
+ `[Storage Addon Webhook] Parsed limits data:`,
148
+ limitsData
149
+ );
150
+
151
+ const totalStorageGb = limitsData.storage_quota_gb;
152
+
153
+ logger.debug(
154
+ `[Storage Addon Webhook] Extracted storage_quota_gb: ${totalStorageGb}`
155
+ );
156
+
157
+ // Update user_profil with new total
158
+ await supabase.from("user_profil").upsert(
159
+ {
160
+ owner_id,
161
+ stockage: totalStorageGb,
162
+ updated_at: new Date().toISOString(),
163
+ },
164
+ {
165
+ onConflict: "owner_id",
166
+ }
167
+ );
168
+
169
+ logger.debug(
170
+ `[Storage Addon Webhook] Updated user_profil.stockage to ${totalStorageGb} GB for user ${owner_id}`
171
+ );
172
+ } else {
173
+ logger.warn(
174
+ `[Storage Addon Webhook] get_user_limits returned no data for user ${owner_id}`
175
+ );
176
+ }
177
+ } catch (error) {
178
+ logger.error(
179
+ "[Storage Addon Webhook] Error updating user_profil.stockage:",
180
+ error
181
+ );
182
+ // Don't fail - the addon is still recorded
183
+ }
184
+
185
+ break;
186
+ }
187
+
188
+ case "addon.deleted":
189
+ case "addon.canceled": {
190
+ // Mark addon as canceled but keep for period_end grace
191
+ const { error: cancelError } = await supabase
192
+ .from("user_global_addons")
193
+ .update({
194
+ status: "canceled",
195
+ updated_at: new Date().toISOString(),
196
+ })
197
+ .eq("stripe_subscription_item_id", stripe_subscription_item_id);
198
+
199
+ if (cancelError) {
200
+ logger.error(
201
+ "[Storage Addon Webhook] Error canceling addon:",
202
+ cancelError
203
+ );
204
+ return Response.json(
205
+ { error: "Failed to cancel storage addon" },
206
+ { status: 500 }
207
+ );
208
+ }
209
+
210
+ logger.debug(
211
+ `[Storage Addon Webhook] Storage addon ${addon_key} canceled for user ${owner_id}`
212
+ );
213
+
214
+ // Recalculate total storage
215
+ try {
216
+ const limitsResult = await supabase.rpc("get_user_limits", {
217
+ owner_id_param: owner_id,
218
+ });
219
+
220
+ if (limitsResult.data) {
221
+ const limitsData =
222
+ typeof limitsResult.data === "string"
223
+ ? JSON.parse(limitsResult.data)
224
+ : limitsResult.data;
225
+
226
+ const totalStorageGb = limitsData.storage_quota_gb;
227
+
228
+ await supabase.from("user_profil").upsert(
229
+ {
230
+ owner_id,
231
+ stockage: totalStorageGb,
232
+ updated_at: new Date().toISOString(),
233
+ },
234
+ {
235
+ onConflict: "owner_id",
236
+ }
237
+ );
238
+
239
+ logger.debug(
240
+ `[Storage Addon Webhook] Recalculated user_profil.stockage to ${totalStorageGb} GB after addon cancellation`
241
+ );
242
+ }
243
+ } catch (error) {
244
+ logger.warn(
245
+ "[Storage Addon Webhook] Could not recalculate storage:",
246
+ error
247
+ );
248
+ }
249
+
250
+ break;
251
+ }
252
+
253
+ default:
254
+ logger.warn(`[Storage Addon Webhook] Unknown event type: ${eventType}`);
255
+ }
256
+
257
+ return Response.json({ received: true }, { status: 200 });
258
+ } catch (error) {
259
+ logger.error("[Storage Addon Webhook] Error:", error);
260
+ return Response.json(
261
+ {
262
+ error: error instanceof Error ? error.message : "Webhook error",
263
+ },
264
+ { status: 400 }
265
+ );
266
+ }
267
+ }
@@ -1,4 +1,4 @@
1
- import { supabaseBrowserClient } from "@lastbrain/core";
1
+ import { logger, supabaseBrowserClient } from "@lastbrain/core";
2
2
 
3
3
  /**
4
4
  * Upload a file to Supabase Storage and return proxy URL
@@ -55,7 +55,7 @@ export async function deleteFilesWithPrefix(
55
55
  });
56
56
 
57
57
  if (listError) {
58
- console.warn("Failed to list files for deletion:", listError);
58
+ logger.warn("Failed to list files for deletion:", listError);
59
59
  return;
60
60
  }
61
61
 
@@ -18,6 +18,16 @@ const authBuildConfig: ModuleBuildConfig = {
18
18
  path: "/reset-password",
19
19
  componentExport: "ResetPassword",
20
20
  },
21
+ {
22
+ section: "public",
23
+ path: "/confirm",
24
+ componentExport: "ConfirmPage",
25
+ },
26
+ {
27
+ section: "public",
28
+ path: "/auth-code-error",
29
+ componentExport: "AuthCodeErrorPage",
30
+ },
21
31
  {
22
32
  section: "auth",
23
33
  path: "/folder",
@@ -64,6 +74,34 @@ const authBuildConfig: ModuleBuildConfig = {
64
74
  entryPoint: "api/public/signup",
65
75
  authRequired: false,
66
76
  },
77
+ {
78
+ method: "POST",
79
+ path: "/api/public/set-session",
80
+ handlerExport: "POST",
81
+ entryPoint: "api/public/set-session",
82
+ authRequired: false,
83
+ },
84
+ {
85
+ method: "POST",
86
+ path: "/api/public/add-welcome-bonus",
87
+ handlerExport: "POST",
88
+ entryPoint: "api/public/add-welcome-bonus",
89
+ authRequired: true,
90
+ },
91
+ {
92
+ method: "POST",
93
+ path: "/api/public/reset-password",
94
+ handlerExport: "POST",
95
+ entryPoint: "api/public/reset-password",
96
+ authRequired: false,
97
+ },
98
+ {
99
+ method: "GET",
100
+ path: "/api/public/callback",
101
+ handlerExport: "GET",
102
+ entryPoint: "api/public/callback",
103
+ authRequired: false,
104
+ },
67
105
  {
68
106
  method: "GET",
69
107
  path: "/api/auth/profile",
@@ -85,6 +123,13 @@ const authBuildConfig: ModuleBuildConfig = {
85
123
  entryPoint: "api/auth/profile",
86
124
  authRequired: true,
87
125
  },
126
+ {
127
+ method: "GET",
128
+ path: "/api/auth/check-username",
129
+ handlerExport: "GET",
130
+ entryPoint: "api/auth/check-username",
131
+ authRequired: false,
132
+ },
88
133
  {
89
134
  method: "GET",
90
135
  path: "/api/auth/me",
@@ -92,6 +137,20 @@ const authBuildConfig: ModuleBuildConfig = {
92
137
  entryPoint: "api/auth/me",
93
138
  authRequired: true,
94
139
  },
140
+ {
141
+ method: "POST",
142
+ path: "/api/auth/account/email-change",
143
+ handlerExport: "POST",
144
+ entryPoint: "api/auth/account/email-change",
145
+ authRequired: true,
146
+ },
147
+ {
148
+ method: "POST",
149
+ path: "/api/auth/account/reset-password",
150
+ handlerExport: "POST",
151
+ entryPoint: "api/auth/account/reset-password",
152
+ authRequired: true,
153
+ },
95
154
  {
96
155
  method: "GET",
97
156
  path: "/api/admin/users",
@@ -113,6 +172,20 @@ const authBuildConfig: ModuleBuildConfig = {
113
172
  entryPoint: "api/admin/users/[id]/notifications",
114
173
  authRequired: true,
115
174
  },
175
+ {
176
+ method: "POST",
177
+ path: "/api/admin/users/suspend/[id]",
178
+ handlerExport: "POST",
179
+ entryPoint: "api/admin/users/suspend/[id]",
180
+ authRequired: true,
181
+ },
182
+ {
183
+ method: "POST",
184
+ path: "/api/admin/users/reactivate/[id]",
185
+ handlerExport: "POST",
186
+ entryPoint: "api/admin/users/reactivate/[id]",
187
+ authRequired: true,
188
+ },
116
189
  {
117
190
  method: "GET",
118
191
  path: "/api/admin/signup-stats",
@@ -120,6 +193,34 @@ const authBuildConfig: ModuleBuildConfig = {
120
193
  entryPoint: "api/admin/signup-stats",
121
194
  authRequired: true,
122
195
  },
196
+ {
197
+ method: "GET",
198
+ path: "/api/admin/storage/usage",
199
+ handlerExport: "GET",
200
+ entryPoint: "api/admin/storage/usage",
201
+ authRequired: true,
202
+ },
203
+ {
204
+ method: "GET",
205
+ path: "/api/auth/storage/usage",
206
+ handlerExport: "GET",
207
+ entryPoint: "api/auth/storage/usage",
208
+ authRequired: true,
209
+ },
210
+ {
211
+ method: "POST",
212
+ path: "/api/auth/storage/recalculate",
213
+ handlerExport: "POST",
214
+ entryPoint: "api/auth/storage/recalculate",
215
+ authRequired: true,
216
+ },
217
+ {
218
+ method: "POST",
219
+ path: "/api/auth/webhook/storage-addon",
220
+ handlerExport: "POST",
221
+ entryPoint: "api/public/webhook/storage-addon",
222
+ authRequired: false,
223
+ },
123
224
  ],
124
225
  migrations: {
125
226
  enabled: true,
@@ -130,6 +231,13 @@ const authBuildConfig: ModuleBuildConfig = {
130
231
  "20251112000001_auto_profile_and_admin_view.sql",
131
232
  "20251112000002_sync_avatars.sql",
132
233
  "20251124000001_add_get_admin_user_details.sql",
234
+ "20251127100000_rename_body_to_message.sql",
235
+ "20260120150001_add_user_storage.sql",
236
+ "20260122131200_add_global_addons_system.sql",
237
+ "20260123100000_enable_vector_extension.sql",
238
+ "20260123140000_module_auth_fix_get_user_limits_null.sql",
239
+ "20260123145000_module_auth_fix_circular_storage_base.sql",
240
+ "20260129400000_add_username_to_user_profil.sql"
133
241
  ],
134
242
  migrationsDownPath: "supabase/migrations-down",
135
243
  },
@@ -155,16 +263,16 @@ const authBuildConfig: ModuleBuildConfig = {
155
263
  position: "end",
156
264
  componentExport: "AccountButton",
157
265
  },
158
- {
159
- title: "module-auth.menu.theme",
160
- description: "module-auth.menu.theme_desc",
161
- icon: "Palette",
162
- path: "#",
163
- order: 9999,
164
- type: "icon",
165
- position: "end",
166
- componentExport: "ThemeSwitcherButton",
167
- },
266
+ // {
267
+ // title: "module-auth.menu.theme",
268
+ // description: "module-auth.menu.theme_desc",
269
+ // icon: "Palette",
270
+ // path: "#",
271
+ // order: 9999,
272
+ // type: "icon",
273
+ // position: "end",
274
+ // componentExport: "ThemeSwitcherButton",
275
+ // },
168
276
  ],
169
277
  admin: [
170
278
  {
@@ -280,7 +388,7 @@ const authBuildConfig: ModuleBuildConfig = {
280
388
  description: "module-auth.menu.settings_desc",
281
389
  icon: "Settings",
282
390
  path: "/auth/reglage",
283
- order: 2,
391
+ order: 70,
284
392
  shortcut: "cmd+shift+s",
285
393
  shortcutDisplay: "⌘⇧S",
286
394
  },
@@ -303,6 +411,13 @@ const authBuildConfig: ModuleBuildConfig = {
303
411
  filter: "owner_id=eq.${USER_ID}",
304
412
  broadcast: "user_notifications_updated",
305
413
  },
414
+ {
415
+ schema: "public",
416
+ table: "user_profil",
417
+ event: "*",
418
+ filter: "owner_id=eq.${USER_ID}",
419
+ broadcast: "user_profile_updated",
420
+ },
306
421
  ],
307
422
  },
308
423
  authDashboard: [