strapi-plugin-comments 3.0.0-beta.0 → 3.0.0

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.
Files changed (96) hide show
  1. package/README.md +83 -123
  2. package/dist/_chunks/{index-fAgatqD0.js → index-B-ygLKrb.js} +6080 -5662
  3. package/dist/_chunks/{index-fSb-gYwg.mjs → index-BgN4aUMA.mjs} +5 -5
  4. package/dist/_chunks/{index-h-TB6Qu2.mjs → index-Bx2boY6h.mjs} +6072 -5654
  5. package/dist/_chunks/{index-BQERo8pN.mjs → index-CIqMAf50.mjs} +1261 -1141
  6. package/dist/_chunks/{index-B6Q4U8YQ.js → index-CWfr5ejx.js} +27 -29
  7. package/dist/_chunks/{index-CTjupB9v.js → index-D8uskGzQ.js} +5 -5
  8. package/dist/_chunks/{index-BVj8EXjI.js → index-DFAPx7Bl.js} +1293 -1152
  9. package/dist/_chunks/{index-Bpbf7RON.mjs → index-Db2zwbpe.mjs} +27 -29
  10. package/dist/admin/index.js +1 -1
  11. package/dist/admin/index.mjs +1 -1
  12. package/dist/admin/src/api/client.d.ts +33 -52
  13. package/dist/admin/src/api/schemas.d.ts +454 -764
  14. package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
  15. package/dist/admin/src/contexts/UserContext.d.ts +1 -1
  16. package/dist/admin/src/hooks/useAPI.d.ts +34 -53
  17. package/dist/admin/src/hooks/useCommentMutations.d.ts +1 -1
  18. package/dist/admin/src/hooks/useCommentsAll.d.ts +7 -10
  19. package/dist/admin/src/hooks/useReports.d.ts +6 -10
  20. package/dist/admin/src/hooks/useUserContext.d.ts +1 -1
  21. package/dist/admin/src/pages/Settings/hooks/useSettingsAPI.d.ts +1 -1
  22. package/dist/server/index.js +9307 -2467
  23. package/dist/server/index.mjs +9307 -2467
  24. package/dist/server/src/{@types-v5 → @types}/utils.d.ts +4 -0
  25. package/dist/server/src/bootstrap.d.ts +1 -1
  26. package/dist/server/src/config/index.d.ts +52 -0
  27. package/dist/server/src/content-types/index.d.ts +1 -1
  28. package/dist/server/src/controllers/admin.controller.d.ts +110 -29
  29. package/dist/server/src/controllers/client.controller.d.ts +151 -23
  30. package/dist/server/src/controllers/index.d.ts +504 -197
  31. package/dist/server/src/controllers/settings.controller.d.ts +58 -2
  32. package/dist/server/src/controllers/utils/parsers.d.ts +4 -1
  33. package/dist/server/src/graphql/getResolversConfig.d.ts +21 -0
  34. package/dist/server/src/graphql/index.d.ts +2 -0
  35. package/dist/server/src/graphql/mutations/getCreateAbuseReport.d.ts +95 -0
  36. package/dist/server/src/graphql/mutations/getCreateComment.d.ts +84 -0
  37. package/dist/server/src/graphql/mutations/getRemoveComment.d.ts +84 -0
  38. package/dist/server/src/graphql/mutations/getUpdateComment.d.ts +84 -0
  39. package/dist/server/src/graphql/mutations/index.d.ts +3 -0
  40. package/dist/server/src/graphql/queries/findAllFlat.d.ts +177 -0
  41. package/dist/server/src/graphql/queries/findAllInHierarchy.d.ts +87 -0
  42. package/dist/server/src/graphql/queries/findAllPerAuthor.d.ts +176 -0
  43. package/dist/server/src/graphql/queries/index.d.ts +3 -0
  44. package/dist/server/src/graphql/types/getComment.d.ts +2 -0
  45. package/dist/server/src/graphql/types/getCommentAuthor.d.ts +2 -0
  46. package/dist/server/src/graphql/types/getCommentAuthorType.d.ts +2 -0
  47. package/dist/server/src/graphql/types/getCommentNested.d.ts +2 -0
  48. package/dist/server/src/graphql/types/getCreateComment.d.ts +2 -0
  49. package/dist/server/src/graphql/types/getCreateCommentAuthor.d.ts +2 -0
  50. package/dist/server/src/graphql/types/getCreateReport.d.ts +2 -0
  51. package/dist/server/src/graphql/types/getId.d.ts +2 -0
  52. package/dist/server/src/graphql/types/getIdentityAuthor.d.ts +2 -0
  53. package/dist/server/src/graphql/types/getRemoveComment.d.ts +2 -0
  54. package/dist/server/src/graphql/types/getReport.d.ts +2 -0
  55. package/dist/server/src/graphql/types/getReportReason.d.ts +3 -0
  56. package/dist/server/src/graphql/types/getResponseFindAll.d.ts +2 -0
  57. package/dist/server/src/graphql/types/getResponseFindAllPerAuthor.d.ts +2 -0
  58. package/dist/server/src/graphql/types/getResponseMeta.d.ts +2 -0
  59. package/dist/server/src/graphql/types/getResponsePagination.d.ts +2 -0
  60. package/dist/server/src/graphql/types/getUpdateComment.d.ts +2 -0
  61. package/dist/server/src/graphql/types/index.d.ts +3 -0
  62. package/dist/server/src/index.d.ts +1686 -779
  63. package/dist/server/src/register/custom-fields/index.d.ts +1 -1
  64. package/dist/server/src/register/index.d.ts +1 -1
  65. package/dist/server/src/repositories/comment.repository.d.ts +10 -1
  66. package/dist/server/src/repositories/index.d.ts +0 -2
  67. package/dist/server/src/repositories/report.comment.repository.d.ts +38 -1
  68. package/dist/server/src/repositories/store.repository.d.ts +175 -4
  69. package/dist/server/src/repositories/utils.d.ts +1 -3
  70. package/dist/server/src/routes/admin.routes.d.ts +1 -1
  71. package/dist/server/src/routes/client.routes.d.ts +1 -1
  72. package/dist/server/src/routes/index.d.ts +2 -2
  73. package/dist/server/src/services/admin/admin.service.d.ts +399 -188
  74. package/dist/server/src/services/admin/utils.d.ts +1 -1
  75. package/dist/server/src/services/client.service.d.ts +343 -177
  76. package/dist/server/src/services/common.service.d.ts +66 -22
  77. package/dist/server/src/services/gql.service.d.ts +7 -0
  78. package/dist/server/src/services/index.d.ts +1131 -552
  79. package/dist/server/src/services/settings.service.d.ts +44 -2
  80. package/dist/server/src/services/utils/functions.d.ts +10 -6
  81. package/dist/server/src/test/utils.d.ts +1 -0
  82. package/dist/server/src/utils/constants.d.ts +1 -1
  83. package/dist/server/src/utils/getConfig.d.ts +2 -2
  84. package/dist/server/src/utils/getPluginService.d.ts +2 -2
  85. package/dist/server/src/utils/throwError.d.ts +1 -1
  86. package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +116 -80
  87. package/dist/server/src/validators/api/controllers/settings.controller.validator.d.ts +7 -3
  88. package/dist/server/src/validators/repositories/comment.schema.d.ts +18 -3
  89. package/dist/server/src/validators/repositories/comment.validator.d.ts +400 -72
  90. package/dist/server/src/validators/repositories/reports.validator.d.ts +60 -18
  91. package/dist/server/src/validators/utils.d.ts +1 -1
  92. package/package.json +18 -11
  93. /package/dist/server/src/{@types-v5 → @types}/controllers.d.ts +0 -0
  94. /package/dist/server/src/{@types-v5 → @types}/index.d.ts +0 -0
  95. /package/dist/server/src/{@types-v5 → @types}/repositories.d.ts +0 -0
  96. /package/dist/server/src/{@types-v5 → @types}/routes.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { StrapiContext } from '../@types-v5';
