@k34a/blog 0.0.14 → 0.0.16

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/dist/cfg.js CHANGED
@@ -1,5 +1,4 @@
1
- "use client";
2
- const e = 12;
1
+ const o = 12;
3
2
  export {
4
- e as PAGE_SIZE
3
+ o as PAGE_SIZE
5
4
  };
@@ -14,20 +14,20 @@ class y {
14
14
  const { data: t, error: a } = await this.db.from("articles").select("*").eq("slug", e).eq("status", "Published").single();
15
15
  if (a)
16
16
  return console.error("Error fetching article details:", a.message), null;
17
- const { data: d, error: o } = await this.db.from("tag_articles").select("tag_id").eq("article_id", t.id);
18
- if (o)
17
+ const { data: d, error: i } = await this.db.from("tag_articles").select("tag_id").eq("article_id", t.id);
18
+ if (i)
19
19
  return console.error(
20
20
  "Error fetching article tag links:",
21
- o.message
21
+ i.message
22
22
  ), { ...t, tags: [] };
23
- const n = d?.map((i) => i.tag_id) || [];
23
+ const n = d?.map((o) => o.tag_id) || [];
24
24
  let r = [];
25
25
  if (n.length > 0) {
26
- const { data: i, error: c } = await this.db.from("tags").select("name").in("id", n);
26
+ const { data: o, error: c } = await this.db.from("tags").select("name").in("id", n);
27
27
  c ? console.error(
28
28
  "Error fetching article tag names:",
29
29
  c.message
30
- ) : r = i.map((l) => l.name);
30
+ ) : r = o.map((l) => l.name);
31
31
  }
32
32
  return { ...t, tags: r };
33
33
  }
@@ -52,11 +52,11 @@ class y {
52
52
  * Paginated list of articles with filters and sorting.
53
53
  */
54
54
  async list(e) {
55
- const { page: t, search: a, sortBy: d, tags: o } = e, n = u[d] ?? u.latest;
55
+ const { page: t, search: a, sortBy: d, tags: i } = e, n = u[d] ?? u.latest;
56
56
  let r = this.db.from("article_with_tags").select("*", { count: "exact" }).eq("status", "Published");
57
- a && (r = r.ilike("title", `%${a}%`)), o && o.length > 0 && (r = r.in("tag", o)), r = r.order(n.column, { ascending: n.ascending });
58
- const i = t * f, c = i + f - 1;
59
- r = r.range(i, c);
57
+ a && (r = r.ilike("title", `%${a}%`)), i && i.length > 0 && (r = r.in("tag", i)), r = r.order(n.column, { ascending: n.ascending });
58
+ const o = t * f, c = o + f - 1;
59
+ console.log({ from: o, to: c }), r = r.range(o, c);
60
60
  const { data: l, error: m, count: h } = await r;
61
61
  if (console.log({ data: l, error: m, count: h }), m)
62
62
  return console.error("Error fetching articles:", m), { items: [], total: 0 };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@k34a/blog",
3
3
  "description": "Create and share articles with your audience.",
4
4
  "private": false,
5
- "version": "0.0.14",
5
+ "version": "0.0.16",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {