strapi-plugin-comments 3.0.0-beta.1 → 3.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.
Files changed (90) hide show
  1. package/README.md +81 -122
  2. package/dist/_chunks/{index-D3iNqWZT.mjs → index-BC5Odn17.mjs} +5 -5
  3. package/dist/_chunks/{index-BBcsmSTs.mjs → index-BIorFYba.mjs} +448 -256
  4. package/dist/_chunks/{index-Bcck91A8.js → index-COoWcAcA.js} +1290 -1144
  5. package/dist/_chunks/{index-CY_AVWS-.js → index-Ccb93U47.js} +445 -253
  6. package/dist/_chunks/{index-D9MOkoQ2.mjs → index-D1DAMkhj.mjs} +20 -26
  7. package/dist/_chunks/{index-BFPteXuP.js → index-R1krliyC.js} +5 -5
  8. package/dist/_chunks/{index-DJ32APz-.mjs → index-_exHAK6u.mjs} +1290 -1144
  9. package/dist/_chunks/{index-BXEk5PWx.js → index-k7z0V0lj.js} +20 -26
  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 +30 -50
  13. package/dist/admin/src/api/schemas.d.ts +432 -756
  14. package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
  15. package/dist/admin/src/hooks/useAPI.d.ts +30 -50
  16. package/dist/admin/src/hooks/useCommentsAll.d.ts +6 -10
  17. package/dist/admin/src/hooks/useReports.d.ts +6 -10
  18. package/dist/server/index.js +212 -157
  19. package/dist/server/index.mjs +212 -157
  20. package/dist/server/src/{@types-v5 → @types}/utils.d.ts +4 -0
  21. package/dist/server/src/bootstrap.d.ts +1 -1
  22. package/dist/server/src/config/index.d.ts +30 -0
  23. package/dist/server/src/content-types/index.d.ts +1 -1
  24. package/dist/server/src/controllers/admin.controller.d.ts +108 -29
  25. package/dist/server/src/controllers/client.controller.d.ts +121 -24
  26. package/dist/server/src/controllers/index.d.ts +300 -88
  27. package/dist/server/src/controllers/settings.controller.d.ts +33 -1
  28. package/dist/server/src/graphql/index.d.ts +1 -1
  29. package/dist/server/src/graphql/mutations/getCreateAbuseReport.d.ts +10 -4
  30. package/dist/server/src/graphql/mutations/getCreateComment.d.ts +10 -4
  31. package/dist/server/src/graphql/mutations/getRemoveComment.d.ts +10 -4
  32. package/dist/server/src/graphql/mutations/getUpdateComment.d.ts +10 -4
  33. package/dist/server/src/graphql/mutations/index.d.ts +2 -2
  34. package/dist/server/src/graphql/queries/findAllFlat.d.ts +18 -6
  35. package/dist/server/src/graphql/queries/findAllInHierarchy.d.ts +10 -4
  36. package/dist/server/src/graphql/queries/findAllPerAuthor.d.ts +18 -6
  37. package/dist/server/src/graphql/queries/index.d.ts +2 -2
  38. package/dist/server/src/graphql/types/getComment.d.ts +1 -1
  39. package/dist/server/src/graphql/types/getCommentAuthor.d.ts +1 -1
  40. package/dist/server/src/graphql/types/getCommentAuthorType.d.ts +1 -1
  41. package/dist/server/src/graphql/types/getCommentNested.d.ts +1 -1
  42. package/dist/server/src/graphql/types/getCreateComment.d.ts +1 -1
  43. package/dist/server/src/graphql/types/getCreateCommentAuthor.d.ts +1 -1
  44. package/dist/server/src/graphql/types/getCreateReport.d.ts +1 -1
  45. package/dist/server/src/graphql/types/getId.d.ts +1 -1
  46. package/dist/server/src/graphql/types/getIdentityAuthor.d.ts +1 -1
  47. package/dist/server/src/graphql/types/getRemoveComment.d.ts +1 -1
  48. package/dist/server/src/graphql/types/getReport.d.ts +1 -1
  49. package/dist/server/src/graphql/types/getReportReason.d.ts +1 -1
  50. package/dist/server/src/graphql/types/getResponseFindAll.d.ts +1 -1
  51. package/dist/server/src/graphql/types/getResponseFindAllPerAuthor.d.ts +1 -1
  52. package/dist/server/src/graphql/types/getResponseMeta.d.ts +1 -1
  53. package/dist/server/src/graphql/types/getResponsePagination.d.ts +1 -1
  54. package/dist/server/src/graphql/types/getUpdateComment.d.ts +1 -1
  55. package/dist/server/src/graphql/types/index.d.ts +1 -1
  56. package/dist/server/src/index.d.ts +931 -315
  57. package/dist/server/src/register/custom-fields/index.d.ts +1 -1
  58. package/dist/server/src/register/index.d.ts +1 -1
  59. package/dist/server/src/repositories/comment.repository.d.ts +10 -1
  60. package/dist/server/src/repositories/index.d.ts +0 -2
  61. package/dist/server/src/repositories/report.comment.repository.d.ts +38 -1
  62. package/dist/server/src/repositories/store.repository.d.ts +159 -3
  63. package/dist/server/src/repositories/utils.d.ts +1 -3
  64. package/dist/server/src/routes/admin.routes.d.ts +1 -1
  65. package/dist/server/src/routes/client.routes.d.ts +1 -1
  66. package/dist/server/src/routes/index.d.ts +2 -2
  67. package/dist/server/src/services/admin/admin.service.d.ts +232 -78
  68. package/dist/server/src/services/admin/utils.d.ts +1 -1
  69. package/dist/server/src/services/client.service.d.ts +178 -67
  70. package/dist/server/src/services/common.service.d.ts +60 -19
  71. package/dist/server/src/services/gql.service.d.ts +1 -1
  72. package/dist/server/src/services/index.d.ts +615 -223
  73. package/dist/server/src/services/settings.service.d.ts +25 -1
  74. package/dist/server/src/services/utils/functions.d.ts +1 -3
  75. package/dist/server/src/test/utils.d.ts +1 -0
  76. package/dist/server/src/utils/constants.d.ts +1 -1
  77. package/dist/server/src/utils/getConfig.d.ts +2 -2
  78. package/dist/server/src/utils/getPluginService.d.ts +2 -2
  79. package/dist/server/src/utils/throwError.d.ts +1 -1
  80. package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +16 -9
  81. package/dist/server/src/validators/api/controllers/settings.controller.validator.d.ts +4 -0
  82. package/dist/server/src/validators/repositories/comment.schema.d.ts +18 -3
  83. package/dist/server/src/validators/repositories/comment.validator.d.ts +384 -72
  84. package/dist/server/src/validators/repositories/reports.validator.d.ts +60 -18
  85. package/dist/server/src/validators/utils.d.ts +1 -1
  86. package/package.json +18 -12
  87. /package/dist/server/src/{@types-v5 → @types}/controllers.d.ts +0 -0
  88. /package/dist/server/src/{@types-v5 → @types}/index.d.ts +0 -0
  89. /package/dist/server/src/{@types-v5 → @types}/repositories.d.ts +0 -0
  90. /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
2
  import { CommentsPluginConfig } from '../config';
3
3
  import { REPORT_REASON } from '../const';
4
4
  import { Either } from '../utils/Either';
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" | "gql">(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[]>;
@@ -20,7 +156,11 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
20
156
  gql?: {
21
157
  auth?: boolean;
22
158
  };
23
- }[P];
159
+ client?: {
160
+ url?: string;
161
+ contactEmail?: string;
162
+ };
163
+ }, P>;
24
164
  getStore(): Promise<{
25
165
  get(params?: Partial<{
26
166
  key: string;
@@ -64,6 +204,10 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
64
204
  gql?: {
65
205
  auth?: boolean;
66
206
  };
207
+ client?: {
208
+ url?: string;
209
+ contactEmail?: string;
210
+ };
67
211
  } | Omit<{
68
212
  enabledCollections?: string[];
69
213
  approvalFlow?: string[];
@@ -81,6 +225,10 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
81
225
  gql?: {
82
226
  auth?: boolean;
83
227
  };
228
+ client?: {
229
+ url?: string;
230
+ contactEmail?: string;
231
+ };
84
232
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
85
233
  restore(): Promise<Either<unknown, {
86
234
  enabledCollections?: string[];
@@ -99,6 +247,10 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
99
247
  gql?: {
100
248
  auth?: boolean;
101
249
  };
250
+ client?: {
251
+ url?: string;
252
+ contactEmail?: string;
253
+ };
102
254
  } | Omit<{
103
255
  enabledCollections?: string[];
104
256
  approvalFlow?: string[];
@@ -116,6 +268,10 @@ export declare const getStoreRepository: (strapi: CoreStrapi) => {
116
268
  gql?: {
117
269
  auth?: boolean;
118
270
  };
271
+ client?: {
272
+ url?: string;
273
+ contactEmail?: string;
274
+ };
119
275
  }, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>>;
120
276
  };
121
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;