2
- import { CommentsPluginConfig } from '../validators/api/controllers/settings.controller.validator';
1
+ import { StrapiContext } from '../@types';
2
+ import { CommentsPluginConfig } from '../config';
3
3
  declare const _default: ({ strapi }: StrapiContext) => {
4
4
  getConfig: (viaSettingsPage?: boolean) => Promise<{
5
5
  enabledCollections?: string[];
@@ -15,6 +15,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
15
15
  OTHER?: import("../const").REPORT_REASON.OTHER;
16
16
  };
17
17
  isGQLPluginEnabled?: boolean;
18
+ gql?: {
19
+ auth?: boolean;
20
+ };
21
+ client?: {
22
+ url?: string;
23
+ contactEmail?: string;
24
+ };
18
25
  } | Omit<{
19
26
  enabledCollections?: string[];
20
27
  approvalFlow?: string[];
@@ -29,6 +36,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
29
36
  OTHER?: import("../const").REPORT_REASON.OTHER;
30
37
  };
31
38
  isGQLPluginEnabled?: boolean;
39
+ gql?: {
40
+ auth?: boolean;
41
+ };
42
+ client?: {
43
+ url?: string;
44
+ contactEmail?: string;
45
+ };
32
46
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
33
47
  update: (config: CommentsPluginConfig) => Promise<{
34
48
  enabledCollections?: string[];
@@ -44,6 +58,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
44
58
  OTHER?: import("../const").REPORT_REASON.OTHER;
45
59
  };
46
60
  isGQLPluginEnabled?: boolean;
61
+ gql?: {
62
+ auth?: boolean;
63
+ };
64
+ client?: {
65
+ url?: string;
66
+ contactEmail?: string;
67
+ };
47
68
  } | Omit<{
48
69
  enabledCollections?: string[];
49
70
  approvalFlow?: string[];
@@ -58,6 +79,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
58
79
  OTHER?: import("../const").REPORT_REASON.OTHER;
59
80
  };
60
81
  isGQLPluginEnabled?: boolean;
82
+ gql?: {
83
+ auth?: boolean;
84
+ };
85
+ client?: {
86
+ url?: string;
87
+ contactEmail?: string;
88
+ };
61
89
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
62
90
  restore: () => Promise<{
63
91
  enabledCollections?: string[];
@@ -73,6 +101,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
73
101
  OTHER?: import("../const").REPORT_REASON.OTHER;
74
102
  };
75
103
  isGQLPluginEnabled?: boolean;
104
+ gql?: {
105
+ auth?: boolean;
106
+ };
107
+ client?: {
108
+ url?: string;
109
+ contactEmail?: string;
110
+ };
76
111
  } | Omit<{
77
112
  enabledCollections?: string[];
78
113
  approvalFlow?: string[];
@@ -87,6 +122,13 @@ declare const _default: ({ strapi }: StrapiContext) => {
87
122
  OTHER?: import("../const").REPORT_REASON.OTHER;
88
123
  };
89
124
  isGQLPluginEnabled?: boolean;
125
+ gql?: {
126
+ auth?: boolean;
127
+ };
128
+ client?: {
129
+ url?: string;
130
+ contactEmail?: string;
131
+ };
90
132
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
91
133
  restart: () => void;
92
134
  };
@@ -1,12 +1,16 @@
1
- import { StrapiAdmin, StrapiUser } from '@sensinum/strapi-utils';
2
- import { AdminUser, Id } from '../../@types-v5';
1
+ import { StrapiUser } from '@sensinum/strapi-utils';
2
+ import { AdminUser, Id } from '../../@types';
3
3
  import PluginError from '../../utils/error';
4
4
  import { Comment, CommentWithRelated } from '../../validators/repositories';
5
5
  export declare const buildNestedStructure: (entities: Array<Comment | CommentWithRelated>, id?: Id | null, field?: string, dropBlockedThreads?: boolean, blockNestedThreads?: boolean) => Array<Comment>;
6
6
  export declare const getRelatedGroups: (related: string) => Array<string>;
7
- export declare const getModelUid: (name: string) => string;
8
7
  export declare const filterOurResolvedReports: (item: Comment) => Comment;
9
- export declare const buildAuthorModel: (item: any, blockedAuthorProps: Array<string>, fieldsToPopulate?: Array<string>) => Comment;
10
- export declare const buildConfigQueryProp: (prop?: undefined | string | Array<string>) => string;
8
+ export declare const buildAuthorModel: (item: Comment | CommentWithRelated, blockedAuthorProps: Array<string>, fieldsToPopulate?: Array<string>) => Comment;
11
9
  export declare const resolveUserContextError: (user?: AdminUser | StrapiUser) => PluginError;
