@yimingliao/cms 0.0.64 → 0.0.66
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/{chunk-LPZEYEIM.js → chunk-3J5YR2NA.js} +1 -1
- package/dist/chunk-FUAJWL2N.js +64 -0
- package/dist/chunk-N2PRNBP2.js +481 -0
- package/dist/client/index.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/server/index.d.ts +51 -50
- package/dist/server/index.js +4318 -1
- package/dist/storage/r2/index.d.ts +1 -1
- package/dist/storage/r2/index.js +2 -2
- package/dist/storage/sftp/index.d.ts +2 -2
- package/dist/storage/sftp/index.js +2 -2
- package/package.json +14 -1
- package/dist/chunk-AOAWCZ4L.js +0 -4849
package/dist/server/index.d.ts
CHANGED
|
@@ -3,15 +3,16 @@ import { BinaryLike } from 'node:crypto';
|
|
|
3
3
|
import { cookies } from 'next/headers';
|
|
4
4
|
import Keyv from 'keyv';
|
|
5
5
|
import { Logger } from 'logry';
|
|
6
|
+
import { PrismaClient } from '@prisma/client';
|
|
6
7
|
import * as zod from 'zod';
|
|
7
8
|
import zod__default, { z, ZodType } from 'zod';
|
|
8
9
|
import { B as BlobFile } from '../types-0oS1A2K5.js';
|
|
9
10
|
import * as zod_v4_core from 'zod/v4/core';
|
|
10
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, u as PostType, M as MultiItems, E as ExternalLink, m as Faq, r as Post, s as PostListCard, t as PostTranslation, P as PostFull, k as Alternate, e as AdminCard, c as FileCard } from '../card-BG2vtuIz.js';
|
|
11
12
|
import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
|
|
12
|
-
import nodemailer, { Transporter } from 'nodemailer';
|
|
13
|
-
import { BaseTranslator, LocaleMessages } from 'intor';
|
|
13
|
+
import nodemailer, { Transporter, SentMessageInfo } from 'nodemailer';
|
|
14
14
|
import { S as SuccessResult, R as Result } from '../types-DHlRoJwv.js';
|
|
15
|
+
import { BaseTranslator, LocaleMessages } from 'intor';
|
|
15
16
|
import { NextResponse } from 'next/server';
|
|
16
17
|
import { S as StorageService } from '../types-J25u1G6t.js';
|
|
17
18
|
|
|
@@ -109,6 +110,12 @@ declare function createIpRateLimiter({ appName, cache, headers, }: {
|
|
|
109
110
|
headers: () => Promise<Headers>;
|
|
110
111
|
}): ({ key: rawKey, maxAttempts, timeWindow, }: RateLimiterOptions) => Promise<boolean>;
|
|
111
112
|
|
|
113
|
+
type ExistOptions = {
|
|
114
|
+
table: string;
|
|
115
|
+
column?: string;
|
|
116
|
+
};
|
|
117
|
+
declare function createExist(prisma: PrismaClient): (value: string | number, options: ExistOptions) => Promise<boolean>;
|
|
118
|
+
|
|
112
119
|
type Scope = {
|
|
113
120
|
name: string;
|
|
114
121
|
value: string;
|
|
@@ -120,13 +127,7 @@ type UniqueOptions = {
|
|
|
120
127
|
scope?: Scope[];
|
|
121
128
|
excludeSelf?: Scope;
|
|
122
129
|
};
|
|
123
|
-
declare function createUnique(prisma:
|
|
124
|
-
|
|
125
|
-
type ExistOptions = {
|
|
126
|
-
table: string;
|
|
127
|
-
column?: string;
|
|
128
|
-
};
|
|
129
|
-
declare function createExist(prisma: any): (value: string | number, options: ExistOptions) => Promise<boolean>;
|
|
130
|
+
declare function createUnique(prisma: PrismaClient): (value: string, options: UniqueOptions) => Promise<boolean>;
|
|
130
131
|
|
|
131
132
|
declare module "zod" {
|
|
132
133
|
interface ZodString {
|
|
@@ -216,7 +217,7 @@ declare function createSendEmail({ transporter, config, }: {
|
|
|
216
217
|
replyToName: string;
|
|
217
218
|
replyToaddress: string;
|
|
218
219
|
};
|
|
219
|
-
}): (options: SendEmailOptions) => Promise<
|
|
220
|
+
}): (options: SendEmailOptions) => Promise<SentMessageInfo>;
|
|
220
221
|
|
|
221
222
|
declare function createRenderEmailTemplate({ siteName, webUrl, logoUrl, logger, }: {
|
|
222
223
|
siteName: string;
|
|
@@ -263,7 +264,7 @@ interface UpdateParams$3 {
|
|
|
263
264
|
emailVerifiedAt: Date | null;
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
declare function createAdminCommandRepository(prisma:
|
|
267
|
+
declare function createAdminCommandRepository(prisma: PrismaClient): {
|
|
267
268
|
create: ({ role, email, passwordHash, socialLinks, avatarImage, translations, }: CreateParams$4) => Promise<Admin>;
|
|
268
269
|
update: ({ id, role, email, socialLinks, avatarImage, translations, emailVerifiedAt, }: UpdateParams$3) => Promise<Admin>;
|
|
269
270
|
delete: ({ id }: {
|
|
@@ -284,7 +285,7 @@ interface FindParams$2 {
|
|
|
284
285
|
email?: string;
|
|
285
286
|
}
|
|
286
287
|
|
|
287
|
-
declare function createAdminQueryRepository(prisma:
|
|
288
|
+
declare function createAdminQueryRepository(prisma: PrismaClient): {
|
|
288
289
|
findListCards: ({ locale, searchString, role, adminIds, page, pageSize, }: FindListCardsParams$3) => Promise<{
|
|
289
290
|
items: AdminFull[];
|
|
290
291
|
total: number;
|
|
@@ -307,13 +308,13 @@ interface DeleteParams {
|
|
|
307
308
|
tokenHash?: string;
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
declare function createAdminRefreshTokenCommandRepository(prisma:
|
|
311
|
+
declare function createAdminRefreshTokenCommandRepository(prisma: PrismaClient): {
|
|
311
312
|
create: ({ adminId, ...params }: CreateParams$3) => Promise<AdminRefreshToken>;
|
|
312
313
|
delete: ({ id, tokenHash }: DeleteParams) => Promise<void>;
|
|
313
314
|
deleteManyByExpired: () => Promise<number>;
|
|
314
315
|
};
|
|
315
316
|
|
|
316
|
-
declare function createAdminRefreshTokenQueryRepository(prisma:
|
|
317
|
+
declare function createAdminRefreshTokenQueryRepository(prisma: PrismaClient): {
|
|
317
318
|
findManyByAdminId: ({ adminId, }: {
|
|
318
319
|
adminId: string;
|
|
319
320
|
}) => Promise<AdminRefreshToken[]>;
|
|
@@ -359,7 +360,7 @@ interface UpdateParams$2 {
|
|
|
359
360
|
})[];
|
|
360
361
|
}
|
|
361
362
|
|
|
362
|
-
declare function createFileCommandRepository(prisma:
|
|
363
|
+
declare function createFileCommandRepository(prisma: PrismaClient): {
|
|
363
364
|
create: ({ key, checksum, fileMeta, width, height, duration, folder, translations, }: CreateParams$2) => Promise<FileFull>;
|
|
364
365
|
update: ({ file, id, key, checksum, fileMeta, width, height, duration, folder, translations, }: UpdateParams$2) => Promise<File$1>;
|
|
365
366
|
softDelete: ({ id }: {
|
|
@@ -388,7 +389,7 @@ interface FindListCardsParams$2 {
|
|
|
388
389
|
pageSize?: number;
|
|
389
390
|
}
|
|
390
391
|
|
|
391
|
-
declare function createFileQueryRepository(prisma:
|
|
392
|
+
declare function createFileQueryRepository(prisma: PrismaClient): {
|
|
392
393
|
findListCards: ({ locale, page, pageSize, searchString, type, folderId, isLocked, isDeleted, fileIds, }: FindListCardsParams$2) => Promise<{
|
|
393
394
|
items: FileFull[];
|
|
394
395
|
total: number;
|
|
@@ -413,7 +414,7 @@ interface UpdateParams$1 {
|
|
|
413
414
|
parentFolder: Folder | null;
|
|
414
415
|
}
|
|
415
416
|
|
|
416
|
-
declare function createFolderCommandRepository(prisma:
|
|
417
|
+
declare function createFolderCommandRepository(prisma: PrismaClient): {
|
|
417
418
|
create: ({ key, name, parentFolder, }: CreateParams$1) => Promise<Folder>;
|
|
418
419
|
update: ({ id, key, name, parentFolder, }: UpdateParams$1) => Promise<Folder>;
|
|
419
420
|
delete: ({ id }: {
|
|
@@ -433,7 +434,7 @@ interface FindParams$1 {
|
|
|
433
434
|
key?: string;
|
|
434
435
|
}
|
|
435
436
|
|
|
436
|
-
declare function createFolderQueryRepository(prisma:
|
|
437
|
+
declare function createFolderQueryRepository(prisma: PrismaClient): {
|
|
437
438
|
findListCards: ({ searchString, parentFolderId, folderIds, page, pageSize, }: FindListCardsParams$1) => Promise<{
|
|
438
439
|
items: FolderFull[];
|
|
439
440
|
total: number;
|
|
@@ -591,7 +592,7 @@ interface UpdateParams {
|
|
|
591
592
|
})[];
|
|
592
593
|
}
|
|
593
594
|
|
|
594
|
-
declare function createPostCommandRepository(prisma:
|
|
595
|
+
declare function createPostCommandRepository(prisma: PrismaClient): {
|
|
595
596
|
create: ({ slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
|
|
596
597
|
update: ({ id, slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
|
|
597
598
|
delete: ({ id }: {
|
|
@@ -639,7 +640,7 @@ interface FindManyParams {
|
|
|
639
640
|
topicId?: string;
|
|
640
641
|
}
|
|
641
642
|
|
|
642
|
-
declare function createPostQueryRepository(prisma:
|
|
643
|
+
declare function createPostQueryRepository(prisma: PrismaClient): {
|
|
643
644
|
findListCards: ({ locale, searchString, type, isActive, isIndexActive, isSlugActive, isFeatured, isShownOnHome, state1, state2, state3, state4, state5, state6, state7, state8, state9, state10, topicId, topicSlug, categoryId, categorySlug, postIds, excludeIds, page, pageSize, }: FindListCardsParams) => Promise<{
|
|
644
645
|
items: PostListCard[];
|
|
645
646
|
total: number;
|
|
@@ -686,7 +687,7 @@ interface UpsertParams {
|
|
|
686
687
|
})[];
|
|
687
688
|
}
|
|
688
689
|
|
|
689
|
-
declare function createSeoMetadataCommandRepository(prisma:
|
|
690
|
+
declare function createSeoMetadataCommandRepository(prisma: PrismaClient): {
|
|
690
691
|
upsert: ({ postId, translations, }: UpsertParams) => Promise<void>;
|
|
691
692
|
};
|
|
692
693
|
|
|
@@ -739,8 +740,36 @@ interface CreateExecuteApiParams {
|
|
|
739
740
|
}
|
|
740
741
|
declare function createExecuteApi({ initI18n, logger }: CreateExecuteApiParams): (fn: Api) => Promise<NextResponse<unknown>>;
|
|
741
742
|
|
|
743
|
+
interface CreateVerifyAccessTokenParams {
|
|
744
|
+
adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
|
|
745
|
+
jwtService: ReturnType<typeof createJwtService>;
|
|
746
|
+
cryptoService: ReturnType<typeof createCryptoService>;
|
|
747
|
+
cookieService: ReturnType<typeof createCookieService>;
|
|
748
|
+
config: {
|
|
749
|
+
accessTokenName: string;
|
|
750
|
+
accessTokenSecret: string;
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
declare function createVerifyAccessToken({ adminQueryRepository, jwtService, cryptoService, cookieService, config, }: CreateVerifyAccessTokenParams): () => Promise<{
|
|
754
|
+
admin: AdminFull;
|
|
755
|
+
} | null>;
|
|
756
|
+
|
|
757
|
+
interface CreateVerifyRefreshTokenParams {
|
|
758
|
+
adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
|
|
759
|
+
adminRefreshTokenQueryRepository: ReturnType<typeof createAdminRefreshTokenQueryRepository>;
|
|
760
|
+
cryptoService: ReturnType<typeof createCryptoService>;
|
|
761
|
+
cookieService: ReturnType<typeof createCookieService>;
|
|
762
|
+
config: {
|
|
763
|
+
refreshTokenName: string;
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
declare function createVerifyRefreshToken({ adminQueryRepository, adminRefreshTokenQueryRepository, cryptoService, cookieService, config, }: CreateVerifyRefreshTokenParams): () => Promise<{
|
|
767
|
+
adminRefreshToken: AdminRefreshToken;
|
|
768
|
+
admin: AdminFull;
|
|
769
|
+
} | null>;
|
|
770
|
+
|
|
742
771
|
interface CreateAuthUseCases {
|
|
743
|
-
prisma:
|
|
772
|
+
prisma: PrismaClient;
|
|
744
773
|
adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
|
|
745
774
|
adminRefreshTokenCommandRepository: ReturnType<typeof createAdminRefreshTokenCommandRepository>;
|
|
746
775
|
jwtService: ReturnType<typeof createJwtService>;
|
|
@@ -832,34 +861,6 @@ declare function createForgotPasswordEmail({ renderEmailTemplate, sendEmail, aut
|
|
|
832
861
|
send: ({ translator, admin }: SendParams) => Promise<any>;
|
|
833
862
|
};
|
|
834
863
|
|
|
835
|
-
interface CreateVerifyAccessTokenParams {
|
|
836
|
-
adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
|
|
837
|
-
jwtService: ReturnType<typeof createJwtService>;
|
|
838
|
-
cryptoService: ReturnType<typeof createCryptoService>;
|
|
839
|
-
cookieService: ReturnType<typeof createCookieService>;
|
|
840
|
-
config: {
|
|
841
|
-
accessTokenName: string;
|
|
842
|
-
accessTokenSecret: string;
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
declare function createVerifyAccessToken({ adminQueryRepository, jwtService, cryptoService, cookieService, config, }: CreateVerifyAccessTokenParams): () => Promise<{
|
|
846
|
-
admin: AdminFull;
|
|
847
|
-
} | null>;
|
|
848
|
-
|
|
849
|
-
interface CreateVerifyRefreshTokenParams {
|
|
850
|
-
adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
|
|
851
|
-
adminRefreshTokenQueryRepository: ReturnType<typeof createAdminRefreshTokenQueryRepository>;
|
|
852
|
-
cryptoService: ReturnType<typeof createCryptoService>;
|
|
853
|
-
cookieService: ReturnType<typeof createCookieService>;
|
|
854
|
-
config: {
|
|
855
|
-
refreshTokenName: string;
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
declare function createVerifyRefreshToken({ adminQueryRepository, adminRefreshTokenQueryRepository, cryptoService, cookieService, config, }: CreateVerifyRefreshTokenParams): () => Promise<{
|
|
859
|
-
adminRefreshToken: AdminRefreshToken;
|
|
860
|
-
admin: AdminFull;
|
|
861
|
-
} | null>;
|
|
862
|
-
|
|
863
864
|
interface CreateAuthMiddlewareParams {
|
|
864
865
|
adminRefreshTokenCommandRepository: ReturnType<typeof createAdminRefreshTokenCommandRepository>;
|
|
865
866
|
authUseCases: ReturnType<typeof createAuthUseCases>;
|