@yimingliao/cms 0.0.1
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/index.d.ts +841 -0
- package/dist/index.js +1264 -0
- package/package.json +38 -0
- package/prisma/schema/Admin/Admin.prisma +84 -0
- package/prisma/schema/Admin/AdminRefreshToken.prisma +27 -0
- package/prisma/schema/File/File.prisma +105 -0
- package/prisma/schema/File/Folder.prisma +33 -0
- package/prisma/schema/Post/SeoMetadata.prisma +86 -0
- package/prisma/schema/Post/post.prisma +191 -0
- package/prisma/schema/schema.prisma +29 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,841 @@
|
|
|
1
|
+
import jwt from 'jsonwebtoken';
|
|
2
|
+
import { BinaryLike } from 'node:crypto';
|
|
3
|
+
import { cookies } from 'next/headers';
|
|
4
|
+
|
|
5
|
+
interface JwtServiceConfig {
|
|
6
|
+
defaultSecret: string;
|
|
7
|
+
issuer?: string;
|
|
8
|
+
audience?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* JWT service
|
|
12
|
+
*
|
|
13
|
+
* Sign, Verify
|
|
14
|
+
*/
|
|
15
|
+
declare function createJwtService(config: JwtServiceConfig): {
|
|
16
|
+
sign: ({ payload, secret, expiresIn, }: {
|
|
17
|
+
payload: object;
|
|
18
|
+
secret: string;
|
|
19
|
+
expiresIn: number;
|
|
20
|
+
}) => string;
|
|
21
|
+
verify: ({ token, secret, }: {
|
|
22
|
+
token: string;
|
|
23
|
+
secret: string;
|
|
24
|
+
}) => jwt.JwtPayload;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare function createArgon2Service(): {
|
|
28
|
+
hash: (password: string) => Promise<string>;
|
|
29
|
+
verify: (hash: string, plain: string) => Promise<boolean>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
interface CryptoServiceConfig {
|
|
33
|
+
defaultSecret: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Crypto service
|
|
37
|
+
*
|
|
38
|
+
* Encrypt & Decrypt, Calculate checksum, Sign
|
|
39
|
+
*/
|
|
40
|
+
declare function createCryptoService(config: CryptoServiceConfig): {
|
|
41
|
+
generateToken: () => string;
|
|
42
|
+
hash: (value: BinaryLike) => string;
|
|
43
|
+
hashBuffer: (value: BinaryLike) => Buffer;
|
|
44
|
+
encrypt: (data: string) => string;
|
|
45
|
+
decrypt: (data: string) => string;
|
|
46
|
+
sign: ({ value, expireSeconds, createdAt, }: {
|
|
47
|
+
value: string;
|
|
48
|
+
expireSeconds: number;
|
|
49
|
+
createdAt?: number;
|
|
50
|
+
}) => {
|
|
51
|
+
signed: string;
|
|
52
|
+
signature: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Cookie Service
|
|
58
|
+
*
|
|
59
|
+
* Set, Get, Verify, Delete
|
|
60
|
+
*/
|
|
61
|
+
declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnType<typeof cookies>>>, cryptoService: ReturnType<typeof createCryptoService>): {
|
|
62
|
+
set: ({ name, value, expireSeconds, }: {
|
|
63
|
+
name: string;
|
|
64
|
+
value: string;
|
|
65
|
+
expireSeconds: number;
|
|
66
|
+
}) => Promise<void>;
|
|
67
|
+
setSignedCookie: ({ name, value, expireSeconds, }: {
|
|
68
|
+
name: string;
|
|
69
|
+
value: string;
|
|
70
|
+
expireSeconds: number;
|
|
71
|
+
}) => Promise<void>;
|
|
72
|
+
get: ({ name }: {
|
|
73
|
+
name: string;
|
|
74
|
+
}) => Promise<string | undefined>;
|
|
75
|
+
getSignedCookie: ({ name }: {
|
|
76
|
+
name: string;
|
|
77
|
+
}) => Promise<string>;
|
|
78
|
+
verifySignedCookie: ({ signed }: {
|
|
79
|
+
signed: string | undefined;
|
|
80
|
+
}) => string;
|
|
81
|
+
delete: ({ name }: {
|
|
82
|
+
name: string;
|
|
83
|
+
}) => Promise<void>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare const ADMIN_ROLES: {
|
|
87
|
+
SUPER_ADMIN: "SUPER_ADMIN";
|
|
88
|
+
ADMIN: "ADMIN";
|
|
89
|
+
EDITOR: "EDITOR";
|
|
90
|
+
};
|
|
91
|
+
type AdminRole = (typeof ADMIN_ROLES)[keyof typeof ADMIN_ROLES];
|
|
92
|
+
|
|
93
|
+
interface Admin {
|
|
94
|
+
id: string;
|
|
95
|
+
email: string;
|
|
96
|
+
role: AdminRole;
|
|
97
|
+
passwordHash: string;
|
|
98
|
+
socialLinks: string[];
|
|
99
|
+
avatarImageId: string | null;
|
|
100
|
+
createdAt: Date;
|
|
101
|
+
updatedAt: Date;
|
|
102
|
+
emailVerifiedAt: Date | null;
|
|
103
|
+
}
|
|
104
|
+
type AdminSafe = Omit<Admin, "passwordHash">;
|
|
105
|
+
|
|
106
|
+
type BaseTranslation<T extends string = string> = {
|
|
107
|
+
locale: T;
|
|
108
|
+
};
|
|
109
|
+
type Translation<T extends string = string> = BaseTranslation<T> & {
|
|
110
|
+
[k: string]: unknown;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
interface AdminTranslation extends Translation {
|
|
114
|
+
id: string;
|
|
115
|
+
locale: string;
|
|
116
|
+
adminId: string;
|
|
117
|
+
name: string | null;
|
|
118
|
+
authorName: string | null;
|
|
119
|
+
description: string | null;
|
|
120
|
+
jobTitle: string | null;
|
|
121
|
+
url: string | null;
|
|
122
|
+
worksFor: string | null;
|
|
123
|
+
knowsAbout: string[];
|
|
124
|
+
homeLocation: string | null;
|
|
125
|
+
nationality: string | null;
|
|
126
|
+
createdAt: Date;
|
|
127
|
+
updatedAt: Date;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface DeviceInfo {
|
|
131
|
+
deviceType: "mobile" | "tablet" | "console" | "smarttv" | "wearable" | "xr" | "embedded";
|
|
132
|
+
platform: string;
|
|
133
|
+
timezone?: string;
|
|
134
|
+
language?: string;
|
|
135
|
+
screenResolution?: {
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
};
|
|
139
|
+
browser?: string;
|
|
140
|
+
browserVersion?: string;
|
|
141
|
+
userAgent?: string;
|
|
142
|
+
[key: string]: unknown;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface AdminRefreshToken {
|
|
146
|
+
id: string;
|
|
147
|
+
tokenHash: string;
|
|
148
|
+
email: string;
|
|
149
|
+
ip: string;
|
|
150
|
+
deviceInfo: DeviceInfo | null;
|
|
151
|
+
adminId: string;
|
|
152
|
+
createdAt: Date;
|
|
153
|
+
expiresAt: Date;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare const FILE_TYPES: {
|
|
157
|
+
IMAGE: "IMAGE";
|
|
158
|
+
AUDIO: "AUDIO";
|
|
159
|
+
VIDEO: "VIDEO";
|
|
160
|
+
DOCUMENT: "DOCUMENT";
|
|
161
|
+
ARCHIVE: "ARCHIVE";
|
|
162
|
+
OTHER: "OTHER";
|
|
163
|
+
};
|
|
164
|
+
type FileType = (typeof FILE_TYPES)[keyof typeof FILE_TYPES];
|
|
165
|
+
|
|
166
|
+
interface File$1 {
|
|
167
|
+
id: string;
|
|
168
|
+
key: string;
|
|
169
|
+
checksum: string;
|
|
170
|
+
width: number | null;
|
|
171
|
+
height: number | null;
|
|
172
|
+
duration: number | null;
|
|
173
|
+
originalName: string;
|
|
174
|
+
size: number;
|
|
175
|
+
extension: string;
|
|
176
|
+
mimeType: string;
|
|
177
|
+
type: FileType;
|
|
178
|
+
isLocked: boolean;
|
|
179
|
+
folderId: string | null;
|
|
180
|
+
createdAt: Date;
|
|
181
|
+
updatedAt: Date;
|
|
182
|
+
deletedAt: Date | null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface FileTranslation extends Translation {
|
|
186
|
+
id: string;
|
|
187
|
+
locale: string;
|
|
188
|
+
name: string | null;
|
|
189
|
+
alt: string | null;
|
|
190
|
+
fileId: string;
|
|
191
|
+
createdAt: Date;
|
|
192
|
+
updatedAt: Date;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface Folder {
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
key: string;
|
|
199
|
+
isLocked: boolean;
|
|
200
|
+
parentFolderId: string | null;
|
|
201
|
+
createdAt: Date;
|
|
202
|
+
updatedAt: Date;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
type FolderFull = Folder & {
|
|
206
|
+
parentFolder: (Folder & {
|
|
207
|
+
subFolders: Folder[];
|
|
208
|
+
files: File$1[];
|
|
209
|
+
}) | null;
|
|
210
|
+
subFolders: Folder[];
|
|
211
|
+
files: File$1[];
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
declare const POST_TYPES: {
|
|
215
|
+
TOPIC: "TOPIC";
|
|
216
|
+
CATEGORY: "CATEGORY";
|
|
217
|
+
POST: "POST";
|
|
218
|
+
TAG: "TAG";
|
|
219
|
+
PAGE: "PAGE";
|
|
220
|
+
};
|
|
221
|
+
type PostType = (typeof POST_TYPES)[keyof typeof POST_TYPES];
|
|
222
|
+
interface ExternalLink {
|
|
223
|
+
name: string;
|
|
224
|
+
href: string;
|
|
225
|
+
}
|
|
226
|
+
interface Faq {
|
|
227
|
+
question: string;
|
|
228
|
+
answer: string;
|
|
229
|
+
}
|
|
230
|
+
interface TocItem {
|
|
231
|
+
text: string;
|
|
232
|
+
id: string;
|
|
233
|
+
level: 2 | 3 | 4 | 5 | 6;
|
|
234
|
+
children?: TocItem[];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface Post {
|
|
238
|
+
id: string;
|
|
239
|
+
type: PostType;
|
|
240
|
+
isLocked: boolean;
|
|
241
|
+
isActive: boolean;
|
|
242
|
+
isIndexActive: boolean;
|
|
243
|
+
index: number | null;
|
|
244
|
+
isSlugActive: boolean;
|
|
245
|
+
slug: string;
|
|
246
|
+
isFeatured: boolean;
|
|
247
|
+
isShownOnHome: boolean;
|
|
248
|
+
authorId: string | null;
|
|
249
|
+
topicId: string | null;
|
|
250
|
+
coverImageId: string | null;
|
|
251
|
+
createdAt: Date;
|
|
252
|
+
updatedAt: Date;
|
|
253
|
+
deletedAt: Date | null;
|
|
254
|
+
state1: boolean;
|
|
255
|
+
state2: boolean;
|
|
256
|
+
state3: boolean;
|
|
257
|
+
state4: boolean;
|
|
258
|
+
state5: boolean;
|
|
259
|
+
state6: boolean;
|
|
260
|
+
state7: boolean;
|
|
261
|
+
state8: boolean;
|
|
262
|
+
state9: boolean;
|
|
263
|
+
state10: boolean;
|
|
264
|
+
image1Id: string | null;
|
|
265
|
+
image2Id: string | null;
|
|
266
|
+
image3Id: string | null;
|
|
267
|
+
image4Id: string | null;
|
|
268
|
+
text1: string | null;
|
|
269
|
+
text2: string | null;
|
|
270
|
+
text3: string | null;
|
|
271
|
+
text4: string | null;
|
|
272
|
+
text5: string | null;
|
|
273
|
+
text6: string | null;
|
|
274
|
+
text7: string | null;
|
|
275
|
+
text8: string | null;
|
|
276
|
+
text9: string | null;
|
|
277
|
+
text10: string | null;
|
|
278
|
+
data1: any[];
|
|
279
|
+
data2: any[];
|
|
280
|
+
data3: any[];
|
|
281
|
+
data4: any[];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
interface PostTranslation extends Translation {
|
|
285
|
+
id: string;
|
|
286
|
+
locale: string;
|
|
287
|
+
title: string | null;
|
|
288
|
+
subtitle: string | null;
|
|
289
|
+
summary: string | null;
|
|
290
|
+
description: string | null;
|
|
291
|
+
content: string | null;
|
|
292
|
+
externalLinks: ExternalLink[];
|
|
293
|
+
faq: Faq[];
|
|
294
|
+
toc: TocItem[];
|
|
295
|
+
readTime: number | null;
|
|
296
|
+
wordCount: number;
|
|
297
|
+
postId: string;
|
|
298
|
+
createdAt: Date;
|
|
299
|
+
updatedAt: Date;
|
|
300
|
+
text1: string | null;
|
|
301
|
+
text2: string | null;
|
|
302
|
+
text3: string | null;
|
|
303
|
+
text4: string | null;
|
|
304
|
+
text5: string | null;
|
|
305
|
+
text6: string | null;
|
|
306
|
+
text7: string | null;
|
|
307
|
+
text8: string | null;
|
|
308
|
+
text9: string | null;
|
|
309
|
+
text10: string | null;
|
|
310
|
+
data1: any[];
|
|
311
|
+
data2: any[];
|
|
312
|
+
data3: any[];
|
|
313
|
+
data4: any[];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
type PostListCard = Post & {
|
|
317
|
+
topic: (Post & {
|
|
318
|
+
translations: PostTranslation[];
|
|
319
|
+
}) | null;
|
|
320
|
+
postsInTopic: Post[];
|
|
321
|
+
children: Post[];
|
|
322
|
+
taggedPosts: Post[];
|
|
323
|
+
coverImage: File$1 | null;
|
|
324
|
+
translations: PostTranslation[];
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
type PostFull = Post & {
|
|
328
|
+
author: AdminCard | null;
|
|
329
|
+
topic: PostListCard | null;
|
|
330
|
+
postsInTopic: PostListCard[];
|
|
331
|
+
parents: PostListCard[];
|
|
332
|
+
children: PostListCard[];
|
|
333
|
+
tags: PostListCard[];
|
|
334
|
+
taggedPosts: PostListCard[];
|
|
335
|
+
relatedPosts: PostListCard[];
|
|
336
|
+
referencingPosts: PostListCard[];
|
|
337
|
+
coverImage: FileCard | null;
|
|
338
|
+
images1: FileCard[];
|
|
339
|
+
images2: FileCard[];
|
|
340
|
+
image1: FileCard | null;
|
|
341
|
+
image2: FileCard | null;
|
|
342
|
+
image3: FileCard | null;
|
|
343
|
+
image4: FileCard | null;
|
|
344
|
+
translations: PostTranslation[];
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
type FileFull = File$1 & {
|
|
348
|
+
folder: Folder | null;
|
|
349
|
+
adminAsAvatarImage: Admin[];
|
|
350
|
+
postsAsCoverImage: Post[];
|
|
351
|
+
postsAsContentImage: Post[];
|
|
352
|
+
postsAsImages1: Post[];
|
|
353
|
+
postsAsImages2: Post[];
|
|
354
|
+
postsAsImage1: Post[];
|
|
355
|
+
postsAsImage2: Post[];
|
|
356
|
+
postsAsImage3: Post[];
|
|
357
|
+
postsAsImage4: Post[];
|
|
358
|
+
translations: FileTranslation[];
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
type FileCard = File$1 & {
|
|
362
|
+
translations: FileTranslation[];
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
type AdminFull = AdminSafe & {
|
|
366
|
+
adminRefreshTokens: AdminRefreshToken[];
|
|
367
|
+
avatarImage: (File$1 & {
|
|
368
|
+
translations: FileTranslation[];
|
|
369
|
+
}) | null;
|
|
370
|
+
posts: Post[];
|
|
371
|
+
translations: AdminTranslation[];
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
type AdminCard = AdminSafe & {
|
|
375
|
+
translations: AdminTranslation[];
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
type SingleItem = {
|
|
379
|
+
id: string;
|
|
380
|
+
} | null;
|
|
381
|
+
type MultiItems = {
|
|
382
|
+
id: string;
|
|
383
|
+
}[];
|
|
384
|
+
|
|
385
|
+
interface CreateParams$4 {
|
|
386
|
+
email: string;
|
|
387
|
+
role: AdminRole;
|
|
388
|
+
passwordHash: string;
|
|
389
|
+
socialLinks: string[];
|
|
390
|
+
avatarImage: SingleItem;
|
|
391
|
+
translations: (BaseTranslation & {
|
|
392
|
+
name: string | null;
|
|
393
|
+
authorName: string | null;
|
|
394
|
+
description: string | null;
|
|
395
|
+
jobTitle: string | null;
|
|
396
|
+
url: string | null;
|
|
397
|
+
worksFor: string | null;
|
|
398
|
+
knowsAbout: string[];
|
|
399
|
+
homeLocation: string | null;
|
|
400
|
+
nationality: string | null;
|
|
401
|
+
})[];
|
|
402
|
+
}
|
|
403
|
+
interface UpdateParams$3 {
|
|
404
|
+
id: string;
|
|
405
|
+
email?: string;
|
|
406
|
+
role: AdminRole;
|
|
407
|
+
socialLinks: string[];
|
|
408
|
+
avatarImage: SingleItem;
|
|
409
|
+
emailVerifiedAt: Date | null;
|
|
410
|
+
translations: (BaseTranslation & {
|
|
411
|
+
name: string | null;
|
|
412
|
+
authorName: string | null;
|
|
413
|
+
description: string | null;
|
|
414
|
+
jobTitle: string | null;
|
|
415
|
+
url: string | null;
|
|
416
|
+
worksFor: string | null;
|
|
417
|
+
knowsAbout: string[];
|
|
418
|
+
homeLocation: string | null;
|
|
419
|
+
nationality: string | null;
|
|
420
|
+
})[];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare function createAdminCommandRepository(prisma: any): {
|
|
424
|
+
create: ({ avatarImage, translations, ...params }: CreateParams$4) => Promise<Admin>;
|
|
425
|
+
update: ({ id, avatarImage, translations, ...params }: UpdateParams$3) => Promise<Admin>;
|
|
426
|
+
delete: ({ id }: {
|
|
427
|
+
id: string;
|
|
428
|
+
}) => Promise<Admin>;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
interface FindListCardsParams$3 {
|
|
432
|
+
locale: string;
|
|
433
|
+
searchString?: string;
|
|
434
|
+
role?: AdminRole;
|
|
435
|
+
adminIds?: string[];
|
|
436
|
+
page?: number;
|
|
437
|
+
pageSize?: number;
|
|
438
|
+
}
|
|
439
|
+
interface FindParams$2 {
|
|
440
|
+
id?: string;
|
|
441
|
+
email?: string;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare function createAdminQueryRepository(prisma: any): {
|
|
445
|
+
findListCards: ({ locale, searchString, role, adminIds, page, pageSize, }: FindListCardsParams$3) => Promise<{
|
|
446
|
+
items: AdminFull[];
|
|
447
|
+
total: number;
|
|
448
|
+
}>;
|
|
449
|
+
find: (params: FindParams$2) => Promise<AdminSafe | null>;
|
|
450
|
+
findFull: (params: FindParams$2) => Promise<AdminFull | null>;
|
|
451
|
+
findWithPasswordHash: (params: FindParams$2) => Promise<Admin | null>;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
interface CreateParams$3 {
|
|
455
|
+
tokenHash: string;
|
|
456
|
+
email: string;
|
|
457
|
+
ip: string;
|
|
458
|
+
deviceInfo?: DeviceInfo;
|
|
459
|
+
adminId: string;
|
|
460
|
+
expiresAt: Date;
|
|
461
|
+
}
|
|
462
|
+
interface DeleteParams {
|
|
463
|
+
id?: string;
|
|
464
|
+
tokenHash?: string;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
declare function createAdminRefreshTokenCommandRepository(prisma: any): {
|
|
468
|
+
create: ({ adminId, ...params }: CreateParams$3) => Promise<AdminRefreshToken>;
|
|
469
|
+
delete: ({ id, tokenHash }: DeleteParams) => Promise<void>;
|
|
470
|
+
deleteManyByExpired: () => Promise<number>;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
declare function createAdminRefreshTokenQueryRepository(prisma: any): {
|
|
474
|
+
findManyByAdminId: ({ adminId, }: {
|
|
475
|
+
adminId: string;
|
|
476
|
+
}) => Promise<AdminRefreshToken[]>;
|
|
477
|
+
findByToken: ({ tokenHash, }: {
|
|
478
|
+
tokenHash: string;
|
|
479
|
+
}) => Promise<AdminRefreshToken | null>;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
interface CreateParams$2 {
|
|
483
|
+
key: string;
|
|
484
|
+
checksum: string;
|
|
485
|
+
fileMeta: {
|
|
486
|
+
type?: string;
|
|
487
|
+
size?: number;
|
|
488
|
+
name?: string;
|
|
489
|
+
};
|
|
490
|
+
width?: number | null;
|
|
491
|
+
height?: number | null;
|
|
492
|
+
duration?: number | null;
|
|
493
|
+
folder?: SingleItem;
|
|
494
|
+
translations: (BaseTranslation & {
|
|
495
|
+
name: string | null;
|
|
496
|
+
alt: string | null;
|
|
497
|
+
})[];
|
|
498
|
+
}
|
|
499
|
+
interface UpdateParams$2 {
|
|
500
|
+
id: string;
|
|
501
|
+
file: File$1;
|
|
502
|
+
key: string;
|
|
503
|
+
checksum: string;
|
|
504
|
+
fileMeta: {
|
|
505
|
+
type?: string;
|
|
506
|
+
size?: number;
|
|
507
|
+
name?: string;
|
|
508
|
+
};
|
|
509
|
+
width?: number | null;
|
|
510
|
+
height?: number | null;
|
|
511
|
+
duration?: number | null;
|
|
512
|
+
folder?: SingleItem;
|
|
513
|
+
translations: (BaseTranslation & {
|
|
514
|
+
name: string | null;
|
|
515
|
+
alt: string | null;
|
|
516
|
+
})[];
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare function createFileCommandRepository(prisma: any): {
|
|
520
|
+
create: ({ fileMeta, folder, translations, ...params }: CreateParams$2) => Promise<FileFull>;
|
|
521
|
+
update: ({ file, id, fileMeta, folder, translations, ...params }: UpdateParams$2) => Promise<File>;
|
|
522
|
+
softDelete: ({ id }: {
|
|
523
|
+
id: string;
|
|
524
|
+
}) => Promise<File>;
|
|
525
|
+
softDeleteMany: ({ ids }: {
|
|
526
|
+
ids: string[];
|
|
527
|
+
}) => Promise<number>;
|
|
528
|
+
restoreMany: ({ ids }: {
|
|
529
|
+
ids: string[];
|
|
530
|
+
}) => Promise<number>;
|
|
531
|
+
delete: ({ id }: {
|
|
532
|
+
id: string;
|
|
533
|
+
}) => Promise<File>;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
interface FindListCardsParams$2 {
|
|
537
|
+
locale: string;
|
|
538
|
+
searchString?: string;
|
|
539
|
+
type?: FileType | null;
|
|
540
|
+
isDeleted?: boolean;
|
|
541
|
+
isLocked?: boolean | null;
|
|
542
|
+
folderId?: string;
|
|
543
|
+
fileIds?: string[];
|
|
544
|
+
page?: number;
|
|
545
|
+
pageSize?: number;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
declare function createFileQueryRepository(prisma: any): {
|
|
549
|
+
findListCards: ({ locale, page, pageSize, searchString, type, folderId, isLocked, isDeleted, fileIds, }: FindListCardsParams$2) => Promise<{
|
|
550
|
+
items: FileFull[];
|
|
551
|
+
total: number;
|
|
552
|
+
}>;
|
|
553
|
+
findManyByIds: ({ ids, }: {
|
|
554
|
+
ids: string[];
|
|
555
|
+
}) => Promise<FileFull[]>;
|
|
556
|
+
findFull: ({ id }: {
|
|
557
|
+
id: string;
|
|
558
|
+
}) => Promise<FileFull | null>;
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
interface CreateParams$1 {
|
|
562
|
+
key: string;
|
|
563
|
+
name: string;
|
|
564
|
+
parentFolder: Folder | null;
|
|
565
|
+
}
|
|
566
|
+
interface UpdateParams$1 {
|
|
567
|
+
id: string;
|
|
568
|
+
key: string;
|
|
569
|
+
name: string;
|
|
570
|
+
parentFolder: Folder | null;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
declare function createFolderCommandRepository(prisma: any): {
|
|
574
|
+
create: ({ parentFolder, ...params }: CreateParams$1) => Promise<Folder>;
|
|
575
|
+
update: ({ id, parentFolder, ...params }: UpdateParams$1) => Promise<Folder>;
|
|
576
|
+
delete: ({ id }: {
|
|
577
|
+
id: string;
|
|
578
|
+
}) => Promise<Folder>;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
interface FindListCardsParams$1 {
|
|
582
|
+
searchString?: string;
|
|
583
|
+
parentFolderId?: string;
|
|
584
|
+
folderIds?: string[];
|
|
585
|
+
page?: number;
|
|
586
|
+
pageSize?: number;
|
|
587
|
+
}
|
|
588
|
+
interface FindParams$1 {
|
|
589
|
+
id?: string;
|
|
590
|
+
key?: string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
declare function createFolderQueryRepository(prisma: any): {
|
|
594
|
+
findListCards: ({ searchString, parentFolderId, folderIds, page, pageSize, }: FindListCardsParams$1) => Promise<{
|
|
595
|
+
items: FolderFull[];
|
|
596
|
+
total: number;
|
|
597
|
+
}>;
|
|
598
|
+
findFull: (params: FindParams$1) => Promise<FolderFull | null>;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
interface CreateParams {
|
|
602
|
+
type: PostType;
|
|
603
|
+
isLocked: boolean;
|
|
604
|
+
isActive: boolean;
|
|
605
|
+
isIndexActive: boolean;
|
|
606
|
+
index: number | null;
|
|
607
|
+
isSlugActive: boolean;
|
|
608
|
+
slug: string | null;
|
|
609
|
+
isFeatured: boolean;
|
|
610
|
+
isShownOnHome: boolean;
|
|
611
|
+
author: SingleItem;
|
|
612
|
+
topicId: string | null;
|
|
613
|
+
parents: MultiItems;
|
|
614
|
+
tags: MultiItems;
|
|
615
|
+
relatedPosts: MultiItems;
|
|
616
|
+
coverImage: SingleItem;
|
|
617
|
+
contentImageIds: string[];
|
|
618
|
+
state1: boolean;
|
|
619
|
+
state2: boolean;
|
|
620
|
+
state3: boolean;
|
|
621
|
+
state4: boolean;
|
|
622
|
+
state5: boolean;
|
|
623
|
+
state6: boolean;
|
|
624
|
+
state7: boolean;
|
|
625
|
+
state8: boolean;
|
|
626
|
+
state9: boolean;
|
|
627
|
+
state10: boolean;
|
|
628
|
+
images1: MultiItems;
|
|
629
|
+
images2: MultiItems;
|
|
630
|
+
image1: SingleItem;
|
|
631
|
+
image2: SingleItem;
|
|
632
|
+
image3: SingleItem;
|
|
633
|
+
image4: SingleItem;
|
|
634
|
+
text1: string | null;
|
|
635
|
+
text2: string | null;
|
|
636
|
+
text3: string | null;
|
|
637
|
+
text4: string | null;
|
|
638
|
+
text5: string | null;
|
|
639
|
+
text6: string | null;
|
|
640
|
+
text7: string | null;
|
|
641
|
+
text8: string | null;
|
|
642
|
+
text9: string | null;
|
|
643
|
+
text10: string | null;
|
|
644
|
+
data1: any[];
|
|
645
|
+
data2: any[];
|
|
646
|
+
data3: any[];
|
|
647
|
+
data4: any[];
|
|
648
|
+
translations: (BaseTranslation & {
|
|
649
|
+
title: string | null;
|
|
650
|
+
subtitle: string | null;
|
|
651
|
+
summary: string | null;
|
|
652
|
+
description: string | null;
|
|
653
|
+
content: string | null;
|
|
654
|
+
externalLinks: ExternalLink[];
|
|
655
|
+
faq: Faq[];
|
|
656
|
+
toc: TocItem[];
|
|
657
|
+
readTime: number | null;
|
|
658
|
+
wordCount: number;
|
|
659
|
+
text1: string | null;
|
|
660
|
+
text2: string | null;
|
|
661
|
+
text3: string | null;
|
|
662
|
+
text4: string | null;
|
|
663
|
+
text5: string | null;
|
|
664
|
+
text6: string | null;
|
|
665
|
+
text7: string | null;
|
|
666
|
+
text8: string | null;
|
|
667
|
+
text9: string | null;
|
|
668
|
+
text10: string | null;
|
|
669
|
+
data1: any[];
|
|
670
|
+
data2: any[];
|
|
671
|
+
data3: any[];
|
|
672
|
+
data4: any[];
|
|
673
|
+
})[];
|
|
674
|
+
}
|
|
675
|
+
interface UpdateParams {
|
|
676
|
+
id: string;
|
|
677
|
+
type: PostType;
|
|
678
|
+
isLocked: boolean;
|
|
679
|
+
isActive: boolean;
|
|
680
|
+
isIndexActive: boolean;
|
|
681
|
+
index: number | null;
|
|
682
|
+
isSlugActive: boolean;
|
|
683
|
+
slug: string | null;
|
|
684
|
+
isFeatured: boolean;
|
|
685
|
+
isShownOnHome: boolean;
|
|
686
|
+
author: SingleItem;
|
|
687
|
+
topicId: string | null;
|
|
688
|
+
parents: MultiItems;
|
|
689
|
+
tags: MultiItems;
|
|
690
|
+
relatedPosts: MultiItems;
|
|
691
|
+
coverImage: SingleItem;
|
|
692
|
+
contentImageIds: string[];
|
|
693
|
+
state1: boolean;
|
|
694
|
+
state2: boolean;
|
|
695
|
+
state3: boolean;
|
|
696
|
+
state4: boolean;
|
|
697
|
+
state5: boolean;
|
|
698
|
+
state6: boolean;
|
|
699
|
+
state7: boolean;
|
|
700
|
+
state8: boolean;
|
|
701
|
+
state9: boolean;
|
|
702
|
+
state10: boolean;
|
|
703
|
+
images1: MultiItems;
|
|
704
|
+
images2: MultiItems;
|
|
705
|
+
image1: SingleItem;
|
|
706
|
+
image2: SingleItem;
|
|
707
|
+
image3: SingleItem;
|
|
708
|
+
image4: SingleItem;
|
|
709
|
+
text1: string | null;
|
|
710
|
+
text2: string | null;
|
|
711
|
+
text3: string | null;
|
|
712
|
+
text4: string | null;
|
|
713
|
+
text5: string | null;
|
|
714
|
+
text6: string | null;
|
|
715
|
+
text7: string | null;
|
|
716
|
+
text8: string | null;
|
|
717
|
+
text9: string | null;
|
|
718
|
+
text10: string | null;
|
|
719
|
+
data1: any[];
|
|
720
|
+
data2: any[];
|
|
721
|
+
data3: any[];
|
|
722
|
+
data4: any[];
|
|
723
|
+
translations: (BaseTranslation & {
|
|
724
|
+
title: string | null;
|
|
725
|
+
subtitle: string | null;
|
|
726
|
+
summary: string | null;
|
|
727
|
+
description: string | null;
|
|
728
|
+
content: string | null;
|
|
729
|
+
externalLinks: ExternalLink[];
|
|
730
|
+
faq: Faq[];
|
|
731
|
+
toc: TocItem[];
|
|
732
|
+
readTime: number | null;
|
|
733
|
+
wordCount: number;
|
|
734
|
+
text1: string | null;
|
|
735
|
+
text2: string | null;
|
|
736
|
+
text3: string | null;
|
|
737
|
+
text4: string | null;
|
|
738
|
+
text5: string | null;
|
|
739
|
+
text6: string | null;
|
|
740
|
+
text7: string | null;
|
|
741
|
+
text8: string | null;
|
|
742
|
+
text9: string | null;
|
|
743
|
+
text10: string | null;
|
|
744
|
+
data1: any[];
|
|
745
|
+
data2: any[];
|
|
746
|
+
data3: any[];
|
|
747
|
+
data4: any[];
|
|
748
|
+
})[];
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
declare function createPostCommandRepository(prisma: any): {
|
|
752
|
+
create: ({ slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: CreateParams) => Promise<Post>;
|
|
753
|
+
update: ({ id, slug, author, topicId, parents, tags, relatedPosts, coverImage, contentImageIds, images1, images2, image1, image2, image3, image4, translations, ...params }: UpdateParams) => Promise<Post>;
|
|
754
|
+
delete: ({ id }: {
|
|
755
|
+
id: string;
|
|
756
|
+
}) => Promise<Post>;
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
interface Alternate {
|
|
760
|
+
hreflang: string;
|
|
761
|
+
href: string | null;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
interface SeoMetadata {
|
|
765
|
+
id: string;
|
|
766
|
+
locale: string;
|
|
767
|
+
title: string | null;
|
|
768
|
+
description: string | null;
|
|
769
|
+
author: string | null;
|
|
770
|
+
canonical: string | null;
|
|
771
|
+
alternate: Alternate[];
|
|
772
|
+
robots: string | null;
|
|
773
|
+
ogTitle: string | null;
|
|
774
|
+
ogDescription: string | null;
|
|
775
|
+
ogUrl: string | null;
|
|
776
|
+
ogType: string | null;
|
|
777
|
+
ogSiteName: string | null;
|
|
778
|
+
ogImage: string | null;
|
|
779
|
+
ogImageAlt: string | null;
|
|
780
|
+
ogImageType: string | null;
|
|
781
|
+
ogImageWidth: number | null;
|
|
782
|
+
ogImageHeight: number | null;
|
|
783
|
+
ogLocale: string | null;
|
|
784
|
+
ogLocaleAlternate: string[];
|
|
785
|
+
ogArticlePublishedTime: Date | null;
|
|
786
|
+
ogArticleModifiedTime: Date | null;
|
|
787
|
+
ogArticleAuthor: string | null;
|
|
788
|
+
ogArticleSection: string | null;
|
|
789
|
+
ogArticleTag: string[];
|
|
790
|
+
twitterCard: string | null;
|
|
791
|
+
twitterSite: string | null;
|
|
792
|
+
twitterCreator: string | null;
|
|
793
|
+
jsonLd: object[];
|
|
794
|
+
postId: string;
|
|
795
|
+
createdAt: Date;
|
|
796
|
+
updatedAt: Date;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
interface FindListCardsParams {
|
|
800
|
+
locale: string;
|
|
801
|
+
type: PostType | null;
|
|
802
|
+
page?: number;
|
|
803
|
+
pageSize?: number;
|
|
804
|
+
searchString?: string;
|
|
805
|
+
topicId?: string;
|
|
806
|
+
postIds?: string[];
|
|
807
|
+
isActive?: boolean;
|
|
808
|
+
isIndexActive?: boolean;
|
|
809
|
+
isSlugActive?: boolean;
|
|
810
|
+
isFeatured?: boolean;
|
|
811
|
+
isShownOnHome?: boolean;
|
|
812
|
+
}
|
|
813
|
+
interface FindParams {
|
|
814
|
+
id?: string;
|
|
815
|
+
type?: PostType;
|
|
816
|
+
slug?: string;
|
|
817
|
+
}
|
|
818
|
+
interface FindManyParams {
|
|
819
|
+
type: PostType;
|
|
820
|
+
topicId?: string;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
declare function createPostQueryRepository(prisma: any): {
|
|
824
|
+
findListCards: ({ locale, searchString, type, topicId, postIds, isActive, isIndexActive, isSlugActive, isFeatured, isShownOnHome, page, pageSize, }: FindListCardsParams) => Promise<{
|
|
825
|
+
items: PostListCard[];
|
|
826
|
+
total: number;
|
|
827
|
+
}>;
|
|
828
|
+
findMany: ({ type, topicId, }: FindManyParams) => Promise<(Post & {
|
|
829
|
+
translations: PostTranslation[];
|
|
830
|
+
})[]>;
|
|
831
|
+
find: (params: FindParams) => Promise<(Post & {
|
|
832
|
+
translations: PostTranslation[];
|
|
833
|
+
}) | null>;
|
|
834
|
+
findFull: (params: FindParams) => Promise<PostFull | null>;
|
|
835
|
+
findWithSeoMetadata: (params: FindParams) => Promise<(Post & {
|
|
836
|
+
translations: PostTranslation[];
|
|
837
|
+
seoMetadatas: SeoMetadata[];
|
|
838
|
+
}) | null>;
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
export { createAdminCommandRepository, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenQueryRepository, createArgon2Service, createCookieService, createCryptoService, createFileCommandRepository, createFileQueryRepository, createFolderCommandRepository, createFolderQueryRepository, createJwtService, createPostCommandRepository, createPostQueryRepository };
|