@yimingliao/cms 0.0.77 → 0.0.79

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,86 +1,21 @@
1
- import jwt from 'jsonwebtoken';
2
- import { BinaryLike } from 'node:crypto';
3
- import { cookies } from 'next/headers';
1
+ import { a as createZod, b as createSchemas, A as ActionContext, d as createTocItemSchema } from '../create-verify-action-DBwWOXPO.js';
2
+ export { R as RawCacheKey, e as createAdminCommandRepository, f as createAdminQueryRepository, g as createAdminRefreshTokenCommandRepository, h as createAdminRefreshTokenQueryRepository, i as createArgon2Service, j as createAuthMiddleware, k as createAuthUseCases, l as createCacheResult, m as createCookieService, n as createCryptoService, o as createEmailVerificationEmail, p as createExecuteAction, q as createExist, r as createFileCommandRepository, s as createFileQueryRepository, t as createFolderCommandRepository, u as createFolderQueryRepository, v as createForgotPasswordEmail, w as createIpRateLimiter, x as createJwtService, y as createPostCommandRepository, z as createPostQueryRepository, B as createRenderEmailTemplate, C as createSendEmail, D as createSeoMetadataCommandRepository, E as createUnique, F as createVerifyAccessToken, c as createVerifyAction, G as createVerifyRefreshToken, H as normalizeCacheKey } from '../create-verify-action-DBwWOXPO.js';
4
3
  import Keyv from 'keyv';
5
- import { Logger } from 'logry';
6
- import { PrismaClient } from '@prisma/client';
7
4
  import * as zod from 'zod';
8
- import zod__default, { z, ZodType } from 'zod';
5
+ import zod__default from 'zod';
9
6
  import { B as BlobFile } from '../types-0oS1A2K5.js';
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, 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
7
  import * as nodemailer_lib_smtp_transport from 'nodemailer/lib/smtp-transport';
13
- import nodemailer, { Transporter, SentMessageInfo } from 'nodemailer';
14
- import { S as SuccessResult, R as Result } from '../types-DHlRoJwv.js';
8
+ import nodemailer from 'nodemailer';
15
9
  import { BaseTranslator, LocaleMessages } from 'intor';
10
+ import { Logger } from 'logry';
16
11
  import { NextResponse } from 'next/server';
17
- import { S as StorageService } from '../types-J25u1G6t.js';
18
-
19
- interface CreateJwtServiceParams {
20
- defaultSecret: string;
21
- issuer?: string;
22
- audience?: string;
23
- }
24
- declare function createJwtService({ defaultSecret, ...options }: CreateJwtServiceParams): {
25
- sign: ({ payload, secret, expiresIn, }: {
26
- payload: object;
27
- secret: string;
28
- expiresIn: number;
29
- }) => string;
30
- verify: ({ token, secret, }: {
31
- token: string;
32
- secret: string;
33
- }) => jwt.JwtPayload;
34
- };
35
-
36
- declare function createArgon2Service(): {
37
- hash: (password: string) => Promise<string>;
38
- verify: (digest: string, password: string) => Promise<boolean>;
39
- };
40
-
41
- interface CreateCryptoServiceParams {
42
- defaultSecret: string;
43
- }
44
- declare function createCryptoService({ defaultSecret, }: CreateCryptoServiceParams): {
45
- generateToken: () => string;
46
- hash: (value: BinaryLike) => string;
47
- hashBuffer: (value: BinaryLike) => Buffer;
48
- encrypt: (data: string) => string;
49
- decrypt: (data: string) => string;
50
- sign: ({ value, expireSeconds, createdAt, }: {
51
- value: string;
52
- expireSeconds: number;
53
- createdAt?: number;
54
- }) => {
55
- signed: string;
56
- signature: string;
57
- };
58
- };
59
-
60
- declare function createCookieService(nextCookies: () => Promise<Awaited<ReturnType<typeof cookies>>>, cryptoService: ReturnType<typeof createCryptoService>): {
61
- set: ({ name, value, expireSeconds, }: {
62
- name: string;
63
- value: string;
64
- expireSeconds: number;
65
- }) => Promise<void>;
66
- setSignedCookie: ({ name, value, expireSeconds, }: {
67
- name: string;
68
- value: string;
69
- expireSeconds: number;
70
- }) => Promise<void>;
71
- get: ({ name }: {
72
- name: string;
73
- }) => Promise<string | undefined>;
74
- getSignedCookie: ({ name }: {
75
- name: string;
76
- }) => Promise<string>;
77
- verifySignedCookie: ({ signed }: {
78
- signed: string | undefined;
79
- }) => string;
80
- delete: ({ name }: {
81
- name: string;
82
- }) => Promise<void>;
83
- };
12
+ import { D as DeviceInfo, R as Result, g as AdminFull, j as AdminSafe, e as Admin, h as AdminRefreshToken, a as Folder, b as FileFull, p as File$1, r as FileType, F as FolderFull, T as TocItem, f as AdminCard, u as PostListCard, c as FileCard, t as Post, w as PostType, v as PostTranslation, P as PostFull } from '../types-BGsFazJr.js';
13
+ import * as zod_v4_core from 'zod/v4/core';
14
+ import '../types-J25u1G6t.js';
15
+ import 'jsonwebtoken';
16
+ import 'node:crypto';
17
+ import 'next/headers';
18
+ import '@prisma/client';
84
19
 
