@yimingliao/cms 0.0.68 → 0.0.70
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 +23 -27
- package/dist/server/index.js +43 -13
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import * as zod from 'zod';
|
|
|
8
8
|
import zod__default, { z, ZodType } from 'zod';
|
|
9
9
|
import { B as BlobFile } from '../types-0oS1A2K5.js';
|
|
10
10
|
import * as zod_v4_core from 'zod/v4/core';
|
|
11
|
-
import { T as TocItem, h as AdminRole, v as SingleItem, B as BaseTranslation, d as Admin, f as AdminFull, i as AdminSafe, D as DeviceInfo, g as AdminRefreshToken, n as File$1, b as FileFull, p as FileType, a as Folder, F as FolderFull,
|
|
11
|
+
import { T as TocItem, h as AdminRole, v as SingleItem, B as BaseTranslation, d as Admin, f as AdminFull, i as AdminSafe, D as DeviceInfo, g as AdminRefreshToken, n as File$1, b as FileFull, p as FileType, a as Folder, F as FolderFull, M as MultiItems, E as ExternalLink, m as Faq, r as Post, u as PostType, s as PostListCard, t as PostTranslation, P as PostFull, k as Alternate, e as AdminCard, c as FileCard } from '../card-BG2vtuIz.js';
|
|
12
12
|
import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
|
|
13
13
|
import nodemailer, { Transporter, SentMessageInfo } from 'nodemailer';
|
|
14
14
|
import { S as SuccessResult, R as Result } from '../types-DHlRoJwv.js';
|
|
@@ -443,7 +443,7 @@ declare function createFolderQueryRepository(prisma: PrismaClient): {
|
|
|
443
443
|
};
|
|
444
444
|
|
|
445
445
|
interface CreateParams {
|
|
446
|
-
type:
|
|
446
|
+
type: string;
|
|
447
447
|
isLocked: boolean;
|
|
448
448
|
isActive: boolean;
|
|
449
449
|
isIndexActive: boolean;
|
|
@@ -518,7 +518,7 @@ interface CreateParams {
|
|
|
518
518
|
}
|
|
519
519
|
interface UpdateParams {
|
|
520
520
|
id: string;
|
|
521
|
-
type:
|
|
521
|
+
type: string;
|
|
522
522
|
isLocked: boolean;
|
|
523
523
|
isActive: boolean;
|
|
524
524
|
isIndexActive: boolean;
|
|
@@ -593,8 +593,8 @@ interface UpdateParams {
|
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
declare function createPostCommandRepository(prisma: PrismaClient): {
|
|
596
|
-
create: ({ slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
|
|
597
|
-
update: ({ id, slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
|
|
596
|
+
create: ({ slug, type, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
|
|
597
|
+
update: ({ id, slug, type, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
|
|
598
598
|
delete: ({ id }: {
|
|
599
599
|
id: string;
|
|
600
600
|
}) => Promise<Post>;
|
|
@@ -651,7 +651,11 @@ declare function createPostQueryRepository(prisma: PrismaClient): {
|
|
|
651
651
|
find: ({ isActive, ...rest }: FindParams) => Promise<(Post & {
|
|
652
652
|
translations: PostTranslation[];
|
|
653
653
|
}) | null>;
|
|
654
|
-
findFull: ({ isActive, topicSlug, ...rest }: FindParams) => Promise<
|
|
654
|
+
findFull: ({ isActive, topicSlug, ...rest }: FindParams) => Promise<{
|
|
655
|
+
post: PostFull | null;
|
|
656
|
+
prev: PostListCard | null;
|
|
657
|
+
next: PostListCard | null;
|
|
658
|
+
}>;
|
|
655
659
|
};
|
|
656
660
|
|
|
657
661
|
interface UpsertParams {
|
|
@@ -1378,18 +1382,12 @@ declare function createFolderFindListCardsAction(ctx: ActionContext): (params: {
|
|
|
1378
1382
|
}>>;
|
|
1379
1383
|
|
|
1380
1384
|
declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }: {
|
|
1381
|
-
type:
|
|
1385
|
+
type: string;
|
|
1382
1386
|
topicId: string | null;
|
|
1383
1387
|
schemas: ReturnType<typeof createSchemas>;
|
|
1384
1388
|
tocItemSchema: ReturnType<typeof createTocItemSchema>;
|
|
1385
1389
|
}) => zod.ZodPipe<zod.ZodObject<{
|
|
1386
|
-
type: zod.
|
|
1387
|
-
TOPIC: "TOPIC";
|
|
1388
|
-
CATEGORY: "CATEGORY";
|
|
1389
|
-
POST: "POST";
|
|
1390
|
-
TAG: "TAG";
|
|
1391
|
-
PAGE: "PAGE";
|
|
1392
|
-
}>;
|
|
1390
|
+
type: zod.ZodString;
|
|
1393
1391
|
isLocked: zod.ZodBoolean;
|
|
1394
1392
|
isActive: zod.ZodBoolean;
|
|
1395
1393
|
isIndexActive: zod.ZodBoolean;
|
|
@@ -1622,7 +1620,7 @@ declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }:
|
|
|
1622
1620
|
data3: any[];
|
|
1623
1621
|
data4: any[];
|
|
1624
1622
|
}[];
|
|
1625
|
-
type:
|
|
1623
|
+
type: string;
|
|
1626
1624
|
isLocked: boolean;
|
|
1627
1625
|
isActive: boolean;
|
|
1628
1626
|
isIndexActive: boolean;
|
|
@@ -1689,7 +1687,7 @@ declare const postCreateValidator: ({ type, topicId, schemas, tocItemSchema, }:
|
|
|
1689
1687
|
data3: any[];
|
|
1690
1688
|
data4: any[];
|
|
1691
1689
|
}, {
|
|
1692
|
-
type:
|
|
1690
|
+
type: string;
|
|
1693
1691
|
isLocked: boolean;
|
|
1694
1692
|
isActive: boolean;
|
|
1695
1693
|
isIndexActive: boolean;
|
|
@@ -1813,18 +1811,12 @@ declare function createPostCreateAction(ctx: ActionContext): ({ formData, }: {
|
|
|
1813
1811
|
|
|
1814
1812
|
declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema, }: {
|
|
1815
1813
|
id: string;
|
|
1816
|
-
type:
|
|
1814
|
+
type: string;
|
|
1817
1815
|
topicId: string | null;
|
|
1818
1816
|
schemas: ReturnType<typeof createSchemas>;
|
|
1819
1817
|
tocItemSchema: ReturnType<typeof createTocItemSchema>;
|
|
1820
1818
|
}) => zod.ZodPipe<zod.ZodObject<{
|
|
1821
|
-
type: zod.
|
|
1822
|
-
TOPIC: "TOPIC";
|
|
1823
|
-
CATEGORY: "CATEGORY";
|
|
1824
|
-
POST: "POST";
|
|
1825
|
-
TAG: "TAG";
|
|
1826
|
-
PAGE: "PAGE";
|
|
1827
|
-
}>;
|
|
1819
|
+
type: zod.ZodString;
|
|
1828
1820
|
isLocked: zod.ZodBoolean;
|
|
1829
1821
|
isActive: zod.ZodBoolean;
|
|
1830
1822
|
isIndexActive: zod.ZodBoolean;
|
|
@@ -2057,7 +2049,7 @@ declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema,
|
|
|
2057
2049
|
data3: any[];
|
|
2058
2050
|
data4: any[];
|
|
2059
2051
|
}[];
|
|
2060
|
-
type:
|
|
2052
|
+
type: string;
|
|
2061
2053
|
isLocked: boolean;
|
|
2062
2054
|
isActive: boolean;
|
|
2063
2055
|
isIndexActive: boolean;
|
|
@@ -2124,7 +2116,7 @@ declare const postUpdateValidator: ({ id, type, topicId, schemas, tocItemSchema,
|
|
|
2124
2116
|
data3: any[];
|
|
2125
2117
|
data4: any[];
|
|
2126
2118
|
}, {
|
|
2127
|
-
type:
|
|
2119
|
+
type: string;
|
|
2128
2120
|
isLocked: boolean;
|
|
2129
2121
|
isActive: boolean;
|
|
2130
2122
|
isIndexActive: boolean;
|
|
@@ -2270,7 +2262,11 @@ declare function createPostFindFullAction(ctx: ActionContext): (params: {
|
|
|
2270
2262
|
isActive?: boolean;
|
|
2271
2263
|
topicSlug?: string;
|
|
2272
2264
|
}) => Promise<Result<{
|
|
2273
|
-
post:
|
|
2265
|
+
post: {
|
|
2266
|
+
post: PostFull | null;
|
|
2267
|
+
prev: PostListCard | null;
|
|
2268
|
+
next: PostListCard | null;
|
|
2269
|
+
};
|
|
2274
2270
|
}>>;
|
|
2275
2271
|
|
|
2276
2272
|
declare function createPostFindListCardsAction(ctx: ActionContext): (params: {
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER
|
|
1
|
+
import { ADMIN_ROLES, isFileLocked, isFolderLocked, ROOT_FOLDER_ID, ROOT_FOLDER } from '../chunk-FUAJWL2N.js';
|
|
2
2
|
import { SIZE, result, datetimeToDb, jsonArrayToDb, mimeToExtension, classifyFileType, TWITTER_CARD_ARRAY, OG_TYPE_ARRAY } from '../chunk-N2PRNBP2.js';
|
|
3
3
|
import jwt from 'jsonwebtoken';
|
|
4
4
|
import argon2 from 'argon2';
|
|
@@ -1433,6 +1433,7 @@ function createFolderQueryRepository(prisma) {
|
|
|
1433
1433
|
function createPostCommandRepository(prisma) {
|
|
1434
1434
|
async function create({
|
|
1435
1435
|
slug,
|
|
1436
|
+
type,
|
|
1436
1437
|
// ------------------------------------
|
|
1437
1438
|
// relations
|
|
1438
1439
|
// ------------------------------------
|
|
@@ -1469,6 +1470,7 @@ function createPostCommandRepository(prisma) {
|
|
|
1469
1470
|
data: {
|
|
1470
1471
|
...params,
|
|
1471
1472
|
id,
|
|
1473
|
+
type,
|
|
1472
1474
|
// ------------------------------------------------------------------------
|
|
1473
1475
|
// states
|
|
1474
1476
|
// ------------------------------------------------------------------------
|
|
@@ -1516,6 +1518,7 @@ function createPostCommandRepository(prisma) {
|
|
|
1516
1518
|
async function update({
|
|
1517
1519
|
id,
|
|
1518
1520
|
slug,
|
|
1521
|
+
type,
|
|
1519
1522
|
// ------------------------------------
|
|
1520
1523
|
// relations
|
|
1521
1524
|
// ------------------------------------
|
|
@@ -1551,6 +1554,7 @@ function createPostCommandRepository(prisma) {
|
|
|
1551
1554
|
where: { id },
|
|
1552
1555
|
data: {
|
|
1553
1556
|
...params,
|
|
1557
|
+
type,
|
|
1554
1558
|
// ------------------------------------------------------------------------
|
|
1555
1559
|
// states
|
|
1556
1560
|
// ------------------------------------------------------------------------
|
|
@@ -1805,17 +1809,44 @@ function createPostQueryRepository(prisma) {
|
|
|
1805
1809
|
...rest
|
|
1806
1810
|
}) {
|
|
1807
1811
|
const where = buildWhere3(rest);
|
|
1808
|
-
if (!where) return null;
|
|
1809
|
-
|
|
1810
|
-
where
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1812
|
+
if (!where) return { post: null, prev: null, next: null };
|
|
1813
|
+
const baseWhere = {
|
|
1814
|
+
...where,
|
|
1815
|
+
// states
|
|
1816
|
+
...isActive ? { isActive } : {},
|
|
1817
|
+
// relations
|
|
1818
|
+
...topicSlug ? { topic: { slug: topicSlug } } : {}
|
|
1819
|
+
};
|
|
1820
|
+
const post = await prisma.post.findFirst({
|
|
1821
|
+
where: baseWhere,
|
|
1817
1822
|
include: POST_FULL_INCLUDE
|
|
1818
1823
|
});
|
|
1824
|
+
if (!post) return { post: null, prev: null, next: null };
|
|
1825
|
+
const next = await prisma.post.findFirst({
|
|
1826
|
+
where: baseWhere,
|
|
1827
|
+
orderBy: POST_ORDER_BY,
|
|
1828
|
+
cursor: { id: post.id },
|
|
1829
|
+
skip: 1,
|
|
1830
|
+
take: 1,
|
|
1831
|
+
include: POST_LIST_CARD_INCLUDE
|
|
1832
|
+
});
|
|
1833
|
+
const reversedOrder = POST_ORDER_BY.map((o) => {
|
|
1834
|
+
const key = Object.keys(o)[0];
|
|
1835
|
+
return { [key]: o[key] === "asc" ? "desc" : "asc" };
|
|
1836
|
+
});
|
|
1837
|
+
const prev = await prisma.post.findFirst({
|
|
1838
|
+
where: baseWhere,
|
|
1839
|
+
orderBy: reversedOrder,
|
|
1840
|
+
cursor: { id: post.id },
|
|
1841
|
+
skip: 1,
|
|
1842
|
+
take: 1,
|
|
1843
|
+
include: POST_LIST_CARD_INCLUDE
|
|
1844
|
+
});
|
|
1845
|
+
return {
|
|
1846
|
+
post,
|
|
1847
|
+
prev,
|
|
1848
|
+
next
|
|
1849
|
+
};
|
|
1819
1850
|
}
|
|
1820
1851
|
return {
|
|
1821
1852
|
findListCards,
|
|
@@ -3502,7 +3533,7 @@ var postCreateValidator = ({
|
|
|
3502
3533
|
schemas,
|
|
3503
3534
|
tocItemSchema
|
|
3504
3535
|
}) => schemas.z.object({
|
|
3505
|
-
type: schemas.
|
|
3536
|
+
type: schemas.text(),
|
|
3506
3537
|
// ----------------------------------------------------------------------------
|
|
3507
3538
|
// states
|
|
3508
3539
|
// ----------------------------------------------------------------------------
|
|
@@ -3681,8 +3712,7 @@ var postUpdateValidator = ({
|
|
|
3681
3712
|
schemas,
|
|
3682
3713
|
tocItemSchema
|
|
3683
3714
|
}) => schemas.z.object({
|
|
3684
|
-
type: schemas.
|
|
3685
|
-
// depth: schemas.z.number().nullable(),
|
|
3715
|
+
type: schemas.text(),
|
|
3686
3716
|
// ----------------------------------------------------------------------------
|
|
3687
3717
|
// states
|
|
3688
3718
|
// ----------------------------------------------------------------------------
|