@nextblock-cms/db 0.0.5 → 0.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/db",
3
- "version": "0.0.5",
3
+ "version": "0.1.0",
4
4
  "main": "index.cjs.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
package/server.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@supabase/ssr"),c=require("next/headers"),u=require("./ssg-client-CiaENGEv.js"),d="This module cannot be imported from a Client Component module. It should only be used from a Server Component.";if(typeof window<"u")throw new Error(d);const n=()=>{const r=process.env.NEXT_PUBLIC_SUPABASE_URL,t=process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!r||!t)throw new Error("Missing Supabase environment variables");return l.createServerClient(r,t,{cookies:{getAll:async()=>{try{return(await c.cookies()).getAll()}catch{return[]}},setAll:async e=>{try{const o=await c.cookies();for(const{name:a,value:s,options:i}of e)s&&s.length>0?o.set({name:a,value:s,...i}):o.delete({name:a,...i})}catch{}}}})};async function g(r){const t=n(),{data:e,error:o}=await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id",r).single();return o||!e?(console.error("Error fetching profile (server-side):",o?.message),null):e}async function S(){const r=n(),{data:t,error:e}=await r.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name",{ascending:!0});return e?(console.error("Error fetching languages (server-side):",e.message),[]):t||[]}exports.getSsgSupabaseClient=u.getSsgSupabaseClient;exports.createClient=n;exports.getActiveLanguagesServerSide=S;exports.getProfileWithRoleServerSide=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@supabase/ssr"),c=require("next/headers"),u=require("./ssg-client-CiaENGEv.js"),d="This module cannot be imported from a Client Component module. It should only be used from a Server Component.";if(typeof window<"u")throw new Error(d);const i=()=>{const r=process.env.NEXT_PUBLIC_SUPABASE_URL,t=process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!r||!t)throw new Error("Missing Supabase environment variables");return l.createServerClient(r,t,{cookies:{getAll:async()=>{try{return(await c.cookies()).getAll()}catch{return[]}},setAll:async e=>{try{const o=await c.cookies();for(const{name:n,value:a,options:s}of e)a&&a.length>0?o.set({name:n,value:a,...s}):s&&Object.keys(s).length>0?o.delete({name:n,...s}):o.delete(n)}catch{}}}})};async function g(r){const t=i(),{data:e,error:o}=await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id",r).single();return o||!e?(console.error("Error fetching profile (server-side):",o?.message),null):e}async function f(){const r=i(),{data:t,error:e}=await r.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name",{ascending:!0});return e?(console.error("Error fetching languages (server-side):",e.message),[]):t||[]}exports.getSsgSupabaseClient=u.getSsgSupabaseClient;exports.createClient=i;exports.getActiveLanguagesServerSide=f;exports.getProfileWithRoleServerSide=g;
package/server.es.js CHANGED
@@ -5,12 +5,12 @@ const u = "This module cannot be imported from a Client Component module. It sho
5
5
  if (typeof window < "u")
6
6
  throw new Error(u);
7
7
  const c = () => {
8
- const r = process.env.NEXT_PUBLIC_SUPABASE_URL, o = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
9
- if (!r || !o)
8
+ const r = process.env.NEXT_PUBLIC_SUPABASE_URL, t = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
9
+ if (!r || !t)
10
10
  throw new Error("Missing Supabase environment variables");
11
11
  return l(
12
12
  r,
13
- o,
13
+ t,
14
14
  {
15
15
  cookies: {
16
16
  getAll: async () => {
@@ -22,9 +22,9 @@ const c = () => {
22
22
  },
23
23
  setAll: async (e) => {
24
24
  try {
25
- const t = await i();
26
- for (const { name: a, value: n, options: s } of e)
27
- n && n.length > 0 ? t.set({ name: a, value: n, ...s }) : t.delete({ name: a, ...s });
25
+ const o = await i();
26
+ for (const { name: s, value: a, options: n } of e)
27
+ a && a.length > 0 ? o.set({ name: s, value: a, ...n }) : n && Object.keys(n).length > 0 ? o.delete({ name: s, ...n }) : o.delete(s);
28
28
  } catch {
29
29
  }
30
30
  }
@@ -33,16 +33,16 @@ const c = () => {
33
33
  );
34
34
  };
35
35
  async function p(r) {
36
- const o = c(), { data: e, error: t } = await o.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id", r).single();
37
- return t || !e ? (console.error("Error fetching profile (server-side):", t?.message), null) : e;
36
+ const t = c(), { data: e, error: o } = await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id", r).single();
37
+ return o || !e ? (console.error("Error fetching profile (server-side):", o?.message), null) : e;
38
38
  }
39
- async function m() {
40
- const r = c(), { data: o, error: e } = await r.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name", { ascending: !0 });
41
- return e ? (console.error("Error fetching languages (server-side):", e.message), []) : o || [];
39
+ async function g() {
40
+ const r = c(), { data: t, error: e } = await r.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name", { ascending: !0 });
41
+ return e ? (console.error("Error fetching languages (server-side):", e.message), []) : t || [];
42
42
  }
43
43
  export {
44
44
  c as createClient,
45
- m as getActiveLanguagesServerSide,
45
+ g as getActiveLanguagesServerSide,
46
46
  p as getProfileWithRoleServerSide,
47
47
  _ as getSsgSupabaseClient
48
48
  };