@nextblock-cms/db 0.0.3 → 0.0.4

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.3",
3
+ "version": "0.0.4",
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 c=require("@supabase/ssr"),u=require("next/headers"),l=require("@supabase/supabase-js");var S={},i;function v(){if(i)return S;throw i=1,new Error("This module cannot be imported from a Client Component module. It should only be used from a Server Component.")}v();const a=()=>{const s=u.cookies(),t=process.env.NEXT_PUBLIC_SUPABASE_URL,r=process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!t||!r)throw new Error("Missing Supabase environment variables");return c.createServerClient(t,r,{cookies:{async get(e){var o;return(o=(await s).get(e))==null?void 0:o.value},set(e,n,o){s.set({name:e,value:n,...o})},remove(e,n){s.set({name:e,value:"",...n})}}})};async function d(s){const t=a(),{data:r,error:e}=await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id",s).single();return e||!r?(console.error("Error fetching profile (server-side):",e==null?void 0:e.message),null):r}async function g(){const s=a(),{data:t,error:r}=await s.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name",{ascending:!0});return r?(console.error("Error fetching languages (server-side):",r.message),[]):t||[]}const _=()=>{if(!process.env.NEXT_PUBLIC_SUPABASE_URL||!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)throw new Error("Supabase URL or Anon Key is missing for SSG client. Check .env.local");return l.createClient(process.env.NEXT_PUBLIC_SUPABASE_URL,process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)};exports.createClient=a;exports.getActiveLanguagesServerSide=g;exports.getProfileWithRoleServerSide=d;exports.getSsgSupabaseClient=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@supabase/ssr"),c=require("next/headers"),u=require("@supabase/supabase-js"),l="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(l);const a=()=>{const t=c.cookies(),s=process.env.NEXT_PUBLIC_SUPABASE_URL,r=process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;if(!s||!r)throw new Error("Missing Supabase environment variables");return i.createServerClient(s,r,{cookies:{async get(e){var n;return(n=(await t).get(e))==null?void 0:n.value},set(e,o,n){t.set({name:e,value:o,...n})},remove(e,o){t.set({name:e,value:"",...o})}}})};async function S(t){const s=a(),{data:r,error:e}=await s.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id",t).single();return e||!r?(console.error("Error fetching profile (server-side):",e==null?void 0:e.message),null):r}async function d(){const t=a(),{data:s,error:r}=await t.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name",{ascending:!0});return r?(console.error("Error fetching languages (server-side):",r.message),[]):s||[]}const _=()=>{if(!process.env.NEXT_PUBLIC_SUPABASE_URL||!process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)throw new Error("Supabase URL or Anon Key is missing for SSG client. Check .env.local");return u.createClient(process.env.NEXT_PUBLIC_SUPABASE_URL,process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)};exports.createClient=a;exports.getActiveLanguagesServerSide=d;exports.getProfileWithRoleServerSide=S;exports.getSsgSupabaseClient=_;
package/server.es.js CHANGED
@@ -1,19 +1,14 @@
1
- import { createServerClient as c } from "@supabase/ssr";
2
- import { cookies as l } from "next/headers";
3
- import { createClient as u } from "@supabase/supabase-js";
4
- var S = {}, a;
5
- function _() {
6
- if (a) return S;
7
- throw a = 1, new Error(
8
- "This module cannot be imported from a Client Component module. It should only be used from a Server Component."
9
- );
10
- }
11
- _();
12
- const i = () => {
13
- const o = l(), t = process.env.NEXT_PUBLIC_SUPABASE_URL, r = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
1
+ import { createServerClient as i } from "@supabase/ssr";
2
+ import { cookies as c } from "next/headers";
3
+ import { createClient as l } from "@supabase/supabase-js";
4
+ const u = "This module cannot be imported from a Client Component module. It should only be used from a Server Component.";
5
+ if (typeof window < "u")
6
+ throw new Error(u);
7
+ const a = () => {
8
+ const o = c(), t = process.env.NEXT_PUBLIC_SUPABASE_URL, r = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
14
9
  if (!t || !r)
15
10
  throw new Error("Missing Supabase environment variables");
16
- return c(
11
+ return i(
17
12
  t,
18
13
  r,
19
14
  {
@@ -32,25 +27,25 @@ const i = () => {
32
27
  }
33
28
  );
34
29
  };
35
- async function p(o) {
36
- const t = i(), { data: r, error: e } = await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id", o).single();
30
+ async function m(o) {
31
+ const t = a(), { data: r, error: e } = await t.from("profiles").select("id, full_name, avatar_url, role, updated_at, username, website").eq("id", o).single();
37
32
  return e || !r ? (console.error("Error fetching profile (server-side):", e == null ? void 0 : e.message), null) : r;
38
33
  }
39
- async function f() {
40
- const o = i(), { data: t, error: r } = await o.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name", { ascending: !0 });
34
+ async function p() {
35
+ const o = a(), { data: t, error: r } = await o.from("languages").select("id, code, name, is_default, is_active, created_at, updated_at").order("name", { ascending: !0 });
41
36
  return r ? (console.error("Error fetching languages (server-side):", r.message), []) : t || [];
42
37
  }
43
- const g = () => {
38
+ const f = () => {
44
39
  if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)
45
40
  throw new Error("Supabase URL or Anon Key is missing for SSG client. Check .env.local");
46
- return u(
41
+ return l(
47
42
  process.env.NEXT_PUBLIC_SUPABASE_URL,
48
43
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
49
44
  );
50
45
  };
51
46
  export {
52
- i as createClient,
53
- f as getActiveLanguagesServerSide,
54
- p as getProfileWithRoleServerSide,
55
- g as getSsgSupabaseClient
47
+ a as createClient,
48
+ p as getActiveLanguagesServerSide,
49
+ m as getProfileWithRoleServerSide,
50
+ f as getSsgSupabaseClient
56
51
  };