@vitnode/blog 1.2.0-canary.77 → 1.2.0-canary.78
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/api/lib/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAcpC,UAAU,iBAAiB;IACzB,QAAQ,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAmDD,eAAO,MAAM,eAAe,GAC1B,GAAG,OAAO,EACV,MAAM,iBAAiB,KACtB,OAAO,CAAC,IAAI,CAoBd,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,aA4CnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{asc,count}from"drizzle-orm";import{blog_posts}from"../../database/posts.js";import{getDefaultLanguageCode,loadPostTranslations,resolveLangValue}from"./posts-language.js";const getEnabledLanguageCodes=c=>c.get("core").i18n.locales.filter(locale=>locale.enabled!==false).map(locale=>locale.code);const buildDocumentsForPost=(post,languageCodes,translations,defaultLanguageCode)=>{const codes=languageCodes.length>0?languageCodes:[""];return codes.map(languageCode=>{const friendlyUrl=resolveLangValue(translations?.friendlyUrl,languageCode,defaultLanguageCode);return{itemType:"blog_post",itemId:post.id,languageCode,authorId:post.authorId,title:resolveLangValue(translations?.title,languageCode,defaultLanguageCode),content:resolveLangValue(translations?.content,languageCode,defaultLanguageCode),containerType:"blog_category",containerId:post.categoryId,url:`/blog/${post.categoryId}/${friendlyUrl}`,isPublic:true,createdAt:post.createdAt,updatedAt:post.updatedAt}})};export const reindexBlogPost=async(c,post)=>{const languageCodes=getEnabledLanguageCodes(c);const[defaultLanguageCode,translations]=await Promise.all([getDefaultLanguageCode(c),loadPostTranslations(c,[post.id])]);await c.get("search").delete("blog_post",post.id);await c.get("search").bulkIndex(buildDocumentsForPost(post,languageCodes,translations.get(post.id),defaultLanguageCode))};export const blogPostSearchIndexer={itemType:"blog_post",count:async c=>{const[row]=await c.get("db").select({value:count()}).from(blog_posts);return row?.value??0},load:async(c,offset,limit)=>{const rows=await c.get("db").select({id:blog_posts.id,categoryId:blog_posts.categoryId,authorId:blog_posts.authorId,createdAt:blog_posts.createdAt,updatedAt:blog_posts.updatedAt}).from(blog_posts).orderBy(asc(blog_posts.id)).limit(limit).offset(offset);if(rows.length===0){return[]}const languageCodes=getEnabledLanguageCodes(c);const[defaultLanguageCode,translations]=await Promise.all([getDefaultLanguageCode(c),loadPostTranslations(c,rows.map(row=>row.id))]);return rows.flatMap(post=>buildDocumentsForPost(post,languageCodes,translations.get(post.id),defaultLanguageCode))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.api.d.ts","sourceRoot":"","sources":["../../src/config.api.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,mEAuBzB,CAAC"}
|
package/dist/src/config.api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildApiPlugin}from"@vitnode/core/api/lib/plugin";import{CONFIG_PLUGIN}from"./const.js";import{blogPostSearchIndexer}from"./api/lib/search.js";import{adminModule}from"./api/modules/admin/admin.module.js";import{categoriesModule}from"./api/modules/categories/categories.module.js";import{postsModule}from"./api/modules/posts/posts.module.js";
|
|
1
|
+
import{buildApiPlugin}from"@vitnode/core/api/lib/plugin";import{CONFIG_PLUGIN}from"./const.js";import{blogPostSearchIndexer}from"./api/lib/search.js";import{adminModule}from"./api/modules/admin/admin.module.js";import{categoriesModule}from"./api/modules/categories/categories.module.js";import{postsModule}from"./api/modules/posts/posts.module.js";export const blogApiPlugin=()=>{return buildApiPlugin({pluginId:CONFIG_PLUGIN.pluginId,modules:[adminModule,categoriesModule,postsModule],searchIndexers:[blogPostSearchIndexer],permissionStaff:{moderator:{posts:["can_edit","can_delete"]},admin:{posts:["can_view",{permission:"can_create",dependsOn:["can_view"]},"can_edit","can_delete"],categories:["can_view","can_create","can_edit","can_delete"]}}})};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitnode/blog",
|
|
3
|
-
"version": "1.2.0-canary.
|
|
3
|
+
"version": "1.2.0-canary.78",
|
|
4
4
|
"description": "Blog plugin for VitNode, providing a blogging platform with Next.js and Hono.js.",
|
|
5
5
|
"author": "VitNode Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-hook-form": "^7.82.0",
|
|
42
42
|
"sonner": "^2.0.7",
|
|
43
43
|
"zod": "^4.4.3",
|
|
44
|
-
"@vitnode/core": "1.2.0-canary.
|
|
44
|
+
"@vitnode/core": "1.2.0-canary.78"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@react-email/ui": "^6.9.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"eslint": "^10.7.0",
|
|
53
53
|
"tsc-alias": "^1.9.1",
|
|
54
54
|
"typescript": "^6.0.3",
|
|
55
|
-
"@vitnode/config": "1.2.0-canary.
|
|
55
|
+
"@vitnode/config": "1.2.0-canary.78"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build:plugins": "vitnode build",
|