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,2 +1,2 @@
1
- import { StrapiContext } from '../../@types-v5';
1
+ import { StrapiContext } from '../../@types';
2
2
  export declare const registerCustomFields: ({ strapi }: StrapiContext) => void;
@@ -1,3 +1,3 @@
1
- import { StrapiContext } from '../@types-v5';
1
+ import { StrapiContext } from '../@types';
2
2
  declare const register: (context: StrapiContext) => void;
3
3
  export default register;
@@ -1,6 +1,15 @@
1
1
  import { FindOneParams, Params } from '@strapi/database/dist/entity-manager/types';
2
- import { CoreStrapi } from '../@types-v5';
2
+ import { CoreStrapi } from '../@types';
3
3
  import { CommentResultValidator } from '../validators/repositories';
4
+ export declare const getCommentRepositorySource: (strapi: CoreStrapi) => {
5
+ findMany(params: Params): Promise<CommentResultValidator['findMany']>;
6
+ findWithCount(params: Params): Promise<CommentResultValidator['findWithCount']>;
7
+ findOne(params: FindOneParams): Promise<CommentResultValidator['findOne'] | null>;
8
+ update(params: Params): Promise<CommentResultValidator['findOne']>;
9
+ delete(params: Params): Promise<CommentResultValidator['findOne'] | null>;
10
+ updateMany(params: Params): Promise<import("@strapi/database/dist/types").CountResult>;
11
+ create(params: Pick<Params, 'data' | 'populate'>): Promise<CommentResultValidator['create']>;
12
+ };
4
13
  export declare const getCommentRepository: (strapi: CoreStrapi) => {
5
14
  findMany(params: Params): Promise<CommentResultValidator['findMany']>;
6
15
  findWithCount(params: Params): Promise<CommentResultValidator['findWithCount']>;
@@ -1,5 +1,3 @@
1
1
  export * from './report.comment.repository';
2
2
  export * from './comment.repository';
3
3
  export * from './store.repository';
4
- export { getDefaultAuthorPopulate } from './utils';
5
- export { getOrderBy } from './utils';
@@ -1,6 +1,43 @@
1
1
  import { Params } from '@strapi/database/dist/entity-manager/types';
2
- import { CoreStrapi } from '../@types-v5';
2
+ import { CoreStrapi } from '../@types';
3
3
  import { ReportResultValidator } from '../validators/repositories';
4
+ export declare const getReportCommentRepositorySource: (strapi: CoreStrapi) => {
5
+ findPage(params: Params): Promise<ReportResultValidator['findPage']>;
6
+ findMany(params: Params): Promise<ReportResultValidator['findMany']>;
7
+ update(params: Params): Promise<ReportResultValidator['update']>;
8
+ updateMany(params: Params): Promise<import("@strapi/database/dist/types").CountResult>;
9
+ create(params: Params): Promise<{
10
+ id?: number;
11
+ documentId?: string;
12
+ content?: string;
13
+ related?: {
14
+ id?: number;
15
+ documentId?: string;
16
+ content?: string;
17
+ blocked?: boolean;
18
+ blockedThread?: boolean;
19
+ blockReason?: string;
20
+ isAdminComment?: boolean;
21
+ removed?: boolean;
22
+ approvalStatus?: string;
23
+ related?: string;
24
+ createdAt?: string;
25
+ updatedAt?: string;
26
+ publishedAt?: string;
27
+ authorId?: string;
28
+ authorName?: string;
29
+ authorEmail?: string;
30
+ authorAvatar?: string;
31
+ locale?: string;
32
+ };
33
+ createdAt?: string;
34
+ updatedAt?: string;
35
+ publishedAt?: string;
36
+ locale?: string;
37
+ reason?: string;
38
+ resolved?: boolean;
39
+ }>;
40
+ };
4
41
  export declare const getReportCommentRepository: (strapi: CoreStrapi) => {
5
42
  findPage(params: Params): Promise<ReportResultValidator['findPage']>;
6
43
  findMany(params: Params): Promise<ReportResultValidator['findMany']>;
@@ -1,9 +1,145 @@
1
- import { CoreStrapi } from '../@types-v5';
1
+ import { CoreStrapi, PathValue } from '../@types';
2
+ import { CommentsPluginConfig } from '../config';
2
3
  import { REPORT_REASON } from '../const';
3
4
  import { Either } from '../utils/Either';
4
- import { CommentsPluginConfig } from '../validators/api/controllers/settings.controller.validator';
5
+ export declare const getStoreRepositorySource: (strapi: CoreStrapi) => {
6
+ getLocalConfig<P extends string>(prop?: P, defaultValue?: PathValue<CommentsPluginConfig, P>): PathValue<{
7
+ enabledCollections?: string[];
8
+ approvalFlow?: string[];
9
+ entryLabel?: Record<string, string[]>;
10
+ moderatorRoles?: string[];
11
+ badWords?: boolean;
12
+ blockedAuthorProps?: string[];
13
+ isValidationEnabled?: boolean;
14
+ reportReasons?: {
15
+ BAD_LANGUAGE?: REPORT_REASON.BAD_LANGUAGE;
16
+ DISCRIMINATION?: REPORT_REASON.DISCRIMINATION;
17
+ OTHER?: REPORT_REASON.OTHER;
18
+ };
19
+ isGQLPluginEnabled?: boolean;
20
+ gql?: {
21
+ auth?: boolean;
22
+ };
23
+ client?: {
24
+ url?: string;
25
+ contactEmail?: string;
26
+ };
27
+ }, P>;
28
+ getStore(): Promise<{
29
+ get(params?: Partial<{
30
+ key: string;
31
+ type?: string;
32
+ environment?: string;
33
+ name?: string;
34
+ tag?: string;
35
+ }>): Promise<unknown>;
36
+ set(params?: Partial<{
37
+ key: string;
38
+ value: unknown;
39
+ type?: string;
40
+ environment?: string;
41
+ name?: string;
42
+ tag?: string;
43
+ }>): Promise<void>;
44
+ delete(params?: Partial<{
45
+ key: string;
46
+ type?: string;
47
+ environment?: string;
48
+ name?: string;
49
+ tag?: string;
50
+ }>): Promise<void>;
51
+ }>;
52
+ getConfig(): Promise<Required<CommentsPluginConfig>>;
53
+ get<T extends boolean>(viaSettingsPage?: T): Promise<Either<unknown, T extends true ? CommentsPluginConfig : Omit<CommentsPluginConfig, 'enabledCollections' | 'moderatorRoles' | 'isGQLPluginEnabled'>>>;
54
+ update(config: CommentsPluginConfig): Promise<Either<unknown, {
55
+ enabledCollections?: string[];
56
+ approvalFlow?: string[];
57
+ entryLabel?: Record<string, string[]>;
58
+ moderatorRoles?: string[];
59
+ badWords?: boolean;
60
+ blockedAuthorProps?: string[];
61
+ isValidationEnabled?: boolean;
62
+ reportReasons?: {
63
+ BAD_LANGUAGE?: REPORT_REASON.BAD_LANGUAGE;
64
+ DISCRIMINATION?: REPORT_REASON.DISCRIMINATION;
65
+ OTHER?: REPORT_REASON.OTHER;
66
+ };
67
+ isGQLPluginEnabled?: boolean;
68
+ gql?: {
69
+ auth?: boolean;
70
+ };
71
+ client?: {
72
+ url?: string;
73
+ contactEmail?: string;
74
+ };
75
+ } | Omit<{
76
+ enabledCollections?: string[];
77
+ approvalFlow?: string[];
78
+ entryLabel?: Record<string, string[]>;
79
+ moderatorRoles?: string[];
80
+ badWords?: boolean;
81
+ blockedAuthorProps?: string[];
82
+ isValidationEnabled?: boolean;
83
+ reportReasons?: {
84
+ BAD_LANGUAGE?: REPORT_REASON.BAD_LANGUAGE;
85
+ DISCRIMINATION?: REPORT_REASON.DISCRIMINATION;
86
+ OTHER?: REPORT_REASON.OTHER;
87
+ };
88
+ isGQLPluginEnabled?: boolean;
89
+ gql?: {
90
+ auth?: boolean;
91
+ };
92
+ client?: {
93
+ url?: string;
94
+ contactEmail?: string;
95
+ };
96
+ }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
97
+ restore(): Promise<Either<unknown, {
98
+ enabledCollections?: string[];
99
+ approvalFlow?: string[];
100
+ entryLabel?: Record<string, string[]>;
101
+ moderatorRoles?: string[];
102
+ badWords?: boolean;
103
+ blockedAuthorProps?: string[];
104
+ isValidationEnabled?: boolean;
105
+ reportReasons?: {
106
+ BAD_LANGUAGE?: REPORT_REASON.BAD_LANGUAGE;
107
+ DISCRIMINATION?: REPORT_REASON.DISCRIMINATION;
108
+ OTHER?: REPORT_REASON.OTHER;
109
+ };
110
+ isGQLPluginEnabled?: boolean;
111
+ gql?: {
112
+ auth?: boolean;
113
+ };
114
+ client?: {
115
+ url?: string;
116
+ contactEmail?: string;
117
+ };
118
+ } | Omit<{
119
+ enabledCollections?: string[];
120
+ approvalFlow?: string[];
121
+ entryLabel?: Record<string, string[]>;
122
+ moderatorRoles?: string[];
123
+ badWords?: boolean;
124
+ blockedAuthorProps?: string[];
125
+ isValidationEnabled?: boolean;
126
+ reportReasons?: {
127
+ BAD_LANGUAGE?: REPORT_REASON.BAD_LANGUAGE;
128
+ DISCRIMINATION?: REPORT_REASON.DISCRIMINATION;
129
+ OTHER?: REPORT_REASON.OTHER;
130
+ };
131
+ isGQLPluginEnabled?: boolean;
132
+ gql?: {
133
+ auth?: boolean;
134
+ };
135
+ client?: {
136
+ url?: string;
137
+ contactEmail?: string;
138
+ };
139
+ }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
140
+ };
5
141
  export declare const getStoreRepository: (strapi: CoreStrapi) => {
6
- getLocalConfig<P extends "enabledCollections" | "approvalFlow" | "entryLabel" | "moderatorRoles" | "badWords" | "blockedAuthorProps" | "isValidationEnabled" | "reportReasons" | "isGQLPluginEnabled">(prop?: P, defaultValue?: CommentsPluginConfig[P]): {
142
+ getLocalConfig<P extends string>(prop?: P, defaultValue?: PathValue<CommentsPluginConfig, P>): PathValue<{
7
143
  enabledCollections?: string[];
8
144
  approvalFlow?: string[];
9
145
  entryLabel?: Record<string, string[]>;
@@ -17,7 +153,14 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
17
153
  OTHER?: REPORT_REASON.OTHER;
18
154
  };
19
155
  isGQLPluginEnabled?: boolean;
20
- }[P];
156
+ gql?: {
157
+ auth?: boolean;
158
+ };
159
+ client?: {
160
+ url?: string;
161
+ contactEmail?: string;
162
+ };
163
+ }, P>;
21
164
  getStore(): Promise<{
22
165
  get(params?: Partial<{
23
166
  key: string;
@@ -58,6 +201,13 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
58
201
  OTHER?: REPORT_REASON.OTHER;
59
202
  };
60
203
  isGQLPluginEnabled?: boolean;
204
+ gql?: {
205
+ auth?: boolean;
206
+ };
207
+ client?: {
208
+ url?: string;
209
+ contactEmail?: string;
210
+ };
61
211
  } | Omit<{
62
212
  enabledCollections?: string[];
63
213
  approvalFlow?: string[];
@@ -72,6 +222,13 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
72
222
  OTHER?: REPORT_REASON.OTHER;
73
223
  };
74
224
  isGQLPluginEnabled?: boolean;
225
+ gql?: {
226
+ auth?: boolean;
227
+ };
228
+ client?: {
229
+ url?: string;
230
+ contactEmail?: string;
231
+ };
75
232
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
76
233
  restore(): Promise<Either<unknown, {
77
234
  enabledCollections?: string[];
@@ -87,6 +244,13 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
87
244
  OTHER?: REPORT_REASON.OTHER;
88
245
  };
89
246
  isGQLPluginEnabled?: boolean;
247
+ gql?: {
248
+ auth?: boolean;
249
+ };
250
+ client?: {
251
+ url?: string;
252
+ contactEmail?: string;
253
+ };
90
254
  } | Omit<{
91
255
  enabledCollections?: string[];
92
256
  approvalFlow?: string[];
@@ -101,6 +265,13 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
101
265
  OTHER?: REPORT_REASON.OTHER;
102
266
  };
103
267
  isGQLPluginEnabled?: boolean;
268
+ gql?: {
269
+ auth?: boolean;
270
+ };
271
+ client?: {
272
+ url?: string;
273
+ contactEmail?: string;
274
+ };
104
275
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
105
276
  };
106
277
  export type StoreRepository = ReturnType<typeof getStoreRepository>;
@@ -1,5 +1,4 @@
1
- import { z } from 'zod';
2
- import { CoreStrapi } from '../@types-v5';
1
+ import { CoreStrapi } from '../@types';
3
2
  import { ContentTypesUUIDs, KeysContentTypes } from '../content-types';
4
3
  export declare const getModelUid: (strapi: CoreStrapi, name: KeysContentTypes) => ContentTypesUUIDs;
5
4
  export declare const getDefaultAuthorPopulate: (strapi: CoreStrapi) => true | {
@@ -8,4 +7,3 @@ export declare const getDefaultAuthorPopulate: (strapi: CoreStrapi) => true | {
8
7
  };
9
8
  };
10
9
  export declare function getOrderBy(orderBy?: string | null): string[];
11
- export declare const shouldValidate: <T extends z.ZodRawShape>(isEnabled: boolean, validator: z.ZodAny) => (data: unknown, params?: Partial<z.ParseParams>) => any;
@@ -1,3 +1,3 @@
1
- import { StrapiRoute } from '../@types-v5';
1
+ import { StrapiRoute } from '../@types';
2
2
  declare const _default: (StrapiRoute<"admin"> | StrapiRoute<"settings">)[];
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import { StrapiRoute } from '../@types-v5';
1
+ import { StrapiRoute } from '../@types';
2
2
  declare const routes: StrapiRoute<'client'>[];
3
3
  export default routes;
@@ -1,11 +1,11 @@
1
1
  declare const routes: {
2
2
  'content-api': {
3
3
  type: string;
4
- routes: import("../@types-v5").StrapiRoute<"client">[];
4
+ routes: import("../@types").StrapiRoute<"client">[];
5
5
  };
6
6
  admin: {
7
7
  type: string;
8
- routes: (import("../@types-v5").StrapiRoute<"admin"> | import("../@types-v5").StrapiRoute<"settings">)[];
8
+ routes: (import("../@types").StrapiRoute<"admin"> | import("../@types").StrapiRoute<"settings">)[];
9
9
  };
10
10
  };
11
11
  export default routes;