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.
- package/README.md +81 -122
- package/dist/_chunks/{index-D3iNqWZT.mjs → index-BC5Odn17.mjs} +5 -5
- package/dist/_chunks/{index-BBcsmSTs.mjs → index-BIorFYba.mjs} +448 -256
- package/dist/_chunks/{index-Bcck91A8.js → index-COoWcAcA.js} +1290 -1144
- package/dist/_chunks/{index-CY_AVWS-.js → index-Ccb93U47.js} +445 -253
- package/dist/_chunks/{index-D9MOkoQ2.mjs → index-D1DAMkhj.mjs} +20 -26
- package/dist/_chunks/{index-BFPteXuP.js → index-R1krliyC.js} +5 -5
- package/dist/_chunks/{index-DJ32APz-.mjs → index-_exHAK6u.mjs} +1290 -1144
- package/dist/_chunks/{index-BXEk5PWx.js → index-k7z0V0lj.js} +20 -26
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/api/client.d.ts +30 -50
- package/dist/admin/src/api/schemas.d.ts +432 -756
- package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
- package/dist/admin/src/hooks/useAPI.d.ts +30 -50
- package/dist/admin/src/hooks/useCommentsAll.d.ts +6 -10
- package/dist/admin/src/hooks/useReports.d.ts +6 -10
- package/dist/server/index.js +212 -157
- package/dist/server/index.mjs +212 -157
- package/dist/server/src/{@types-v5 → @types}/utils.d.ts +4 -0
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/config/index.d.ts +30 -0
- package/dist/server/src/content-types/index.d.ts +1 -1
- package/dist/server/src/controllers/admin.controller.d.ts +108 -29
- package/dist/server/src/controllers/client.controller.d.ts +121 -24
- package/dist/server/src/controllers/index.d.ts +300 -88
- package/dist/server/src/controllers/settings.controller.d.ts +33 -1
- package/dist/server/src/graphql/index.d.ts +1 -1
- package/dist/server/src/graphql/mutations/getCreateAbuseReport.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getCreateComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getRemoveComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getUpdateComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/index.d.ts +2 -2
- package/dist/server/src/graphql/queries/findAllFlat.d.ts +18 -6
- package/dist/server/src/graphql/queries/findAllInHierarchy.d.ts +10 -4
- package/dist/server/src/graphql/queries/findAllPerAuthor.d.ts +18 -6
- package/dist/server/src/graphql/queries/index.d.ts +2 -2
- package/dist/server/src/graphql/types/getComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentAuthorType.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentNested.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateCommentAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateReport.d.ts +1 -1
- package/dist/server/src/graphql/types/getId.d.ts +1 -1
- package/dist/server/src/graphql/types/getIdentityAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getRemoveComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getReport.d.ts +1 -1
- package/dist/server/src/graphql/types/getReportReason.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseFindAll.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseFindAllPerAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseMeta.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponsePagination.d.ts +1 -1
- package/dist/server/src/graphql/types/getUpdateComment.d.ts +1 -1
- package/dist/server/src/graphql/types/index.d.ts +1 -1
- package/dist/server/src/index.d.ts +931 -315
- package/dist/server/src/register/custom-fields/index.d.ts +1 -1
- package/dist/server/src/register/index.d.ts +1 -1
- package/dist/server/src/repositories/comment.repository.d.ts +10 -1
- package/dist/server/src/repositories/index.d.ts +0 -2
- package/dist/server/src/repositories/report.comment.repository.d.ts +38 -1
- package/dist/server/src/repositories/store.repository.d.ts +159 -3
- package/dist/server/src/repositories/utils.d.ts +1 -3
- package/dist/server/src/routes/admin.routes.d.ts +1 -1
- package/dist/server/src/routes/client.routes.d.ts +1 -1
- package/dist/server/src/routes/index.d.ts +2 -2
- package/dist/server/src/services/admin/admin.service.d.ts +232 -78
- package/dist/server/src/services/admin/utils.d.ts +1 -1
- package/dist/server/src/services/client.service.d.ts +178 -67
- package/dist/server/src/services/common.service.d.ts +60 -19
- package/dist/server/src/services/gql.service.d.ts +1 -1
- package/dist/server/src/services/index.d.ts +615 -223
- package/dist/server/src/services/settings.service.d.ts +25 -1
- package/dist/server/src/services/utils/functions.d.ts +1 -3
- package/dist/server/src/test/utils.d.ts +1 -0
- package/dist/server/src/utils/constants.d.ts +1 -1
- package/dist/server/src/utils/getConfig.d.ts +2 -2
- package/dist/server/src/utils/getPluginService.d.ts +2 -2
- package/dist/server/src/utils/throwError.d.ts +1 -1
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +16 -9
- package/dist/server/src/validators/api/controllers/settings.controller.validator.d.ts +4 -0
- package/dist/server/src/validators/repositories/comment.schema.d.ts +18 -3
- package/dist/server/src/validators/repositories/comment.validator.d.ts +384 -72
- package/dist/server/src/validators/repositories/reports.validator.d.ts +60 -18
- package/dist/server/src/validators/utils.d.ts +1 -1
- package/package.json +18 -12
- /package/dist/server/src/{@types-v5 → @types}/controllers.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/index.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/repositories.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/routes.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StrapiContext } from '../@types
|
|
1
|
+
import { StrapiContext } from '../@types';
|
|
2
2
|
import { CommentsPluginConfig } from '../config';
|
|
3
3
|
declare const _default: ({ strapi }: StrapiContext) => {
|
|
4
4
|
getConfig: (viaSettingsPage?: boolean) => Promise<{
|
|
@@ -18,6 +18,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
18
18
|
gql?: {
|
|
19
19
|
auth?: boolean;
|
|
20
20
|
};
|
|
21
|
+
client?: {
|
|
22
|
+
url?: string;
|
|
23
|
+
contactEmail?: string;
|
|
24
|
+
};
|
|
21
25
|
} | Omit<{
|
|
22
26
|
enabledCollections?: string[];
|
|
23
27
|
approvalFlow?: string[];
|
|
@@ -35,6 +39,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
35
39
|
gql?: {
|
|
36
40
|
auth?: boolean;
|
|
37
41
|
};
|
|
42
|
+
client?: {
|
|
43
|
+
url?: string;
|
|
44
|
+
contactEmail?: string;
|
|
45
|
+
};
|
|
38
46
|
}, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
|
|
39
47
|
update: (config: CommentsPluginConfig) => Promise<{
|
|
40
48
|
enabledCollections?: string[];
|
|
@@ -53,6 +61,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
53
61
|
gql?: {
|
|
54
62
|
auth?: boolean;
|
|
55
63
|
};
|
|
64
|
+
client?: {
|
|
65
|
+
url?: string;
|
|
66
|
+
contactEmail?: string;
|
|
67
|
+
};
|
|
56
68
|
} | Omit<{
|
|
57
69
|
enabledCollections?: string[];
|
|
58
70
|
approvalFlow?: string[];
|
|
@@ -70,6 +82,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
70
82
|
gql?: {
|
|
71
83
|
auth?: boolean;
|
|
72
84
|
};
|
|
85
|
+
client?: {
|
|
86
|
+
url?: string;
|
|
87
|
+
contactEmail?: string;
|
|
88
|
+
};
|
|
73
89
|
}, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
|
|
74
90
|
restore: () => Promise<{
|
|
75
91
|
enabledCollections?: string[];
|
|
@@ -88,6 +104,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
88
104
|
gql?: {
|
|
89
105
|
auth?: boolean;
|
|
90
106
|
};
|
|
107
|
+
client?: {
|
|
108
|
+
url?: string;
|
|
109
|
+
contactEmail?: string;
|
|
110
|
+
};
|
|
91
111
|
} | Omit<{
|
|
92
112
|
enabledCollections?: string[];
|
|
93
113
|
approvalFlow?: string[];
|
|
@@ -105,6 +125,10 @@ declare const _default: ({ strapi }: StrapiContext) => {
|
|
|
105
125
|
gql?: {
|
|
106
126
|
auth?: boolean;
|
|
107
127
|
};
|
|
128
|
+
client?: {
|
|
129
|
+
url?: string;
|
|
130
|
+
contactEmail?: string;
|
|
131
|
+
};
|
|
108
132
|
}, "enabledCollections" | "moderatorRoles" | "isGQLPluginEnabled">>;
|
|
109
133
|
restart: () => void;
|
|
110
134
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { StrapiUser } from '@sensinum/strapi-utils';
|
|
2
|
-
import { AdminUser, Id } from '../../@types
|
|
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
8
|
export declare const buildAuthorModel: (item: Comment | CommentWithRelated, blockedAuthorProps: Array<string>, fieldsToPopulate?: Array<string>) => Comment;
|
|
10
|
-
export declare const buildConfigQueryProp: (prop?: undefined | string | Array<string>) => string;
|
|
11
9
|
export declare const resolveUserContextError: (user?: AdminUser | StrapiUser) => PluginError;
|
|
12
10
|
type AuthorNameProps = {
|
|
13
11
|
lastname?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const caster: <T>(source: unknown) => T;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StrapiContext } from '../@types
|
|
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" | "gql">(strapi: StrapiContext['strapi'], path: T, defaultValue: CommentsPluginConfig
|
|
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
|
|
1
|
+
import { CoreStrapi } from '../@types';
|
|
2
2
|
import { PluginServices } from '../services';
|
|
3
|
-
export declare const getPluginService: <T extends "gql" | "
|
|
3
|
+
export declare const getPluginService: <T extends "gql" | "client" | "admin" | "common" | "settings">(strapi: CoreStrapi, serviceName: T) => PluginServices[T];
|
|
@@ -1,3 +1,4 @@
|
|
|
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<{
|
|
@@ -10,13 +11,19 @@ export declare const newCommentValidator: (enabledCollections: string[], relatio
|
|
|
10
11
|
email?: string;
|
|
11
12
|
avatar?: string;
|
|
12
13
|
};
|
|
13
|
-
threadOf?:
|
|
14
|
-
relation?:
|
|
14
|
+
threadOf?: string;
|
|
15
|
+
relation?: `${string}::${string}.${string}`;
|
|
15
16
|
}>;
|
|
16
17
|
export type NewCommentValidatorSchema = ExtractRightEither<ReturnType<typeof newCommentValidator>>;
|
|
17
18
|
export declare const updateCommentValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
|
|
18
19
|
content?: string;
|
|
19
|
-
|
|
20
|
+
author?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
id?: number;
|
|
23
|
+
email?: string;
|
|
24
|
+
avatar?: string;
|
|
25
|
+
};
|
|
26
|
+
relation?: `${string}::${string}.${string}`;
|
|
20
27
|
commentId?: number;
|
|
21
28
|
}>;
|
|
22
29
|
export type UpdateCommentValidatorSchema = ExtractRightEither<ReturnType<typeof updateCommentValidator>>;
|
|
@@ -28,7 +35,7 @@ export declare const findAllFlatValidator: (enabledCollections: string[], relati
|
|
|
28
35
|
pageSize?: number;
|
|
29
36
|
withCount?: boolean;
|
|
30
37
|
};
|
|
31
|
-
relation?:
|
|
38
|
+
relation?: `${string}::${string}.${string}`;
|
|
32
39
|
populate?: Record<string, boolean | {
|
|
33
40
|
populate?: boolean;
|
|
34
41
|
}>;
|
|
@@ -219,7 +226,7 @@ export type FindAllFlatSchema = ExtractRightEither<ReturnType<typeof findAllFlat
|
|
|
219
226
|
export declare const findAllInHierarchyValidator: (enabledCollections: string[], relation: string, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
|
|
220
227
|
sort?: string;
|
|
221
228
|
locale?: string;
|
|
222
|
-
relation?:
|
|
229
|
+
relation?: `${string}::${string}.${string}`;
|
|
223
230
|
populate?: Record<string, boolean | {
|
|
224
231
|
populate?: boolean;
|
|
225
232
|
}>;
|
|
@@ -606,16 +613,16 @@ export declare const findAllPerAuthorValidator: (params: object, payload: object
|
|
|
606
613
|
skip?: number;
|
|
607
614
|
}>;
|
|
608
615
|
export type FindAllPerAuthorValidatorSchema = ExtractRightEither<ReturnType<typeof findAllPerAuthorValidator>>;
|
|
609
|
-
export declare const reportAbuseValidator: (
|
|
616
|
+
export declare const reportAbuseValidator: (config: CommentsPluginConfig, payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
|
|
610
617
|
content?: string;
|
|
611
|
-
reason?:
|
|
612
|
-
relation?:
|
|
618
|
+
reason?: import("../../../const").REPORT_REASON;
|
|
619
|
+
relation?: `${string}::${string}.${string}`;
|
|
613
620
|
commentId?: number;
|
|
614
621
|
}>;
|
|
615
622
|
export type ReportAbuseValidatorSchema = ExtractRightEither<ReturnType<typeof reportAbuseValidator>>;
|
|
616
623
|
export declare const removeCommentValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
|
|
617
624
|
authorId?: string | number;
|
|
618
|
-
relation?:
|
|
625
|
+
relation?: `${string}::${string}.${string}`;
|
|
619
626
|
commentId?: number;
|
|
620
627
|
}>;
|
|
621
628
|
export type RemoveCommentValidatorSchema = ExtractRightEither<ReturnType<typeof removeCommentValidator>>;
|
|
@@ -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
|
}>;
|