12
- export declare const getAuthorName: (author: StrapiAdmin) => string;
10
+ type AuthorNameProps = {
11
+ lastname?: string;
12
+ firstname?: string;
13
+ username?: string;
14
+ };
15
+ export declare const getAuthorName: (author: AuthorNameProps) => string;
16
+ export {};
@@ -0,0 +1 @@
1
+ export declare const caster: <T>(source: unknown) => T;
@@ -1,4 +1,4 @@
1
- import { LifeCycleHookName } from "./types";
1
+ import { LifeCycleHookName } from './types';
2
2
  export declare const CONFIG_PARAMS: {
3
3
  readonly ENABLED_COLLECTIONS: "enabledCollections";
4
4
  readonly APPROVAL_FLOW: "approvalFlow";
@@ -1,3 +1,3 @@
1
- import { StrapiContext } from '../@types-v5';
1
+ import { StrapiContext, PathValue } from '../@types';
2
2
  import { CommentsPluginConfig } from '../config';
3
- export declare const getConfig: <T extends "enabledCollections" | "approvalFlow" | "entryLabel" | "moderatorRoles" | "badWords" | "blockedAuthorProps" | "isValidationEnabled" | "reportReasons" | "isGQLPluginEnabled">(strapi: StrapiContext['strapi'], path: T, defaultValue: CommentsPluginConfig[T]) => Promise<CommentsPluginConfig[T]>;
3
+ export declare const getConfig: <T extends "enabledCollections" | "approvalFlow" | "entryLabel" | "moderatorRoles" | "badWords" | "blockedAuthorProps" | "isValidationEnabled" | "reportReasons" | "isGQLPluginEnabled" | "gql" | "client">(strapi: StrapiContext['strapi'], path: T, defaultValue: PathValue<CommentsPluginConfig, T>) => Promise<CommentsPluginConfig[T]>;
@@ -1,3 +1,3 @@
1
- import { CoreStrapi } from '../@types-v5';
1
+ import { CoreStrapi } from '../@types';
2
2
  import { PluginServices } from '../services';
3
- export declare const getPluginService: <T extends "admin" | "client" | "common" | "settings">(strapi: CoreStrapi, serviceName: T) => PluginServices[T];
3
+ export declare const getPluginService: <T extends "gql" | "client" | "admin" | "common" | "settings">(strapi: CoreStrapi, serviceName: T) => PluginServices[T];
@@ -1,3 +1,3 @@
1
- import { RequestContext } from '../@types-v5';
1
+ import { RequestContext } from '../@types';
2
2
  import PluginError from './PluginError';
3
3
  export declare const throwError: (ctx: RequestContext, e: PluginError | Error | unknown) => PluginError | Error | unknown | never;
@@ -1,27 +1,40 @@
1
+ import { CommentsPluginConfig } from '../../../config';
1
2
  import { APPROVAL_STATUS } from '../../../const';
2
3
  import { ExtractRightEither } from '../../../utils/Either';
3
4
  export declare const newCommentValidator: (enabledCollections: string[], relation: string, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
4
5
  content?: string;
5
6
  approvalStatus?: APPROVAL_STATUS;
7
+ locale?: string;
6
8
  author?: {
7
9
  name?: string;
8
10
  id?: number;
9
11
  email?: string;
10
12
  avatar?: string;
11
13
  };
12
- threadOf?: number;
13
- relation?: `{${string}::${string}.${number}}`;
14
+ threadOf?: string;
15
+ relation?: `${string}::${string}.${string}`;
14
16
  }>;
15
17
  export type NewCommentValidatorSchema = ExtractRightEither<ReturnType<typeof newCommentValidator>>;
16
18
  export declare const updateCommentValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
17
19
  content?: string;
18
- relation?: `{${string}::${string}.${number}}`;
20
+ relation?: `${string}::${string}.${string}`;
19
21
  commentId?: number;
20
22
  }>;
21
23
  export type UpdateCommentValidatorSchema = ExtractRightEither<ReturnType<typeof updateCommentValidator>>;