85
20
  interface CreateServerCacheParams {
86
21
  redisUrl: string;
@@ -89,93 +24,6 @@ interface CreateServerCacheParams {
89
24
  }
90
25
  declare function createCache({ redisUrl, namespace, keyDelimiter, }: CreateServerCacheParams): Keyv<unknown>;
91
26
 
92
- type RawCacheKey = string | Array<string | number | boolean | undefined | null>;
93
- declare const normalizeCacheKey: (key?: RawCacheKey, delimiter?: string) => string | null;
94
-
95
- interface CacheResultOptions<T> {
96
- key: RawCacheKey;
97
- ttl?: number;
98
- load: () => Promise<T>;
99
- }
100
- declare function createCacheResult(cache: Keyv<unknown>, logger: Logger): <T>({ key: rawKey, ttl, load, }: CacheResultOptions<T>) => Promise<T>;
101
-
102
- interface RateLimiterOptions {
103
- key: RawCacheKey;
104
- maxAttempts?: number;
105
- timeWindow?: number;
106
- }
107
- declare function createIpRateLimiter({ appName, cache, headers, }: {
108
- cache: Keyv<unknown>;
109
- appName: string;
110
- headers: () => Promise<Headers>;
111
- }): ({ key: rawKey, maxAttempts, timeWindow, }: RateLimiterOptions) => Promise<boolean>;
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
-
119
- type Scope = {
120
- name: string;
121
- value: string;
122
- cast?: string;
123
- };
124
- type UniqueOptions = {
125
- table: string;
126
- column: string;
127
- scope?: Scope[];
128
- excludeSelf?: Scope;
129
- };
130
- declare function createUnique(prisma: PrismaClient): (value: string, options: UniqueOptions) => Promise<boolean>;
131
-
132
- declare module "zod" {
133
- interface ZodString {
134
- unique(options: UniqueOptions): this;
135
- exist(options: ExistOptions): this;
136
- bcp47(): this;
137
- ogLocale(): this;
138
- }
139
- interface ZodEmail {
140
- unique(options: UniqueOptions): this;
141
- }
142
- }
143
- declare function createZod({ unique, exist, }: {
144
- unique: ReturnType<typeof createUnique>;
145
- exist: ReturnType<typeof createExist>;
146
- }): typeof z;
147
-
148
- declare function createSchemas({ z, localeArray, exist, }: {
149
- z: ReturnType<typeof createZod>;
150
- localeArray: string[];
151
- exist: ReturnType<typeof createExist>;
152
- }): {
153
- z: typeof zod__default;
154
- text: () => zod__default.ZodString;
155
- positiveNumber: () => zod__default.ZodPipe<zod__default.ZodTransform<number | undefined, unknown>, zod__default.ZodNumber>;
156
- url: () => zod__default.ZodPipe<zod__default.ZodTransform<{} | null | undefined, unknown>, zod__default.ZodNullable<zod__default.ZodURL>>;
157
- email: () => zod__default.ZodEmail;
158
- password: () => zod__default.ZodString;
159
- isoString: () => zod__default.ZodString;
160
- array: <T extends ZodType>(schema: T) => zod__default.ZodPipe<zod__default.ZodArray<T>, zod__default.ZodTransform<NonNullable<zod__default.core.output<T>>[], zod__default.core.output<T>[]>>;
161
- id: () => zod__default.ZodString;
162
- key: () => zod__default.ZodString;
163
- sha256Hash: () => zod__default.ZodString;
164
- slug: () => zod__default.ZodString;
165
- pathSegment: () => zod__default.ZodString;
166
- locale: () => zod__default.ZodString;
167
- singleItem: (options: ExistOptions) => zod__default.ZodNullable<zod__default.ZodObject<{
168
- id: zod__default.ZodString;
169
- }, zod__default.core.$strip>>;
170
- multiItems: (options: ExistOptions) => zod__default.ZodPipe<zod__default.ZodArray<zod__default.ZodObject<{
171
- id: zod__default.ZodString;
172
- }, zod__default.core.$strip>>, zod__default.ZodTransform<{
173
- id: string;
174
- }[], {
175
- id: string;
176
- }[]>>;
177
- };
178
-
179
27
  declare function createFileSchema({ z, maxSizeInMb, }: {
180
28
  z: ReturnType<typeof createZod>;
181
29
  maxSizeInMb: number;
@@ -192,11 +40,6 @@ declare function createMultiFileSchema({ z, fileSchema, maxSizeInMb, }: {
192
40
  extensions?: string[];
193
41
  }) => zod.ZodArray<zod.ZodPipe<zod.ZodCustom<File, File>, zod.ZodTransform<BlobFile, File>>>;
194
42
 
195
- declare function createTocItemSchema({ z, schemas, }: {
196
- z: ReturnType<typeof createZod>;
197
- schemas: ReturnType<typeof createSchemas>;
198
- }): ZodType<TocItem, unknown, zod_v4_core.$ZodTypeInternals<TocItem, unknown>>;
199
-
200
43
  declare function createTransporter({ host, port, user, pass, }: {
201
44
  host: string;
202
45
  port: number;
@@ -204,497 +47,6 @@ declare function createTransporter({ host, port, user, pass, }: {
204
47
  pass: string;
205
48
  }): nodemailer.Transporter<nodemailer_lib_smtp_transport.SentMessageInfo, nodemailer_lib_smtp_transport.Options>;
206
49
 
207
- interface SendEmailOptions {
208
- to: string;
209
- subject: string;
210
- html: string;
211
- }
212
- declare function createSendEmail({ transporter, config, }: {
213
- transporter: Transporter;
214
- config: {
215
- fromName: string;
216
- fromAddress: string;
217
- replyToName: string;
218
- replyToaddress: string;
219
- };
220
- }): (options: SendEmailOptions) => Promise<SentMessageInfo>;
221
-
222
- declare function createRenderEmailTemplate({ siteName, webUrl, logoUrl, logger, }: {
223
- siteName: string;
224
- webUrl: string;
225
- logoUrl: string;
226
- logger: Logger;
227
- }): (templateKey: string, replacements?: Record<string, string>) => Promise<string>;
228
-
229
- interface CreateParams$4 {
230
- role: AdminRole;
231
- email: string;
232
- passwordHash: string;
233
- socialLinks: string[];
234
- avatarImage: SingleItem;
235
- translations: (BaseTranslation & {
236
- name: string | null;
237
- authorName: string | null;
238
- description: string | null;
239
- jobTitle: string | null;
240
- url: string | null;
241
- worksFor: string | null;
242
- knowsAbout: string[];
243
- homeLocation: string | null;
244
- nationality: string | null;
245
- })[];
246
- }
247
- interface UpdateParams$3 {
248
- id: string;
249
- role: AdminRole;
250
- email?: string;
251
- socialLinks: string[];
252
- avatarImage: SingleItem;
253
- translations: (BaseTranslation & {
254
- name: string | null;
255
- authorName: string | null;
256
- description: string | null;
257
- jobTitle: string | null;
258
- url: string | null;
259
- worksFor: string | null;
260
- knowsAbout: string[];
261
- homeLocation: string | null;
262
- nationality: string | null;
263
- })[];
264
- emailVerifiedAt: Date | null;
265
- }
266
-
267
- declare function createAdminCommandRepository(prisma: PrismaClient): {
268
- create: ({ role, email, passwordHash, socialLinks, avatarImage, translations, }: CreateParams$4) => Promise<Admin>;
269
- update: ({ id, role, email, socialLinks, avatarImage, translations, emailVerifiedAt, }: UpdateParams$3) => Promise<Admin>;
270
- delete: ({ id }: {
271
- id: string;
272
- }) => Promise<Admin>;
273
- };
274
-
275
- interface FindListCardsParams$3 {
276
- locale: string;
277
- searchString?: string;
278
- role?: AdminRole;
279
- adminIds?: string[];
280
- page?: number;
281
- pageSize?: number;
282
- }
283
- interface FindParams$2 {
284
- id?: string;
285
- email?: string;
286
- }
287
-
288
- declare function createAdminQueryRepository(prisma: PrismaClient): {
289
- findListCards: ({ locale, searchString, role, adminIds, page, pageSize, }: FindListCardsParams$3) => Promise<{
290
- items: AdminFull[];
291
- total: number;
292
- }>;
293
- find: (params: FindParams$2) => Promise<AdminSafe | null>;
294
- findFull: (params: FindParams$2) => Promise<AdminFull | null>;
295
- findWithPasswordHash: (params: FindParams$2) => Promise<Admin | null>;
296
- };
297
-
298
- interface CreateParams$3 {
299
- tokenHash: string;
300
- email: string;
301
- ip: string;
302
- deviceInfo?: DeviceInfo;
303
- adminId: string;
304
- expiresAt: Date;
305
- }
306
- interface DeleteParams {
307
- id?: string;
308
- tokenHash?: string;
309
- }
310
-
311
- declare function createAdminRefreshTokenCommandRepository(prisma: PrismaClient): {
312
- create: ({ adminId, ...params }: CreateParams$3) => Promise<AdminRefreshToken>;
313
- delete: ({ id, tokenHash }: DeleteParams) => Promise<void>;
314
- deleteManyByExpired: () => Promise<number>;
315
- };
316
-
317
- declare function createAdminRefreshTokenQueryRepository(prisma: PrismaClient): {
318
- findManyByAdminId: ({ adminId, }: {
319
- adminId: string;
320
- }) => Promise<AdminRefreshToken[]>;
321
- findByToken: ({ tokenHash, }: {
322
- tokenHash: string;
323
- }) => Promise<AdminRefreshToken | null>;
324
- };
325
-
326
- interface CreateParams$2 {
327
- key: string;
328
- checksum: string;
329
- fileMeta: {
330
- type?: string;
331
- size?: number;
332
- name?: string;
333
- };
334
- width?: number | null;
335
- height?: number | null;
336
- duration?: number | null;
337
- folder?: SingleItem;
338
- translations: (BaseTranslation & {
339
- name: string | null;
340
- alt: string | null;
341
- })[];
342
- }
343
- interface UpdateParams$2 {
344
- id: string;
345
- file: File$1;
346
- key: string;
347
- checksum: string;
348
- fileMeta: {
349
- type?: string;
350
- size?: number;
351
- name?: string;
352
- };
353
- width?: number | null;
354
- height?: number | null;
355
- duration?: number | null;
356
- folder?: SingleItem;
357
- translations: (BaseTranslation & {
358
- name: string | null;
359
- alt: string | null;
360
- })[];
361
- }
362
-
363
- declare function createFileCommandRepository(prisma: PrismaClient): {
364
- create: ({ key, checksum, fileMeta, width, height, duration, folder, translations, }: CreateParams$2) => Promise<FileFull>;
365
- update: ({ file, id, key, checksum, fileMeta, width, height, duration, folder, translations, }: UpdateParams$2) => Promise<File$1>;
366
- softDelete: ({ id }: {
367
- id: string;
368
- }) => Promise<File$1>;
369
- softDeleteMany: ({ ids }: {
370
- ids: string[];
371
- }) => Promise<number>;
372
- restoreMany: ({ ids }: {
373
- ids: string[];
374
- }) => Promise<number>;
375
- delete: ({ id }: {
376
- id: string;
377
- }) => Promise<File$1>;
378
- };
379
-
380
- interface FindListCardsParams$2 {
381
- locale: string;
382
- searchString?: string;
383
- type?: FileType | null;
384
- isDeleted?: boolean;
385
- isLocked?: boolean | null;
386
- folderId?: string;
387
- fileIds?: string[];
388
- page?: number;
389
- pageSize?: number;
390
- }
391
-
392
- declare function createFileQueryRepository(prisma: PrismaClient): {
393
- findListCards: ({ locale, page, pageSize, searchString, type, folderId, isLocked, isDeleted, fileIds, }: FindListCardsParams$2) => Promise<{
394
- items: FileFull[];
395
- total: number;
396
- }>;
397
- findManyByIds: ({ ids, }: {
398
- ids: string[];
399
- }) => Promise<FileFull[]>;
400
- findFull: ({ id }: {
401
- id: string;
402
- }) => Promise<FileFull | null>;
403
- };
404
-
405
- interface CreateParams$1 {
406
- key: string;
407
- name: string;
408
- parentFolder: Folder | null;
409
- }
410
- interface UpdateParams$1 {
411
- id: string;
412
- key: string;
413
- name: string;
414
- parentFolder: Folder | null;
415
- }
416
-
417
- declare function createFolderCommandRepository(prisma: PrismaClient): {
418
- create: ({ key, name, parentFolder, }: CreateParams$1) => Promise<Folder>;
419
- update: ({ id, key, name, parentFolder, }: UpdateParams$1) => Promise<Folder>;
420
- delete: ({ id }: {
421
- id: string;
422
- }) => Promise<Folder>;
423
- };
424
-
425
- interface FindListCardsParams$1 {
426
- searchString?: string;
427
- parentFolderId?: string;
428
- folderIds?: string[];
429
- page?: number;
430
- pageSize?: number;
431
- }
432
- interface FindParams$1 {
433
- id?: string;
434
- key?: string;
435
- }
436
-
437
- declare function createFolderQueryRepository(prisma: PrismaClient): {
438
- findListCards: ({ searchString, parentFolderId, folderIds, page, pageSize, }: FindListCardsParams$1) => Promise<{
439
- items: FolderFull[];
440
- total: number;
441
- }>;
442
- findFull: (params: FindParams$1) => Promise<FolderFull | null>;
443
- };
444
-
445
- interface CreateParams {
446
- type: string;
447
- isLocked: boolean;
448
- isActive: boolean;
449
- isIndexActive: boolean;
450
- index: number | null;
451
- isSlugActive: boolean;
452
- slug: string | null;
453
- isFeatured: boolean;
454
- isShownOnHome: boolean;
455
- author: SingleItem;
456
- topicId: string | null;
457
- parents: MultiItems;
458
- tags: MultiItems;
459
- relatedPosts: MultiItems;
460
- coverImage: SingleItem;
461
- contentImageIds: string[];
462
- state1: boolean;
463
- state2: boolean;
464
- state3: boolean;
465
- state4: boolean;
466
- state5: boolean;
467
- state6: boolean;
468
- state7: boolean;
469
- state8: boolean;
470
- state9: boolean;
471
- state10: boolean;
472
- images1: MultiItems;
473
- images2: MultiItems;
474
- image1: SingleItem;
475
- image2: SingleItem;
476
- image3: SingleItem;
477
- image4: SingleItem;
478
- text1: string | null;
479
- text2: string | null;
480
- text3: string | null;
481
- text4: string | null;
482
- text5: string | null;
483
- text6: string | null;
484
- text7: string | null;
485
- text8: string | null;
486
- text9: string | null;
487
- text10: string | null;
488
- data1: any[];
489
- data2: any[];
490
- data3: any[];
491
- data4: any[];
492
- translations: (BaseTranslation & {
493
- title: string | null;
494
- subtitle: string | null;
495
- summary: string | null;
496
- description: string | null;
497
- content: string | null;
498
- externalLinks: ExternalLink[];
499
- faq: Faq[];
500
- toc: TocItem[];
501
- readTime: number | null;
502
- wordCount: number;
503
- text1: string | null;
504
- text2: string | null;
505
- text3: string | null;
506
- text4: string | null;
507
- text5: string | null;
508
- text6: string | null;
509
- text7: string | null;
510
- text8: string | null;
511
- text9: string | null;
512
- text10: string | null;
513
- data1: any[];
514
- data2: any[];
515
- data3: any[];
516
- data4: any[];
517
- })[];
518
- }
519
- interface UpdateParams {
520
- id: string;
521
- type: string;
522
- isLocked: boolean;
523
- isActive: boolean;
524
- isIndexActive: boolean;
525
- index: number | null;
526
- isSlugActive: boolean;
527
- slug: string | null;
528
- isFeatured: boolean;
529
- isShownOnHome: boolean;
530
- author: SingleItem;
531
- topicId: string | null;
532
- parents: MultiItems;
533
- tags: MultiItems;
534
- relatedPosts: MultiItems;
535
- coverImage: SingleItem;
536
- contentImageIds: string[];
537
- state1: boolean;
538
- state2: boolean;
539
- state3: boolean;
540
- state4: boolean;
541
- state5: boolean;
542
- state6: boolean;
543
- state7: boolean;
544
- state8: boolean;
545
- state9: boolean;
546
- state10: boolean;
547
- images1: MultiItems;
548
- images2: MultiItems;
549
- image1: SingleItem;
550
- image2: SingleItem;
551
- image3: SingleItem;
552
- image4: SingleItem;
553
- text1: string | null;
554
- text2: string | null;
555
- text3: string | null;
556
- text4: string | null;
557
- text5: string | null;
558
- text6: string | null;
559
- text7: string | null;
560
- text8: string | null;
561
- text9: string | null;
562
- text10: string | null;
563
- data1: any[];
564
- data2: any[];
565
- data3: any[];
566
- data4: any[];
567
- translations: (BaseTranslation & {
568
- title: string | null;
569
- subtitle: string | null;
570
- summary: string | null;
571
- description: string | null;
572
- content: string | null;
573
- externalLinks: ExternalLink[];
574
- faq: Faq[];
575
- toc: TocItem[];
576
- readTime: number | null;
577
- wordCount: number;
578
- text1: string | null;
579
- text2: string | null;
580
- text3: string | null;
581
- text4: string | null;
582
- text5: string | null;
583
- text6: string | null;
584
- text7: string | null;
585
- text8: string | null;
586
- text9: string | null;
587
- text10: string | null;
588
- data1: any[];
589
- data2: any[];
590
- data3: any[];
591
- data4: any[];
592
- })[];
593
- }
594
-
595
- declare function createPostCommandRepository(prisma: PrismaClient): {
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
- delete: ({ id }: {
599
- id: string;
600
- }) => Promise<Post>;
601
- };
602
-
603
- interface FindListCardsParams {
604
- locale: string;
605
- searchString?: string;
606
- type: PostType | null;
607
- isActive?: boolean;
608
- isIndexActive?: boolean;
609
- isSlugActive?: boolean;
610
- isFeatured?: boolean;
611
- isShownOnHome?: boolean;
612
- state1?: boolean;
613
- state2?: boolean;
614
- state3?: boolean;
615
- state4?: boolean;
616
- state5?: boolean;
617
- state6?: boolean;
618
- state7?: boolean;
619
- state8?: boolean;
620
- state9?: boolean;
621
- state10?: boolean;
622
- topicId?: string;
623
- topicSlug?: string;
624
- categoryId?: string;
625
- categorySlug?: string;
626
- postIds?: string[];
627
- excludeIds?: string[];
628
- page?: number;
629
- pageSize?: number;
630
- }
631
- interface FindParams {
632
- id?: string;
633
- type?: PostType;
634
- slug?: string;
635
- isActive?: boolean;
636
- topicSlug?: string;
637
- }
638
- interface FindManyParams {
639
- type: PostType;
640
- topicId?: string;
641
- }
642
-
643
- declare function createPostQueryRepository(prisma: PrismaClient): {
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<{
645
- items: PostListCard[];
646
- total: number;
647
- }>;
648
- findMany: ({ type, topicId, }: FindManyParams) => Promise<(Post & {
649
- translations: PostTranslation[];
650
- })[]>;
651
- find: ({ isActive, ...rest }: FindParams) => Promise<(Post & {
652
- translations: PostTranslation[];
653
- }) | null>;
654
- findFull: ({ isActive, topicSlug, ...rest }: FindParams) => Promise<{
655
- post: PostFull | undefined;
656
- prev: PostListCard | undefined;
657
- next: PostListCard | undefined;
658
- }>;
659
- };
660
-
661
- interface UpsertParams {
662
- postId: string;
663
- translations: (BaseTranslation & {
664
- title: string | null;
665
- description: string | null;
666
- author: string | null;
667
- canonical: string | null;
668
- alternate: Alternate[];
669
- robots: string | null;
670
- ogTitle: string | null;
671
- ogDescription: string | null;
672
- ogUrl: string | null;
673
- ogType: string | null;
674
- ogSiteName: string | null;
675
- ogImage: string | null;
676
- ogImageAlt: string | null;
677
- ogImageType: string | null;
678
- ogImageWidth: number | null;
679
- ogImageHeight: number | null;
680
- ogLocale: string | null;
681
- ogLocaleAlternate: string[];
682
- ogArticlePublishedTime: string | null;
683
- ogArticleModifiedTime: string | null;
684
- ogArticleAuthor: string | null;
685
- ogArticleSection: string | null;
686
- ogArticleTag: string[];
687
- twitterCard: string | null;
688
- twitterSite: string | null;
689
- twitterCreator: string | null;
690
- jsonLd: object[];
691
- })[];
692
- }
693
-
694
- declare function createSeoMetadataCommandRepository(prisma: PrismaClient): {
695
- upsert: ({ postId, translations, }: UpsertParams) => Promise<void>;
696
- };
697
-
698
50
  declare const ORDER_BY: readonly [{
699
51
  readonly updatedAt: "desc";
700
52
  }, {
@@ -721,22 +73,6 @@ declare const POST_ORDER_BY: ({
721
73
  index: "asc";
722
74
  })[];
723
75
 
724
- type Action<D> = (translator: BaseTranslator<LocaleMessages>) => Promise<Omit<SuccessResult<D>, "success"> & {
725
- i18nKey?: string;
726
- }>;
727
- interface CreateExecuteActionParams {
728
- initI18n: () => Promise<BaseTranslator<LocaleMessages>>;
729
- cacheResult: <T>({ key, ttl, load }: CacheResultOptions<T>) => Promise<T>;
730
- cache: Keyv<unknown>;
731
- logger: Logger;
732
- }
733
- interface ServerActionParams {
734
- type?: "command" | "query";
735
- key?: RawCacheKey;
736
- ttl?: number;
737
- }
738
- declare function createExecuteAction({ initI18n, cacheResult, cache, logger, }: CreateExecuteActionParams): <D = void>(fn: Action<D>, options?: ServerActionParams) => Promise<Result<D>>;
739
-
740
76
  type Api = (translator: BaseTranslator<LocaleMessages>) => Promise<NextResponse<unknown>>;
741
77
  interface CreateExecuteApiParams {
742
78
  initI18n: () => Promise<BaseTranslator<LocaleMessages>>;
@@ -744,185 +80,6 @@ interface CreateExecuteApiParams {
744
80
  }
745
81
  declare function createExecuteApi({ initI18n, logger }: CreateExecuteApiParams): (fn: Api) => Promise<NextResponse<unknown>>;
746
82
 
747
- interface CreateVerifyAccessTokenParams {
748
- adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
749
- jwtService: ReturnType<typeof createJwtService>;
750
- cryptoService: ReturnType<typeof createCryptoService>;
751
- cookieService: ReturnType<typeof createCookieService>;
752
- config: {
753
- accessTokenName: string;
754
- accessTokenSecret: string;
755
- };
756
- }
757
- declare function createVerifyAccessToken({ adminQueryRepository, jwtService, cryptoService, cookieService, config, }: CreateVerifyAccessTokenParams): () => Promise<{
758
- admin: AdminFull;
759
- } | null>;
760
-
761
- interface CreateVerifyRefreshTokenParams {
762
- adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
763
- adminRefreshTokenQueryRepository: ReturnType<typeof createAdminRefreshTokenQueryRepository>;
764
- cryptoService: ReturnType<typeof createCryptoService>;
765
- cookieService: ReturnType<typeof createCookieService>;
766
- config: {
767
- refreshTokenName: string;
768
- };
769
- }
770
- declare function createVerifyRefreshToken({ adminQueryRepository, adminRefreshTokenQueryRepository, cryptoService, cookieService, config, }: CreateVerifyRefreshTokenParams): () => Promise<{
771
- adminRefreshToken: AdminRefreshToken;
772
- admin: AdminFull;
773
- } | null>;
774
-
775
- interface CreateAuthUseCases {
776
- prisma: PrismaClient;
777
- adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
778
- adminRefreshTokenCommandRepository: ReturnType<typeof createAdminRefreshTokenCommandRepository>;
779
- jwtService: ReturnType<typeof createJwtService>;
780
- argon2Service: ReturnType<typeof createArgon2Service>;
781
- cryptoService: ReturnType<typeof createCryptoService>;
782
- cookieService: ReturnType<typeof createCookieService>;
783
- config: {
784
- refreshTokenName: string;
785
- refreshTokenTtl: number;
786
- accessTokenName: string;
787
- accessTokenSecret: string;
788
- accessTokenTtl: number;
789
- resetPasswordSecret: string;
790
- resetPasswordTtl: number;
791
- verifyEmailSecret: string;
792
- verifyEmailTtl: number;
793
- };
794
- }
795
- declare function createAuthUseCases({ prisma, adminQueryRepository, adminRefreshTokenCommandRepository, jwtService, argon2Service, cryptoService, cookieService, config, }: CreateAuthUseCases): {
796
- verifyCredentials: ({ email, password, }: {
797
- email: string;
798
- password: string;
799
- }) => Promise<Admin>;
800
- updatePassword: ({ email, password, }: {
801
- email: string;
802
- password: string;
803
- }) => Promise<Admin>;
804
- createRefreshToken: ({ admin, deviceInfo, ip, }: {
805
- admin: {
806
- id: string;
807
- email: string;
808
- };
809
- deviceInfo: DeviceInfo;
810
- ip: string;
811
- }) => Promise<string>;
812
- refreshTokens: ({ admin, deviceInfo, ip, }: {
813
- admin: {
814
- id: string;
815
- email: string;
816
- };
817
- deviceInfo: DeviceInfo;
818
- ip: string;
819
- }) => Promise<void>;
820
- signPasswordResetToken: ({ admin }: {
821
- admin: AdminSafe;
822
- }) => string;
823
- verifyPasswordResetToken: ({ token }: {
824
- token: string;
825
- }) => {
826
- email: string;
827
- };
828
- signEmailVerificationToken: () => string;
829
- verifyEmailAndUpdate: ({ token, admin, }: {
830
- token: string;
831
- admin: AdminSafe;
832
- }) => Promise<AdminSafe>;
833
- };
834
-
835
- interface SendParams$1 {
836
- translator: BaseTranslator<LocaleMessages>;
837
- admin: AdminSafe;
838
- newEmail?: string;
839
- }
840
- declare function createEmailVerificationEmail({ renderEmailTemplate, sendEmail, authUseCases, webUrl, }: {
841
- renderEmailTemplate: ReturnType<typeof createRenderEmailTemplate>;
842
- sendEmail: ReturnType<typeof createSendEmail>;
843
- authUseCases: ReturnType<typeof createAuthUseCases>;
844
- webUrl: string;
845
- }): {
846
- generateHtml: (replacements?: {
847
- emailVerificationUrl: string;
848
- }) => Promise<string>;
849
- send: ({ translator, admin, newEmail }: SendParams$1) => Promise<any>;
850
- };
851
-
852
- interface SendParams {
853
- translator: BaseTranslator<LocaleMessages>;
854
- admin: AdminSafe;
855
- }
856
- declare function createForgotPasswordEmail({ renderEmailTemplate, sendEmail, authUseCases, webUrl, }: {
857
- renderEmailTemplate: ReturnType<typeof createRenderEmailTemplate>;
858
- sendEmail: ReturnType<typeof createSendEmail>;
859
- authUseCases: ReturnType<typeof createAuthUseCases>;
860
- webUrl: string;
861
- }): {
862
- generateHtml: (replacements?: {
863
- passwordResetUrl: string;
864
- }) => Promise<string>;
865
- send: ({ translator, admin }: SendParams) => Promise<any>;
866
- };
867
-
868
- interface CreateAuthMiddlewareParams {
869
- adminRefreshTokenCommandRepository: ReturnType<typeof createAdminRefreshTokenCommandRepository>;
870
- authUseCases: ReturnType<typeof createAuthUseCases>;
871
- verifyAccessToken: ReturnType<typeof createVerifyAccessToken>;
872
- verifyRefreshToken: ReturnType<typeof createVerifyRefreshToken>;
873
- headers: () => Promise<Headers>;
874
- }
875
- declare function createAuthMiddleware({ adminRefreshTokenCommandRepository, authUseCases, verifyAccessToken, verifyRefreshToken, headers, }: CreateAuthMiddlewareParams): {
876
- authenticate(): Promise<AdminFull>;
877
- };
878
-
879
- interface ActionContext {
880
- services: {
881
- cryptoService: ReturnType<typeof createCryptoService>;
882
- argon2Service: ReturnType<typeof createArgon2Service>;
883
- cookieService: ReturnType<typeof createCookieService>;
884
- storageService: StorageService;
885
- };
886
- repositories: {
887
- adminQueryRepository: ReturnType<typeof createAdminQueryRepository>;
888
- adminCommandRepository: ReturnType<typeof createAdminCommandRepository>;
889
- adminRefreshTokenQueryRepository: ReturnType<typeof createAdminRefreshTokenQueryRepository>;
890
- adminRefreshTokenCommandRepository: ReturnType<typeof createAdminRefreshTokenCommandRepository>;
891
- folderQueryRepository: ReturnType<typeof createFolderQueryRepository>;
892
- folderCommandRepository: ReturnType<typeof createFolderCommandRepository>;
893
- fileQueryRepository: ReturnType<typeof createFileQueryRepository>;
894
- fileCommandRepository: ReturnType<typeof createFileCommandRepository>;
895
- postCommandRepository: ReturnType<typeof createPostCommandRepository>;
896
- postQueryRepository: ReturnType<typeof createPostQueryRepository>;
897
- seoMetadataCommandRepository: ReturnType<typeof createSeoMetadataCommandRepository>;
898
- };
899
- useCases: {
900
- authUseCases: ReturnType<typeof createAuthUseCases>;
901
- };
902
- middlewares: {
903
- authMiddleware: ReturnType<typeof createAuthMiddleware>;
904
- };
905
- action: {
906
- executeAction: ReturnType<typeof createExecuteAction>;
907
- ipRateLimiter: (options: RateLimiterOptions) => Promise<void>;
908
- };
909
- emails: {
910
- emailVerificationEmail: ReturnType<typeof createEmailVerificationEmail>;
911
- forgotPasswordEmail: ReturnType<typeof createForgotPasswordEmail>;
912
- };
913
- http: {
914
- headers: () => Promise<Headers>;
915
- };
916
- schemas: {
917
- schemas: ReturnType<typeof createSchemas>;
918
- tocItemSchema: ReturnType<typeof createTocItemSchema>;
919
- };
920
- config: {
921
- accessTokenName: string;
922
- refreshTokenName: string;
923
- };
924
- }
925
-
926
83
  declare const signInValidator: (schemas: ReturnType<typeof createSchemas>) => zod.ZodObject<{
927
84
  email: zod.ZodEmail;
928
85
  password: zod.ZodString;
@@ -938,10 +95,6 @@ declare function createSignInAction(ctx: ActionContext): ({ formData, deviceInfo
938
95
 
939
96
  declare function createSignOutAction(ctx: ActionContext): () => Promise<Result<void>>;
940
97
 
941
- declare function createVerifyAction(ctx: ActionContext): () => Promise<Result<{
942
- admin: AdminFull;
943
- }>>;
944
-
945
98
  declare const changePasswordValidator: (schemas: ReturnType<typeof createSchemas>) => zod.ZodObject<{
946
99
  password: zod.ZodString;
947
100
  newPassword: zod.ZodString;
@@ -2455,4 +1608,4 @@ declare class ServerError extends Error {
2455
1608
  static internalServerError(): ServerError;
2456
1609
  }
2457
1610
 
2458
- export { ADMIN_ORDER_BY, type ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type ChangePasswordFormData, type EmailUnverifiedFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, type ForgotPasswordFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type RawCacheKey, type ResetPasswordFormData, type SeoMetadataUpsertFormData, ServerError, type SignInFormData, type VerifyEmailFormData, createAdminCommandRepository, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminQueryRepository, createAdminRefreshTokenCommandRepository, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminRefreshTokenQueryRepository, createAdminUpdateAction, createArgon2Service, createAuthMiddleware, createAuthUseCases, createCache, createCacheResult, createChangePasswordAction, createCookieService, createCryptoService, createEmailUnverifiedAction, createEmailVerificationEmail, createExecuteAction, createExecuteApi, createExist, createFileCommandRepository, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileQueryRepository, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCommandRepository, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderQueryRepository, createFolderUpdateAction, createForgotPasswordAction, createForgotPasswordEmail, createIpRateLimiter, createJwtService, createMultiFileSchema, createPostCommandRepository, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostQueryRepository, createPostUpdateAction, createRenderEmailTemplate, createResetPasswordAction, createSchemas, createSendEmail, createSeoMetadataCommandRepository, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createUnique, createVerifyAccessToken, createVerifyAction, createVerifyEmailAction, createVerifyRefreshToken, createZod, normalizeCacheKey };
1611
+ export { ADMIN_ORDER_BY, ActionContext, type AdminCreateFormData, type AdminUpdateFormData, type ChangePasswordFormData, type EmailUnverifiedFormData, type FileCreateFormData, type FileCreateManyFormData, type FileUpdateFormData, type FolderCreateFormData, type FolderUpdateFormData, type ForgotPasswordFormData, ORDER_BY, POST_ORDER_BY, type PostCreateFormData, type PostUpdateFormData, type ResetPasswordFormData, type SeoMetadataUpsertFormData, ServerError, type SignInFormData, type VerifyEmailFormData, createAdminCreateAction, createAdminDeleteAction, createAdminFindFullAction, createAdminFindListCardsAction, createAdminRefreshTokenDeleteAction, createAdminRefreshTokenFindManyAction, createAdminUpdateAction, createCache, createChangePasswordAction, createEmailUnverifiedAction, createExecuteApi, createFileCreateAction, createFileCreateManyAction, createFileFindFullAction, createFileFindListCardsAction, createFilePurgeManyAction, createFileRestoreManyAction, createFileSchema, createFileSoftDeleteAction, createFileSoftDeleteManyAction, createFileUpdateAction, createFolderCreateAction, createFolderDeleteAction, createFolderFindFullAction, createFolderFindListCardsAction, createFolderUpdateAction, createForgotPasswordAction, createMultiFileSchema, createPostCreateAction, createPostDeleteAction, createPostFindAction, createPostFindFullAction, createPostFindListCardsAction, createPostFindManyAction, createPostUpdateAction, createResetPasswordAction, createSchemas, createSeoMetadataUpsertAction, createSignInAction, createSignOutAction, createTocItemSchema, createTransporter, createVerifyEmailAction, createZod };