@yimingliao/cms 0.0.9 → 0.0.11
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/server/index.d.ts +5 -1
- package/dist/server/index.js +15 -10
- package/package.json +6 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import jwt from 'jsonwebtoken';
|
|
2
2
|
import { BinaryLike } from 'node:crypto';
|
|
3
3
|
import { cookies } from 'next/headers';
|
|
4
|
-
import { e as AdminRole, v as SingleItem, B as BaseTranslation, a as Admin, c as AdminFull, f as AdminSafe, D as DeviceInfo, d as AdminRefreshToken, k as File, m as FileFull, o as FileType, p as Folder, F as FolderFull, u as PostType, M as MultiItems, E as ExternalLink, j as Faq, T as TocItem, q as Post, s as PostListCard, t as PostTranslation, r as PostFull, S as SeoMetadata, h as Alternate } from '../base-DbGnfZr6.js';
|
|
4
|
+
import { e as AdminRole, v as SingleItem, B as BaseTranslation, a as Admin, c as AdminFull, f as AdminSafe, D as DeviceInfo, d as AdminRefreshToken, k as File, m as FileFull, o as FileType, p as Folder, F as FolderFull, u as PostType, M as MultiItems, E as ExternalLink, j as Faq, T as TocItem, q as Post, s as PostListCard, t as PostTranslation, r as PostFull, S as SeoMetadata, n as FileTranslation, h as Alternate } from '../base-DbGnfZr6.js';
|
|
5
5
|
|
|
6
6
|
interface JwtServiceConfig {
|
|
7
7
|
defaultSecret: string;
|
|
@@ -497,6 +497,10 @@ declare function createPostQueryRepository(prisma: any): {
|
|
|
497
497
|
findWithSeoMetadata: (params: FindParams) => Promise<(Post & {
|
|
498
498
|
translations: PostTranslation[];
|
|
499
499
|
seoMetadatas: SeoMetadata[];
|
|
500
|
+
author: Admin;
|
|
501
|
+
coverImage: File & {
|
|
502
|
+
translations: FileTranslation[];
|
|
503
|
+
};
|
|
500
504
|
}) | null>;
|
|
501
505
|
};
|
|
502
506
|
|
package/dist/server/index.js
CHANGED
|
@@ -419,7 +419,7 @@ function createAdminQueryRepository(prisma) {
|
|
|
419
419
|
async function findFull(params) {
|
|
420
420
|
const where = buildWhere(params);
|
|
421
421
|
if (!where) return null;
|
|
422
|
-
return
|
|
422
|
+
return prisma.admin.findUnique({
|
|
423
423
|
where,
|
|
424
424
|
include: ADMIN_FULL_INCLUDE,
|
|
425
425
|
...OMIT_PASSWORD
|
|
@@ -481,7 +481,7 @@ function createAdminRefreshTokenQueryRepository(prisma) {
|
|
|
481
481
|
async function findManyByAdminId({
|
|
482
482
|
adminId
|
|
483
483
|
}) {
|
|
484
|
-
return
|
|
484
|
+
return prisma.adminRefreshToken.findMany({
|
|
485
485
|
where: { adminId },
|
|
486
486
|
orderBy: [{ createdAt: "desc" }, { id: "asc" }]
|
|
487
487
|
});
|
|
@@ -489,7 +489,7 @@ function createAdminRefreshTokenQueryRepository(prisma) {
|
|
|
489
489
|
async function findByToken({
|
|
490
490
|
tokenHash
|
|
491
491
|
}) {
|
|
492
|
-
return
|
|
492
|
+
return prisma.adminRefreshToken.findUnique({
|
|
493
493
|
where: { tokenHash }
|
|
494
494
|
});
|
|
495
495
|
}
|
|
@@ -727,13 +727,13 @@ function createFileQueryRepository(prisma) {
|
|
|
727
727
|
async function findManyByIds({
|
|
728
728
|
ids: ids2
|
|
729
729
|
}) {
|
|
730
|
-
return
|
|
730
|
+
return prisma.file.findMany({
|
|
731
731
|
where: { id: { in: ids2 } },
|
|
732
732
|
include: FILE_FULL_INCLUDE
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
735
|
async function findFull({ id }) {
|
|
736
|
-
return
|
|
736
|
+
return prisma.file.findUnique({
|
|
737
737
|
where: { id },
|
|
738
738
|
include: FILE_FULL_INCLUDE
|
|
739
739
|
});
|
|
@@ -855,7 +855,7 @@ function createFolderQueryRepository(prisma) {
|
|
|
855
855
|
async function findFull(params) {
|
|
856
856
|
const where = buildWhere2(params);
|
|
857
857
|
if (!where) return null;
|
|
858
|
-
return
|
|
858
|
+
return prisma.folder.findUnique({
|
|
859
859
|
where,
|
|
860
860
|
include: FOLDER_FULL_INCLUDE
|
|
861
861
|
});
|
|
@@ -1078,7 +1078,7 @@ var POST_FULL_INCLUDE = {
|
|
|
1078
1078
|
// ---------------------------
|
|
1079
1079
|
// relations: Admin
|
|
1080
1080
|
// ---------------------------
|
|
1081
|
-
author: { include: { translations: true } },
|
|
1081
|
+
author: { include: { translations: true }, omit: { passwordHash: true } },
|
|
1082
1082
|
// ---------------------------
|
|
1083
1083
|
// relations: Post
|
|
1084
1084
|
// ---------------------------
|
|
@@ -1177,7 +1177,7 @@ function createPostQueryRepository(prisma) {
|
|
|
1177
1177
|
type,
|
|
1178
1178
|
topicId
|
|
1179
1179
|
}) {
|
|
1180
|
-
return
|
|
1180
|
+
return prisma.post.findMany({
|
|
1181
1181
|
where: { type, ...topicId ? { topicId } : {} },
|
|
1182
1182
|
orderBy: POST_ORDER_BY,
|
|
1183
1183
|
include: { translations: true }
|
|
@@ -1194,9 +1194,14 @@ function createPostQueryRepository(prisma) {
|
|
|
1194
1194
|
async function findWithSeoMetadata(params) {
|
|
1195
1195
|
const where = buildWhere3(params);
|
|
1196
1196
|
if (!where) return null;
|
|
1197
|
-
return
|
|
1197
|
+
return prisma.post.findFirst({
|
|
1198
1198
|
where,
|
|
1199
|
-
include: {
|
|
1199
|
+
include: {
|
|
1200
|
+
translations: true,
|
|
1201
|
+
seoMetadatas: true,
|
|
1202
|
+
author: true,
|
|
1203
|
+
coverImage: { include: { translations: true } }
|
|
1204
|
+
}
|
|
1200
1205
|
});
|
|
1201
1206
|
}
|
|
1202
1207
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yimingliao/cms",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"author": "Yiming Liao",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"require": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./server": {
|
|
14
|
+
"types": "./dist/server/index.d.ts",
|
|
15
|
+
"import": "./dist/server/index.js",
|
|
16
|
+
"require": "./dist/server/index.js"
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
"files": [
|