22
24
  export declare const findAllFlatValidator: (enabledCollections: string[], relation: string, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
23
- query?: {
24
- $and?: Record<string, string | number | {
25
+ sort?: string;
26
+ locale?: string;
27
+ pagination?: {
28
+ page?: number;
29
+ pageSize?: number;
30
+ withCount?: boolean;
31
+ };
32
+ relation?: `${string}::${string}.${string}`;
33
+ populate?: Record<string, boolean | {
34
+ populate?: boolean;
35
+ }>;
36
+ filters?: {
37
+ id?: string | number | {
25
38
  $eq?: string;
26
39
  } | {
27
40
  $eqi?: string;
@@ -55,8 +68,8 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
55
68
  $notContainsi?: string;
56
69
  } | {
57
70
  $notNull?: boolean;
58
- }>[];
59
- $or?: Record<string, string | number | {
71
+ };
72
+ content?: string | number | {
60
73
  $eq?: string;
61
74
  } | {
62
75
  $eqi?: string;
@@ -90,11 +103,8 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
90
103
  $notContainsi?: string;
91
104
  } | {
92
105
  $notNull?: boolean;
93
- }>[];
94
- } | Record<string, string | number | boolean | Record<string, string | number | boolean>>;
95
- sort?: string;
96
- filter?: {
97
- content?: string | number | {
106
+ };
107
+ createdAt?: string | number | {
98
108
  $eq?: string;
99
109
  } | {
100
110
  $eqi?: string;
@@ -129,7 +139,7 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
129
139
  } | {
130
140
  $notNull?: boolean;
131
141
  };
132
- createdAt?: string | number | {
142
+ updatedAt?: string | number | {
133
143
  $eq?: string;
134
144
  } | {
135
145
  $eqi?: string;
@@ -164,7 +174,7 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
164
174
  } | {
165
175
  $notNull?: boolean;
166
176
  };
167
- updatedAt?: string | number | {
177
+ authorName?: string | number | {
168
178
  $eq?: string;
169
179
  } | {
170
180
  $eqi?: string;
@@ -199,7 +209,23 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
199
209
  } | {
200
210
  $notNull?: boolean;
201
211
  };
202
- authorName?: string | number | {
212
+ };
213
+ limit?: number;
214
+ fields?: string[];
215
+ omit?: string[];
216
+ isAdmin?: boolean;
217
+ skip?: number;
218
+ }>;
219
+ export type FindAllFlatSchema = ExtractRightEither<ReturnType<typeof findAllFlatValidator>>;
220
+ export declare const findAllInHierarchyValidator: (enabledCollections: string[], relation: string, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
221
+ sort?: string;
222
+ locale?: string;
223
+ relation?: `${string}::${string}.${string}`;
224
+ populate?: Record<string, boolean | {
225
+ populate?: boolean;
226
+ }>;
227
+ filters?: {
228
+ id?: string | number | {
203
229
  $eq?: string;
204
230
  } | {
205
231
  $eqi?: string;
@@ -234,26 +260,7 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
234
260
  } | {
235
261
  $notNull?: boolean;
236
262
  };
237
- };
238
- pagination?: {
239
- page?: number;
240
- pageSize?: number;
241
- withCount?: boolean;
242
- };
243
- relation?: `{${string}::${string}.${number}}`;
244
- populate?: Record<string, boolean | {
245
- populate?: boolean;
246
- }>;
247
- limit?: number;
248
- fields?: string[];
249
- omit?: string[];
250
- isAdmin?: boolean;
251
- skip?: number;
252
- }>;
253
- export type FindAllFlatSchema = ExtractRightEither<ReturnType<typeof findAllFlatValidator>>;
254
- export declare const findAllInHierarchyValidator: (enabledCollections: string[], relation: string, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
255
- query?: {
256
- $and?: Record<string, string | number | {
263
+ content?: string | number | {
257
264
  $eq?: string;
258
265
  } | {
259
266
  $eqi?: string;
@@ -287,8 +294,8 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
287
294
  $notContainsi?: string;
288
295
  } | {
289
296
  $notNull?: boolean;
290
- }>[];
291
- $or?: Record<string, string | number | {
297
+ };
298
+ createdAt?: string | number | {
292
299
  $eq?: string;
293
300
  } | {
294
301
  $eqi?: string;
@@ -322,11 +329,8 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
322
329
  $notContainsi?: string;
323
330
  } | {
324
331
  $notNull?: boolean;
325
- }>[];
326
- } | Record<string, string | number | boolean | Record<string, string | number | boolean>>;
327
- sort?: string;
328
- filter?: {
329
- content?: string | number | {
332
+ };
333
+ updatedAt?: string | number | {
330
334
  $eq?: string;
331
335
  } | {
332
336
  $eqi?: string;
@@ -361,7 +365,7 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
361
365
  } | {
362
366
  $notNull?: boolean;
363
367
  };
364
- createdAt?: string | number | {
368
+ authorName?: string | number | {
365
369
  $eq?: string;
366
370
  } | {
367
371
  $eqi?: string;
@@ -396,7 +400,31 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
396
400
  } | {
397
401
  $notNull?: boolean;
398
402
  };
399
- updatedAt?: string | number | {
403
+ };
404
+ limit?: number;
405
+ fields?: string[];
406
+ omit?: string[];
407
+ isAdmin?: boolean;
408
+ skip?: number;
409
+ startingFromId?: number;
410
+ dropBlockedThreads?: boolean;
411
+ }>;
412
+ export type FindAllInHierarchyValidatorSchema = ExtractRightEither<ReturnType<typeof findAllInHierarchyValidator>>;
413
+ export declare const findAllPerAuthorValidator: (params: object, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
414
+ type?: string;
415
+ sort?: string;
416
+ authorId?: string | number;
417
+ locale?: string;
418
+ pagination?: {
419
+ page?: number;
420
+ pageSize?: number;
421
+ withCount?: boolean;
422
+ };
423
+ populate?: Record<string, boolean | {
424
+ populate?: boolean;
425
+ }>;
426
+ filters?: {
427
+ id?: string | number | {
400
428
  $eq?: string;
401
429
  } | {
402
430
  $eqi?: string;
@@ -431,7 +459,7 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
431
459
  } | {
432
460
  $notNull?: boolean;
433
461
  };
434
- authorName?: string | number | {
462
+ content?: string | number | {
435
463
  $eq?: string;
436
464
  } | {
437
465
  $eqi?: string;
@@ -466,23 +494,7 @@ export declare const findAllInHierarchyValidator: (enabledCollections: string[],
466
494
  } | {
467
495
  $notNull?: boolean;
468
496
  };
469
- };
470
- relation?: `{${string}::${string}.${number}}`;
471
- populate?: Record<string, boolean | {
472
- populate?: boolean;
473
- }>;
474
- limit?: number;
475
- fields?: string[];
476
- omit?: string[];
477
- isAdmin?: boolean;
478
- skip?: number;
479
- startingFromId?: number;
480
- dropBlockedThreads?: boolean;
481
- }>;
482
- export type FindAllInHierarchyValidatorSchema = ExtractRightEither<ReturnType<typeof findAllInHierarchyValidator>>;
483
- export declare const findAllPerAuthorValidator: (params: object, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
484
- query?: {
485
- $and?: Record<string, string | number | {
497
+ createdAt?: string | number | {
486
498
  $eq?: string;
487
499
  } | {
488
500
  $eqi?: string;
@@ -516,8 +528,8 @@ export declare const findAllPerAuthorValidator: (params: object, payload: object
516
528
  $notContainsi?: string;
517
529
  } | {
518
530
  $notNull?: boolean;
519
- }>[];
520
- $or?: Record<string, string | number | {
531
+ };
532
+ updatedAt?: string | number | {
521
533
  $eq?: string;
522
534
  } | {
523
535
  $eqi?: string;
@@ -551,19 +563,43 @@ export declare const findAllPerAuthorValidator: (params: object, payload: object
551
563
  $notContainsi?: string;
552
564
  } | {
553
565
  $notNull?: boolean;
554
- }>[];
555
- } | Record<string, string | number | boolean | Record<string, string | number | boolean>>;
556
- type?: string;
557
- sort?: string;
558
- authorId?: string | number;
559
- pagination?: {
560
- page?: number;
561
- pageSize?: number;
562
- withCount?: boolean;
566
+ };
567
+ authorName?: string | number | {
568
+ $eq?: string;
569
+ } | {
570
+ $eqi?: string;
571
+ } | {
572
+ $ne?: string;
573
+ } | {
574
+ $nei?: string;
575
+ } | {
576
+ $gt?: string;
577
+ } | {
578
+ $gte?: string;
579
+ } | {
580
+ $lt?: string;
581
+ } | {
582
+ $lte?: string;
583
+ } | {
584
+ $startsWith?: string;
585
+ } | {
586
+ $startsWithi?: string;
587
+ } | {
588
+ $endsWith?: string;
589
+ } | {
590
+ $endsWithi?: string;
591
+ } | {
592
+ $contains?: string;
593
+ } | {
594
+ $containsi?: string;
595
+ } | {
596
+ $notContains?: string;
597
+ } | {
598
+ $notContainsi?: string;
599
+ } | {
600
+ $notNull?: boolean;
601
+ };
563
602
  };
564
- populate?: Record<string, boolean | {
565
- populate?: boolean;
566
- }>;
567
603
  limit?: number;
568
604
  fields?: string[];
569
605
  omit?: string[];
@@ -571,16 +607,16 @@ export declare const findAllPerAuthorValidator: (params: object, payload: object
571
607
  skip?: number;
572
608
  }>;
573
609
  export type FindAllPerAuthorValidatorSchema = ExtractRightEither<ReturnType<typeof findAllPerAuthorValidator>>;
574
- export declare const reportAbuseValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
610
+ export declare const reportAbuseValidator: (config: CommentsPluginConfig, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
575
611
  content?: string;
576
- reason?: string;
577
- relation?: `{${string}::${string}.${number}}`;
612
+ reason?: import("../../../const").REPORT_REASON;
613
+ relation?: `${string}::${string}.${string}`;
578
614
  commentId?: number;
579
615
  }>;
580
616
  export type ReportAbuseValidatorSchema = ExtractRightEither<ReturnType<typeof reportAbuseValidator>>;
581
617
  export declare const removeCommentValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
582
618
  authorId?: string | number;
583
- relation?: `{${string}::${string}.${number}}`;
619
+ relation?: `${string}::${string}.${string}`;
584
620
  commentId?: number;
585
621
  }>;
586
622
  export type RemoveCommentValidatorSchema = ExtractRightEither<ReturnType<typeof removeCommentValidator>>;
@@ -1,5 +1,3 @@
1
- import { z } from "zod";
2
- import { schemaConfig } from "../../../config";
3
1
  export declare const validateConfig: (config: unknown) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
4
2
  enabledCollections?: string[];
5
3
  approvalFlow?: string[];
@@ -14,5 +12,11 @@ export declare const validateConfig: (config: unknown) => import("../../../utils
14
12
  OTHER?: import("../../../const").REPORT_REASON.OTHER;
15
13
  };
16
14
  isGQLPluginEnabled?: boolean;
15
+ gql?: {
16
+ auth?: boolean;
17
+ };
18
+ client?: {
19
+ url?: string;
20
+ contactEmail?: string;
21
+ };
17
22
  }>;
18
- export type CommentsPluginConfig = z.infer<typeof schemaConfig>;
@@ -17,7 +17,16 @@ export declare const dbBaseCommentSchema: z.ZodObject<{
17
17
  authorName: z.ZodNullable<z.ZodString>;
18
18
  authorEmail: z.ZodNullable<z.ZodString>;
19
19
  authorAvatar: z.ZodNullable<z.ZodString>;
20
- authorUser: z.ZodNullable<z.ZodOptional<z.ZodString>>;
20
+ authorUser: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
21
+ id: z.ZodNumber;
22
+ email: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ id?: number;
25
+ email?: string;
26
+ }, {
27
+ id?: number;
28
+ email?: string;
29
+ }>]>>>;
21
30
  locale: z.ZodNullable<z.ZodString>;
22
31
  }, "strip", z.ZodTypeAny, {
23
32
  id?: number;
@@ -37,7 +46,10 @@ export declare const dbBaseCommentSchema: z.ZodObject<{
37
46
  authorName?: string;
38
47
  authorEmail?: string;
39
48
  authorAvatar?: string;
40
- authorUser?: string;
49
+ authorUser?: string | {
50
+ id?: number;
51
+ email?: string;
52
+ };
41
53
  locale?: string;
42
54
  }, {
43
55
  id?: number;
@@ -57,6 +69,9 @@ export declare const dbBaseCommentSchema: z.ZodObject<{
57
69
  authorName?: string;
58
70
  authorEmail?: string;
59
71
  authorAvatar?: string;
60
- authorUser?: string;
72
+ authorUser?: string | {
73
+ id?: number;
74
+ email?: string;
75
+ };
61
76
  locale?: string;
62
77
  }>;