@nextblock-cms/db 0.12.13 → 0.12.14

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.
@@ -1719,7 +1719,6 @@ export declare const getServiceRoleSupabaseClient: () => import('@supabase/supab
1719
1719
  Row: {
1720
1720
  avatar_url: string | null;
1721
1721
  full_name: string | null;
1722
- github_username: string | null;
1723
1722
  id: string;
1724
1723
  phone: string | null;
1725
1724
  role: Database["public"]["Enums"]["user_role"];
@@ -1729,7 +1728,6 @@ export declare const getServiceRoleSupabaseClient: () => import('@supabase/supab
1729
1728
  Insert: {
1730
1729
  avatar_url?: string | null;
1731
1730
  full_name?: string | null;
1732
- github_username?: string | null;
1733
1731
  id: string;
1734
1732
  phone?: string | null;
1735
1733
  role?: Database["public"]["Enums"]["user_role"];
@@ -1739,7 +1737,6 @@ export declare const getServiceRoleSupabaseClient: () => import('@supabase/supab
1739
1737
  Update: {
1740
1738
  avatar_url?: string | null;
1741
1739
  full_name?: string | null;
1742
- github_username?: string | null;
1743
1740
  id?: string;
1744
1741
  phone?: string | null;
1745
1742
  role?: Database["public"]["Enums"]["user_role"];
@@ -1787,7 +1787,6 @@ export type Database = {
1787
1787
  Row: {
1788
1788
  avatar_url: string | null;
1789
1789
  full_name: string | null;
1790
- github_username: string | null;
1791
1790
  id: string;
1792
1791
  phone: string | null;
1793
1792
  role: Database["public"]["Enums"]["user_role"];
@@ -1797,7 +1796,6 @@ export type Database = {
1797
1796
  Insert: {
1798
1797
  avatar_url?: string | null;
1799
1798
  full_name?: string | null;
1800
- github_username?: string | null;
1801
1799
  id: string;
1802
1800
  phone?: string | null;
1803
1801
  role?: Database["public"]["Enums"]["user_role"];
@@ -1807,7 +1805,6 @@ export type Database = {
1807
1805
  Update: {
1808
1806
  avatar_url?: string | null;
1809
1807
  full_name?: string | null;
1810
- github_username?: string | null;
1811
1808
  id?: string;
1812
1809
  phone?: string | null;
1813
1810
  role?: Database["public"]["Enums"]["user_role"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/db",
3
- "version": "0.12.13",
3
+ "version": "0.12.14",
4
4
  "main": "index.cjs.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -167,14 +167,17 @@ otp_expiry = 3600
167
167
  # Use a production-ready SMTP server.
168
168
  # For hosted Supabase projects, prefer `npm run configure:supabase-auth`, which reads
169
169
  # SMTP_* from your env file and pushes the settings plus branded templates automatically.
170
- # For local/self-hosted Supabase, you can uncomment this block and keep using env() values.
171
- [auth.email.smtp]
172
- host = "env(SMTP_HOST)"
173
- port = "env(SMTP_PORT)"
174
- user = "env(SMTP_USER)"
175
- pass = "env(SMTP_PASS)"
176
- admin_email = "env(SMTP_FROM_EMAIL)"
177
- sender_name = "env(SMTP_FROM_NAME)"
170
+ # For local/self-hosted Supabase, uncomment this block and set the SMTP_* env vars — note
171
+ # that `port` must resolve to a valid number, so an unset SMTP_PORT breaks `supabase db push`.
172
+ # Left commented by default so a hosted `npm run db:migrate` (which does not push config) works
173
+ # with no SMTP env vars set; local dev falls back to the Inbucket test inbox.
174
+ # [auth.email.smtp]
175
+ # host = "env(SMTP_HOST)"
176
+ # port = "env(SMTP_PORT)"
177
+ # user = "env(SMTP_USER)"
178
+ # pass = "env(SMTP_PASS)"
179
+ # admin_email = "env(SMTP_FROM_EMAIL)"
180
+ # sender_name = "env(SMTP_FROM_NAME)"
178
181
 
179
182
  [auth.email.template.confirmation]
180
183
  subject = "Confirm your email"
@@ -0,0 +1,79 @@
1
+ -- Drop the github_username profile column and remove the GitHub-auth artifacts.
2
+ --
3
+ -- GitHub OAuth sign-in / account-linking was removed from the app: it cannot be
4
+ -- provisioned as part of a one-click deployment (each install needs its own GitHub
5
+ -- OAuth app + client secret + Supabase's manual-linking toggle, none of which can
6
+ -- ship in a migration). github_username was only ever populated from that OAuth
7
+ -- flow, so the column and its seed strings are now dead.
8
+ --
9
+ -- NOTE: the self-update "Connect GitHub" flow (lib/updates/*, ConnectGitHubButton)
10
+ -- is a separate feature and is intentionally left untouched — the connect_github
11
+ -- translation is kept for it.
12
+
13
+ -- 1. Rewrite handle_new_user() so new signups no longer read/populate github_username.
14
+ CREATE OR REPLACE FUNCTION public.handle_new_user() RETURNS trigger
15
+ LANGUAGE plpgsql SECURITY DEFINER
16
+ SET search_path TO 'public'
17
+ AS $$
18
+ DECLARE
19
+ admin_flag_set boolean := false;
20
+ user_role public.user_role;
21
+ v_full_name text;
22
+ v_avatar_url text;
23
+ BEGIN
24
+ INSERT INTO public.site_settings (key, value)
25
+ VALUES ('is_admin_created', 'false'::jsonb)
26
+ ON CONFLICT (key) DO NOTHING;
27
+
28
+ SELECT COALESCE(value::jsonb::boolean, false)
29
+ INTO admin_flag_set
30
+ FROM public.site_settings
31
+ WHERE key = 'is_admin_created'
32
+ FOR UPDATE;
33
+
34
+ IF admin_flag_set = false THEN
35
+ user_role := 'ADMIN'::public.user_role;
36
+
37
+ UPDATE public.site_settings
38
+ SET value = 'true'::jsonb
39
+ WHERE key = 'is_admin_created';
40
+ ELSE
41
+ user_role := 'USER'::public.user_role;
42
+ END IF;
43
+
44
+ v_full_name := NEW.raw_user_meta_data->>'full_name';
45
+ v_avatar_url := NEW.raw_user_meta_data->>'avatar_url';
46
+
47
+ INSERT INTO public.profiles (
48
+ id,
49
+ role,
50
+ full_name,
51
+ avatar_url
52
+ )
53
+ VALUES (
54
+ NEW.id,
55
+ user_role,
56
+ v_full_name,
57
+ v_avatar_url
58
+ )
59
+ ON CONFLICT (id) DO UPDATE SET
60
+ full_name = EXCLUDED.full_name,
61
+ avatar_url = EXCLUDED.avatar_url;
62
+
63
+ RETURN NEW;
64
+ END;
65
+ $$;
66
+
67
+ -- 2. Drop the column now that nothing writes it.
68
+ ALTER TABLE public.profiles DROP COLUMN IF EXISTS github_username;
69
+
70
+ -- 3. Remove the GitHub-auth-only translation strings. connect_github is intentionally
71
+ -- kept — it is still used by the self-update "Connect GitHub" button.
72
+ DELETE FROM public.translations
73
+ WHERE key IN (
74
+ 'continue_with_github',
75
+ 'github_username',
76
+ 'github_username_help',
77
+ 'github_link_failed',
78
+ 'github_connected'
79
+ );