strapi-plugin-comments 2.0.10 → 2.0.11

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 (261) hide show
  1. package/README.md +39 -5
  2. package/admin/src/translations/fr.json +132 -1
  3. package/build/README.md +818 -0
  4. package/build/admin/src/components/ActionButton/styles.d.ts +2 -0
  5. package/build/admin/src/components/ActionButton/styles.js +17 -0
  6. package/build/admin/src/components/ConfirmationDialog/index.d.ts +26 -0
  7. package/build/admin/src/components/ConfirmationDialog/index.js +104 -0
  8. package/build/admin/src/components/DiscussionStatus/index.d.ts +9 -0
  9. package/build/admin/src/components/DiscussionStatus/index.js +38 -0
  10. package/build/admin/src/components/DiscussionThread/index.d.ts +16 -0
  11. package/build/admin/src/components/DiscussionThread/index.js +99 -0
  12. package/build/admin/src/components/DiscussionThreadItem/index.d.ts +9 -0
  13. package/build/admin/src/components/DiscussionThreadItem/index.js +72 -0
  14. package/build/admin/src/components/DiscussionThreadItem/styles.d.ts +4 -0
  15. package/build/admin/src/components/DiscussionThreadItem/styles.js +27 -0
  16. package/build/admin/src/components/DiscussionThreadItemActions/index.d.ts +19 -0
  17. package/build/admin/src/components/DiscussionThreadItemActions/index.js +414 -0
  18. package/build/admin/src/components/DiscussionThreadItemActions/styles.d.ts +2 -0
  19. package/build/admin/src/components/DiscussionThreadItemActions/styles.js +17 -0
  20. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +17 -0
  21. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +103 -0
  22. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +2 -0
  23. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +15 -0
  24. package/build/admin/src/components/DiscussionThreadItemFooter/index.d.ts +16 -0
  25. package/build/admin/src/components/DiscussionThreadItemFooter/index.js +73 -0
  26. package/build/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +3 -0
  27. package/build/admin/src/components/DiscussionThreadItemFooter/styles.js +25 -0
  28. package/build/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +30 -0
  29. package/build/admin/src/components/DiscussionThreadItemReviewAction/index.js +233 -0
  30. package/build/admin/src/components/FormSwitch/index.d.ts +11 -0
  31. package/build/admin/src/components/FormSwitch/index.js +39 -0
  32. package/build/admin/src/components/FormSwitch/styles.d.ts +2 -0
  33. package/build/admin/src/components/FormSwitch/styles.js +16 -0
  34. package/build/admin/src/components/IconButton/styles.d.ts +2 -0
  35. package/build/admin/src/components/IconButton/styles.js +27 -0
  36. package/build/admin/src/components/Initializer/index.d.ts +3 -0
  37. package/build/admin/src/components/Initializer/index.js +14 -0
  38. package/build/admin/src/components/LoadingIndicatorOverlay/index.d.ts +3 -0
  39. package/build/admin/src/components/LoadingIndicatorOverlay/index.js +18 -0
  40. package/build/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +3 -0
  41. package/build/admin/src/components/LoadingIndicatorOverlay/styles.js +32 -0
  42. package/build/admin/src/components/Nav/index.d.ts +7 -0
  43. package/build/admin/src/components/Nav/index.js +72 -0
  44. package/build/admin/src/components/PluginIcon/index.d.ts +3 -0
  45. package/build/admin/src/components/PluginIcon/index.js +13 -0
  46. package/build/admin/src/components/ReportsReviewModal/index.d.ts +21 -0
  47. package/build/admin/src/components/ReportsReviewModal/index.js +72 -0
  48. package/build/admin/src/components/ReportsReviewTable/index.d.ts +21 -0
  49. package/build/admin/src/components/ReportsReviewTable/index.js +321 -0
  50. package/build/admin/src/components/StatusBadge/index.d.ts +11 -0
  51. package/build/admin/src/components/StatusBadge/index.js +22 -0
  52. package/build/admin/src/components/StatusBadge/styles.d.ts +2 -0
  53. package/build/admin/src/components/StatusBadge/styles.js +25 -0
  54. package/build/admin/src/components/TableFilters/index.d.ts +10 -0
  55. package/build/admin/src/components/TableFilters/index.js +109 -0
  56. package/build/admin/src/components/TablePagination/index.d.ts +15 -0
  57. package/build/admin/src/components/TablePagination/index.js +45 -0
  58. package/build/admin/src/components/icons/comments.d.ts +9 -0
  59. package/build/admin/src/components/icons/comments.js +23 -0
  60. package/build/admin/src/components/icons/index.d.ts +6 -0
  61. package/build/admin/src/components/icons/index.js +21 -0
  62. package/build/admin/src/components/icons/lock.d.ts +11 -0
  63. package/build/admin/src/components/icons/lock.js +29 -0
  64. package/build/admin/src/components/icons/review.d.ts +11 -0
  65. package/build/admin/src/components/icons/review.js +31 -0
  66. package/build/admin/src/components/icons/unlock.d.ts +11 -0
  67. package/build/admin/src/components/icons/unlock.js +29 -0
  68. package/build/admin/src/hooks/useConfig.d.ts +8 -0
  69. package/build/admin/src/hooks/useConfig.js +52 -0
  70. package/build/admin/src/index.d.ts +7 -0
  71. package/build/admin/src/index.js +137 -0
  72. package/build/admin/src/pages/App/index.d.ts +4 -0
  73. package/build/admin/src/pages/App/index.js +90 -0
  74. package/build/admin/src/pages/App/reducer/actions.d.ts +8 -0
  75. package/build/admin/src/pages/App/reducer/actions.js +12 -0
  76. package/build/admin/src/pages/App/reducer/constants.d.ts +4 -0
  77. package/build/admin/src/pages/App/reducer/constants.js +7 -0
  78. package/build/admin/src/pages/App/reducer/index.d.ts +14 -0
  79. package/build/admin/src/pages/App/reducer/index.js +31 -0
  80. package/build/admin/src/pages/App/reducer/init.d.ts +3 -0
  81. package/build/admin/src/pages/App/reducer/init.js +9 -0
  82. package/build/admin/src/pages/App/reducer/selectors.d.ts +6 -0
  83. package/build/admin/src/pages/App/reducer/selectors.js +20 -0
  84. package/build/admin/src/pages/App/utils/api.d.ts +2 -0
  85. package/build/admin/src/pages/App/utils/api.js +16 -0
  86. package/build/admin/src/pages/ComingSoonPage/index.d.ts +3 -0
  87. package/build/admin/src/pages/ComingSoonPage/index.js +78 -0
  88. package/build/admin/src/pages/Details/components/DetailsEntity/index.d.ts +18 -0
  89. package/build/admin/src/pages/Details/components/DetailsEntity/index.js +132 -0
  90. package/build/admin/src/pages/Details/components/DetailsFilters/index.d.ts +12 -0
  91. package/build/admin/src/pages/Details/components/DetailsFilters/index.js +48 -0
  92. package/build/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +2 -0
  93. package/build/admin/src/pages/Details/components/DetailsFilters/styles.js +16 -0
  94. package/build/admin/src/pages/Details/index.d.ts +4 -0
  95. package/build/admin/src/pages/Details/index.js +216 -0
  96. package/build/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +20 -0
  97. package/build/admin/src/pages/Discover/components/DiscoverTableRow/index.js +344 -0
  98. package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +2 -0
  99. package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +16 -0
  100. package/build/admin/src/pages/Discover/index.d.ts +4 -0
  101. package/build/admin/src/pages/Discover/index.js +332 -0
  102. package/build/admin/src/pages/Discover/utils/api.d.ts +2 -0
  103. package/build/admin/src/pages/Discover/utils/api.js +23 -0
  104. package/build/admin/src/pages/Discover/utils/filtersSchema.d.ts +11 -0
  105. package/build/admin/src/pages/Discover/utils/filtersSchema.js +11 -0
  106. package/build/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +2 -0
  107. package/build/admin/src/pages/Settings/components/RestartAlert/styles.js +16 -0
  108. package/build/admin/src/pages/Settings/index.d.ts +3 -0
  109. package/build/admin/src/pages/Settings/index.js +712 -0
  110. package/build/admin/src/pages/Settings/utils/api.d.ts +7 -0
  111. package/build/admin/src/pages/Settings/utils/api.js +80 -0
  112. package/build/admin/src/pages/utils/api.d.ts +12 -0
  113. package/build/admin/src/pages/utils/api.js +83 -0
  114. package/build/admin/src/permissions.d.ts +28 -0
  115. package/build/admin/src/permissions.js +65 -0
  116. package/build/admin/src/pluginId.d.ts +2 -0
  117. package/build/admin/src/pluginId.js +50 -0
  118. package/build/admin/src/reducers.d.ts +12 -0
  119. package/build/admin/src/reducers.js +14 -0
  120. package/build/admin/src/translations/en.json +132 -0
  121. package/build/admin/src/translations/fr.json +1 -0
  122. package/build/admin/src/translations/pt-BR.json +132 -0
  123. package/build/admin/src/utils/axiosInstance.d.ts +3 -0
  124. package/build/admin/src/utils/axiosInstance.js +37 -0
  125. package/build/admin/src/utils/constants.d.ts +25 -0
  126. package/build/admin/src/utils/constants.js +30 -0
  127. package/build/admin/src/utils/getApiUrl.d.ts +3 -0
  128. package/build/admin/src/utils/getApiUrl.js +6 -0
  129. package/build/admin/src/utils/getMessage.d.ts +4 -0
  130. package/build/admin/src/utils/getMessage.js +25 -0
  131. package/build/admin/src/utils/getRelatedGroups.d.ts +4 -0
  132. package/build/admin/src/utils/getRelatedGroups.js +6 -0
  133. package/build/admin/src/utils/getUrl.d.ts +3 -0
  134. package/build/admin/src/utils/getUrl.js +6 -0
  135. package/build/admin/src/utils/handleAPIError.d.ts +4 -0
  136. package/build/admin/src/utils/handleAPIError.js +20 -0
  137. package/build/admin/src/utils/index.d.ts +12 -0
  138. package/build/admin/src/utils/index.js +97 -0
  139. package/build/admin/src/utils/parseRegExp.d.ts +6 -0
  140. package/build/admin/src/utils/parseRegExp.js +11 -0
  141. package/build/admin/src/utils/renderEntryTitle.d.ts +4 -0
  142. package/build/admin/src/utils/renderEntryTitle.js +16 -0
  143. package/build/admin/src/utils/renderInitials.d.ts +3 -0
  144. package/build/admin/src/utils/renderInitials.js +11 -0
  145. package/build/admin/src/utils/resolveCommentStatus.d.ts +4 -0
  146. package/build/admin/src/utils/resolveCommentStatus.js +32 -0
  147. package/build/admin/src/utils/resolveCommentStatusColor.d.ts +4 -0
  148. package/build/admin/src/utils/resolveCommentStatusColor.js +22 -0
  149. package/build/content-types/comment.d.ts +91 -0
  150. package/build/content-types/comment.js +92 -0
  151. package/build/content-types/index.d.ts +143 -0
  152. package/build/content-types/index.js +18 -0
  153. package/build/content-types/report.d.ts +48 -0
  154. package/build/content-types/report.js +49 -0
  155. package/build/package.json +94 -0
  156. package/build/permissions.d.ts +18 -0
  157. package/build/permissions.js +18 -0
  158. package/build/server/bootstrap.d.ts +4 -0
  159. package/build/server/bootstrap.js +65 -0
  160. package/build/server/config/index.d.ts +4 -0
  161. package/build/server/config/index.js +19 -0
  162. package/build/server/controllers/admin.d.ts +4 -0
  163. package/build/server/controllers/admin.js +124 -0
  164. package/build/server/controllers/client.d.ts +4 -0
  165. package/build/server/controllers/client.js +111 -0
  166. package/build/server/controllers/index.d.ts +6 -0
  167. package/build/server/controllers/index.js +15 -0
  168. package/build/server/controllers/utils/functions.d.ts +7 -0
  169. package/build/server/controllers/utils/functions.js +24 -0
  170. package/build/server/controllers/utils/parsers.d.ts +15 -0
  171. package/build/server/controllers/utils/parsers.js +25 -0
  172. package/build/server/destroy.d.ts +3 -0
  173. package/build/server/destroy.js +3 -0
  174. package/build/server/graphql/index.d.ts +4 -0
  175. package/build/server/graphql/index.js +37 -0
  176. package/build/server/graphql/mutations/createAbuseReport.d.ts +11 -0
  177. package/build/server/graphql/mutations/createAbuseReport.js +27 -0
  178. package/build/server/graphql/mutations/createComment.d.ts +14 -0
  179. package/build/server/graphql/mutations/createComment.js +26 -0
  180. package/build/server/graphql/mutations/index.d.ts +4 -0
  181. package/build/server/graphql/mutations/index.js +28 -0
  182. package/build/server/graphql/mutations/removeComment.d.ts +11 -0
  183. package/build/server/graphql/mutations/removeComment.js +27 -0
  184. package/build/server/graphql/mutations/updateComment.d.ts +11 -0
  185. package/build/server/graphql/mutations/updateComment.js +27 -0
  186. package/build/server/graphql/queries/findAllFlat.d.ts +19 -0
  187. package/build/server/graphql/queries/findAllFlat.js +47 -0
  188. package/build/server/graphql/queries/findAllInHierarchy.d.ts +18 -0
  189. package/build/server/graphql/queries/findAllInHierarchy.js +38 -0
  190. package/build/server/graphql/queries/index.d.ts +4 -0
  191. package/build/server/graphql/queries/index.js +24 -0
  192. package/build/server/graphql/resolvers-config.d.ts +23 -0
  193. package/build/server/graphql/resolvers-config.js +13 -0
  194. package/build/server/graphql/types/comment-author.d.ts +4 -0
  195. package/build/server/graphql/types/comment-author.js +12 -0
  196. package/build/server/graphql/types/comment-nested.d.ts +4 -0
  197. package/build/server/graphql/types/comment-nested.js +19 -0
  198. package/build/server/graphql/types/comment.d.ts +4 -0
  199. package/build/server/graphql/types/comment.js +18 -0
  200. package/build/server/graphql/types/create-comment-author.d.ts +4 -0
  201. package/build/server/graphql/types/create-comment-author.js +12 -0
  202. package/build/server/graphql/types/create-comment.d.ts +4 -0
  203. package/build/server/graphql/types/create-comment.js +12 -0
  204. package/build/server/graphql/types/create-report.d.ts +4 -0
  205. package/build/server/graphql/types/create-report.js +12 -0
  206. package/build/server/graphql/types/id.d.ts +4 -0
  207. package/build/server/graphql/types/id.js +26 -0
  208. package/build/server/graphql/types/identify-comment-author.d.ts +4 -0
  209. package/build/server/graphql/types/identify-comment-author.js +9 -0
  210. package/build/server/graphql/types/index.d.ts +4 -0
  211. package/build/server/graphql/types/index.js +44 -0
  212. package/build/server/graphql/types/remove-comment.d.ts +4 -0
  213. package/build/server/graphql/types/remove-comment.js +11 -0
  214. package/build/server/graphql/types/report-reason.d.ts +4 -0
  215. package/build/server/graphql/types/report-reason.js +12 -0
  216. package/build/server/graphql/types/report.d.ts +4 -0
  217. package/build/server/graphql/types/report.js +14 -0
  218. package/build/server/graphql/types/response-find-all.d.ts +4 -0
  219. package/build/server/graphql/types/response-find-all.js +10 -0
  220. package/build/server/graphql/types/response-meta.d.ts +4 -0
  221. package/build/server/graphql/types/response-meta.js +9 -0
  222. package/build/server/graphql/types/response-pagination.d.ts +4 -0
  223. package/build/server/graphql/types/response-pagination.js +14 -0
  224. package/build/server/graphql/types/update-comment.d.ts +4 -0
  225. package/build/server/graphql/types/update-comment.js +12 -0
  226. package/build/server/index.d.ts +26 -0
  227. package/build/server/index.js +25 -0
  228. package/build/server/register.d.ts +3 -0
  229. package/build/server/register.js +3 -0
  230. package/build/server/routes/admin.d.ts +4 -0
  231. package/build/server/routes/admin.js +118 -0
  232. package/build/server/routes/client.d.ts +4 -0
  233. package/build/server/routes/client.js +54 -0
  234. package/build/server/routes/index.d.ts +11 -0
  235. package/build/server/routes/index.js +21 -0
  236. package/build/server/services/admin.d.ts +5 -0
  237. package/build/server/services/admin.js +296 -0
  238. package/build/server/services/client.d.ts +5 -0
  239. package/build/server/services/client.js +247 -0
  240. package/build/server/services/common.d.ts +5 -0
  241. package/build/server/services/common.js +266 -0
  242. package/build/server/services/graphql.d.ts +5 -0
  243. package/build/server/services/graphql.js +136 -0
  244. package/build/server/services/index.d.ts +8 -0
  245. package/build/server/services/index.js +16 -0
  246. package/build/server/services/utils/functions.d.ts +13 -0
  247. package/build/server/services/utils/functions.js +141 -0
  248. package/build/server/utils/constants.d.ts +9 -0
  249. package/build/server/utils/constants.js +23 -0
  250. package/build/server/utils/error.d.ts +23 -0
  251. package/build/server/utils/error.js +29 -0
  252. package/build/server/utils/functions.d.ts +14 -0
  253. package/build/server/utils/functions.js +50 -0
  254. package/build/strapi-admin.d.ts +3 -0
  255. package/build/strapi-admin.js +10 -0
  256. package/build/strapi-server.d.ts +177 -0
  257. package/build/strapi-server.js +46 -0
  258. package/build/tsconfig.tsbuildinfo +1 -0
  259. package/build/types/contentTypes.d.ts +46 -0
  260. package/build/types/contentTypes.js +3 -0
  261. package/package.json +3 -3
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const functions_1 = require("./../utils/functions");
7
+ const functions_2 = require("./utils/functions");
8
+ const parsers_1 = require("./utils/parsers");
9
+ const error_1 = __importDefault(require("../utils/error"));
10
+ const controllers = {
11
+ getService(name = "client") {
12
+ return (0, functions_1.getPluginService)(name);
13
+ },
14
+ async findAllFlat(ctx) {
15
+ const { params = {}, query, sort, pagination } = ctx;
16
+ const { relation } = (0, functions_2.parseParams)(params);
17
+ const { sort: querySort, pagination: queryPagination, ...filterQuery } = query || {};
18
+ try {
19
+ (0, functions_1.assertParamsPresent)(params, ["relation"]);
20
+ return this.getService("common").findAllFlat((0, parsers_1.flatInput)(relation, filterQuery, sort || querySort, pagination || queryPagination));
21
+ }
22
+ catch (e) {
23
+ throw (0, functions_2.throwError)(ctx, e);
24
+ }
25
+ },
26
+ async findAllInHierarchy(ctx) {
27
+ const { params, query, sort } = ctx;
28
+ const { relation } = (0, functions_2.parseParams)(params);
29
+ const { sort: querySort, ...filterQuery } = query || {};
30
+ try {
31
+ (0, functions_1.assertParamsPresent)(params, ["relation"]);
32
+ return await this.getService("common").findAllInHierarchy({
33
+ ...(0, parsers_1.flatInput)(relation, filterQuery, sort || querySort),
34
+ dropBlockedThreads: true,
35
+ });
36
+ }
37
+ catch (e) {
38
+ throw (0, functions_2.throwError)(ctx, e);
39
+ }
40
+ },
41
+ async post(ctx) {
42
+ const { request, params, state = {} } = ctx;
43
+ const { relation } = (0, functions_2.parseParams)(params);
44
+ const { user } = state;
45
+ const { body } = request;
46
+ try {
47
+ (0, functions_1.assertParamsPresent)(params, ["relation"]);
48
+ (0, functions_1.assertNotEmpty)(body);
49
+ const entity = await this.getService().create(relation, body, user);
50
+ if (entity) {
51
+ return entity;
52
+ }
53
+ throw new error_1.default(400, "Comment hasn't been created");
54
+ }
55
+ catch (e) {
56
+ throw (0, functions_2.throwError)(ctx, e);
57
+ }
58
+ },
59
+ async put(ctx) {
60
+ const { request, state, params = {} } = ctx;
61
+ const { body } = request;
62
+ const { user } = state;
63
+ const { commentId, relation } = (0, functions_2.parseParams)(params);
64
+ try {
65
+ (0, functions_1.assertParamsPresent)(params, ["commentId", "relation"]);
66
+ (0, functions_1.assertNotEmpty)(body);
67
+ return await this.getService().update(commentId, relation, body, user);
68
+ }
69
+ catch (e) {
70
+ throw (0, functions_2.throwError)(ctx, e);
71
+ }
72
+ },
73
+ async reportAbuse(ctx) {
74
+ const { request, state, params = {} } = ctx;
75
+ const { body } = request;
76
+ const { user } = state;
77
+ const { relation, commentId } = (0, functions_2.parseParams)(params);
78
+ try {
79
+ (0, functions_1.assertParamsPresent)(params, ["commentId", "relation"]);
80
+ (0, functions_1.assertNotEmpty)(body);
81
+ if (!body.content) {
82
+ throw new error_1.default(400, "Content field is required");
83
+ }
84
+ return await this.getService().reportAbuse(commentId, relation, body, user);
85
+ }
86
+ catch (e) {
87
+ throw (0, functions_2.throwError)(ctx, e);
88
+ }
89
+ },
90
+ async removeComment(ctx) {
91
+ const { params, query, state: { user }, } = ctx;
92
+ const { relation, commentId } = (0, functions_2.parseParams)(params);
93
+ const { authorId } = (0, functions_2.parseParams)(query);
94
+ try {
95
+ (0, functions_1.assertParamsPresent)(params, ["commentId", "relation"]);
96
+ (0, functions_1.assertParamsPresent)(query, ["authorId"]);
97
+ if (authorId || user?.id) {
98
+ return await this.getService().markAsRemoved(commentId, relation, authorId, user);
99
+ }
100
+ return new error_1.default(400, "Not provided authorId");
101
+ }
102
+ catch (e) {
103
+ if (!e.isBoom) {
104
+ (0, functions_2.throwError)(ctx, e);
105
+ }
106
+ throw e;
107
+ }
108
+ },
109
+ };
110
+ exports.default = controllers;
111
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1,6 @@
1
+ declare type PluginControllers = {
2
+ [key: string]: Function | Object;
3
+ };
4
+ declare const controllers: PluginControllers;
5
+ export default controllers;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ const admin_1 = __importDefault(require("./admin"));
9
+ const client_1 = __importDefault(require("./client"));
10
+ const controllers = {
11
+ admin: admin_1.default,
12
+ client: client_1.default,
13
+ };
14
+ exports.default = controllers;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ import { Id, StringMap, StrapiRequestContext } from "strapi-typed";
2
+ import PluginError from "../../utils/error";
3
+ declare type ParseResponse = StringMap<string | number | Id>;
4
+ export declare const parseParams: <T extends ParseResponse>(params: StringMap<string | number>) => T;
5
+ export declare const throwError: <T extends {} = never>(ctx: StrapiRequestContext<T, {}>, e: PluginError | Error | unknown) => PluginError | Error | unknown | never;
6
+ export {};
7
+ //# sourceMappingURL=functions.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.throwError = exports.parseParams = void 0;
7
+ const error_1 = __importDefault(require("../../utils/error"));
8
+ const parseParams = (params) => Object.keys(params).reduce((prev, curr) => {
9
+ const value = params[curr];
10
+ const parsedValue = Number(value);
11
+ return {
12
+ ...prev,
13
+ [curr]: isNaN(parsedValue) ? value : parsedValue,
14
+ };
15
+ }, {});
16
+ exports.parseParams = parseParams;
17
+ const throwError = (ctx, e) => {
18
+ if (e instanceof error_1.default) {
19
+ return ctx.throw(e.status, JSON.stringify(e));
20
+ }
21
+ return e;
22
+ };
23
+ exports.throwError = throwError;
24
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1,15 @@
1
+ import { Id } from "strapi-typed";
2
+ import { ToBeFixed } from "../../../types";
3
+ export declare const flatInput: (relation: Id, query: ToBeFixed, sort: ToBeFixed, pagination?: ToBeFixed) => {
4
+ query: any;
5
+ populate: {
6
+ threadOf: {
7
+ populate: {
8
+ authorUser: boolean;
9
+ };
10
+ };
11
+ };
12
+ pagination: any;
13
+ sort: any;
14
+ };
15
+ //# sourceMappingURL=parsers.d.ts.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flatInput = void 0;
4
+ const flatInput = (relation, query, sort, pagination) => {
5
+ const filters = query?.filters || query;
6
+ const orOperator = (filters?.$or || []).filter(
7
+ (_) => !Object.keys(_).includes("removed")
8
+ );
9
+ return {
10
+ query: {
11
+ ...filters,
12
+ $or: [...orOperator, { removed: { $null: true } }, { removed: false }],
13
+ related: relation,
14
+ },
15
+ populate: {
16
+ threadOf: {
17
+ populate: { authorUser: true },
18
+ },
19
+ },
20
+ pagination,
21
+ sort,
22
+ };
23
+ };
24
+ exports.flatInput = flatInput;
25
+ //# sourceMappingURL=parsers.js.map
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+ export = _default;
3
+ //# sourceMappingURL=destroy.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ module.exports = () => {};
3
+ //# sourceMappingURL=destroy.js.map
@@ -0,0 +1,4 @@
1
+ import { StrapiGraphQLContext } from "../../types";
2
+ declare const _default: ({ strapi, config }: StrapiGraphQLContext) => Promise<void>;
3
+ export = _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ const types_1 = __importDefault(require("./types"));
8
+ const queries_1 = __importDefault(require("./queries"));
9
+ const mutations_1 = __importDefault(require("./mutations"));
10
+ const resolvers_config_1 = __importDefault(require("./resolvers-config"));
11
+ const functions_1 = require("../services/utils/functions");
12
+ module.exports = async ({ strapi, config }) => {
13
+ const extensionService = strapi.plugin("graphql").service("extension");
14
+ extensionService
15
+ .shadowCRUD((0, functions_1.getModelUid)("comment"))
16
+ .disableQueries();
17
+ extensionService
18
+ .shadowCRUD((0, functions_1.getModelUid)("comment"))
19
+ .disableMutations();
20
+ extensionService
21
+ .shadowCRUD((0, functions_1.getModelUid)("comment-report"))
22
+ .disableQueries();
23
+ extensionService
24
+ .shadowCRUD((0, functions_1.getModelUid)("comment-report"))
25
+ .disableMutations();
26
+ extensionService.use(({ strapi, nexus }) => {
27
+ const types = (0, types_1.default)({ strapi, nexus, config });
28
+ const queries = (0, queries_1.default)({ strapi, nexus, config });
29
+ const mutations = (0, mutations_1.default)({ strapi, nexus, config });
30
+ const resolversConfig = (0, resolvers_config_1.default)({ strapi, config });
31
+ return {
32
+ types: [types, queries, mutations],
33
+ resolversConfig,
34
+ };
35
+ });
36
+ };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import { StrapiRequestContext } from "strapi-typed";
2
+ import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
3
+ declare const _default: ({ nexus }: StrapiGraphQLContext) => {
4
+ type: any;
5
+ args: {
6
+ input: any;
7
+ };
8
+ resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").CommentReport>;
9
+ };
10
+ export = _default;
11
+ //# sourceMappingURL=createAbuseReport.d.ts.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ const functions_1 = require("../../utils/functions");
3
+ module.exports = ({ nexus }) => {
4
+ const { nonNull } = nexus;
5
+ return {
6
+ type: nonNull("Report"),
7
+ args: {
8
+ input: nonNull("CreateReport"),
9
+ },
10
+ async resolve(_, args, ctx) {
11
+ const { input } = args;
12
+ const { state: { user = undefined } = {} } = ctx;
13
+ const { commentId, relation, ...body } = input;
14
+ try {
15
+ return await (0, functions_1.getPluginService)("client").reportAbuse(
16
+ commentId,
17
+ relation,
18
+ body,
19
+ user
20
+ );
21
+ } catch (e) {
22
+ throw new Error(e);
23
+ }
24
+ },
25
+ };
26
+ };
27
+ //# sourceMappingURL=createAbuseReport.js.map
@@ -0,0 +1,14 @@
1
+ import { StrapiRequestContext } from "strapi-typed";
2
+ import { StrapiGraphQLContext, ToBeFixed } from "../../../types";
3
+ declare type CreateCommentProps = {
4
+ input: ToBeFixed;
5
+ };
6
+ declare const _default: ({ nexus }: StrapiGraphQLContext) => {
7
+ type: any;
8
+ args: {
9
+ input: any;
10
+ };
11
+ resolve(_: Object, args: CreateCommentProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment>;
12
+ };
13
+ export = _default;
14
+ //# sourceMappingURL=createComment.d.ts.map
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ const functions_1 = require("../../utils/functions");
3
+ module.exports = ({ nexus }) => {
4
+ const { nonNull } = nexus;
5
+ return {
6
+ type: nonNull("CommentSingle"),
7
+ args: {
8
+ input: nonNull("CreateComment"),
9
+ },
10
+ async resolve(_, args, ctx) {
11
+ const { input } = args;
12
+ const { state: { user = undefined } = {} } = ctx;
13
+ const { relation, ...body } = input;
14
+ try {
15
+ return await (0, functions_1.getPluginService)("client").create(
16
+ relation,
17
+ body,
18
+ user
19
+ );
20
+ } catch (e) {
21
+ throw new Error(e);
22
+ }
23
+ },
24
+ };
25
+ };
26
+ //# sourceMappingURL=createComment.js.map
@@ -0,0 +1,4 @@
1
+ import { StrapiGraphQLContext } from "../../../types";
2
+ declare const _default: (context: StrapiGraphQLContext) => any;
3
+ export = _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ const createComment_1 = __importDefault(require("./createComment"));
8
+ const updateComment_1 = __importDefault(require("./updateComment"));
9
+ const removeComment_1 = __importDefault(require("./removeComment"));
10
+ const createAbuseReport_1 = __importDefault(require("./createAbuseReport"));
11
+ module.exports = (context) => {
12
+ const mutations = {
13
+ createComment: createComment_1.default,
14
+ updateComment: updateComment_1.default,
15
+ removeComment: removeComment_1.default,
16
+ createAbuseReport: createAbuseReport_1.default,
17
+ };
18
+ return context.nexus.extendType({
19
+ type: "Mutation",
20
+ definition(t) {
21
+ for (const [name, configFactory] of Object.entries(mutations)) {
22
+ const config = configFactory(context);
23
+ t.field(name, config);
24
+ }
25
+ },
26
+ });
27
+ };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,11 @@
1
+ import { StrapiRequestContext } from "strapi-typed";
2
+ import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
3
+ declare const _default: ({ nexus }: StrapiGraphQLContext) => {
4
+ type: any;
5
+ args: {
6
+ input: any;
7
+ };
8
+ resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment>;
9
+ };
10
+ export = _default;
11
+ //# sourceMappingURL=removeComment.d.ts.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ const functions_1 = require("../../utils/functions");
3
+ module.exports = ({ nexus }) => {
4
+ const { nonNull } = nexus;
5
+ return {
6
+ type: nonNull("CommentSingle"),
7
+ args: {
8
+ input: nonNull("RemoveComment"),
9
+ },
10
+ async resolve(_, args, ctx) {
11
+ const { input } = args;
12
+ const { state: { user = undefined } = {} } = ctx;
13
+ const { id, relation, author } = input;
14
+ try {
15
+ return await (0, functions_1.getPluginService)("client").markAsRemoved(
16
+ id,
17
+ relation,
18
+ author?.id,
19
+ user
20
+ );
21
+ } catch (e) {
22
+ throw new Error(e);
23
+ }
24
+ },
25
+ };
26
+ };
27
+ //# sourceMappingURL=removeComment.js.map
@@ -0,0 +1,11 @@
1
+ import { StrapiRequestContext } from "strapi-typed";
2
+ import { NexusRequestProps, StrapiGraphQLContext, ToBeFixed } from "../../../types";
3
+ declare const _default: ({ nexus }: StrapiGraphQLContext) => {
4
+ type: any;
5
+ args: {
6
+ input: any;
7
+ };
8
+ resolve(_: Object, args: NexusRequestProps, ctx: StrapiRequestContext<never> & ToBeFixed): Promise<import("../../../types").Comment>;
9
+ };
10
+ export = _default;
11
+ //# sourceMappingURL=updateComment.d.ts.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ const functions_1 = require("../../utils/functions");
3
+ module.exports = ({ nexus }) => {
4
+ const { nonNull } = nexus;
5
+ return {
6
+ type: nonNull("CommentSingle"),
7
+ args: {
8
+ input: nonNull("UpdateComment"),
9
+ },
10
+ async resolve(_, args, ctx) {
11
+ const { input } = args;
12
+ const { state: { user = undefined } = {} } = ctx;
13
+ const { id, relation, ...body } = input;
14
+ try {
15
+ return await (0, functions_1.getPluginService)("client").update(
16
+ id,
17
+ relation,
18
+ body,
19
+ user
20
+ );
21
+ } catch (e) {
22
+ throw new Error(e);
23
+ }
24
+ },
25
+ };
26
+ };
27
+ //# sourceMappingURL=updateComment.js.map
@@ -0,0 +1,19 @@
1
+ import { Id, StrapiGraphQLContext, ToBeFixed } from "../../../types";
2
+ declare type ResponseFindAllResolverProps = {
3
+ relation: Id;
4
+ filters: ToBeFixed;
5
+ sort: ToBeFixed;
6
+ pagination: ToBeFixed;
7
+ };
8
+ declare const _default: ({ strapi, nexus }: StrapiGraphQLContext) => {
9
+ type: string;
10
+ args: {
11
+ relation: any;
12
+ filters: any;
13
+ pagination: any;
14
+ sort: any;
15
+ };
16
+ resolve(obj: Object, args: ResponseFindAllResolverProps): Promise<import("strapi-typed").StrapiPaginatedResponse<import("../../../types").Comment>>;
17
+ };
18
+ export = _default;
19
+ //# sourceMappingURL=findAllFlat.d.ts.map
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ const lodash_1 = require("lodash");
8
+ const comment_1 = __importDefault(require("../../../content-types/comment"));
9
+ const parsers_1 = require("../../controllers/utils/parsers");
10
+ const functions_1 = require("../../utils/functions");
11
+ module.exports = ({ strapi, nexus }) => {
12
+ const { nonNull, stringArg } = nexus;
13
+ const { service: getService } = strapi.plugin("graphql");
14
+ const { args } = getService("internals");
15
+ return {
16
+ type: "ResponseFindAll",
17
+ args: {
18
+ relation: nonNull(stringArg()),
19
+ filters: (0, functions_1.getPluginService)("gql").buildContentTypeFilters(
20
+ comment_1.default
21
+ ),
22
+ pagination: args.PaginationArg,
23
+ sort: args.SortArg,
24
+ },
25
+ async resolve(obj, args) {
26
+ const { relation, filters, sort, pagination } = args;
27
+ return await (0, functions_1.getPluginService)("common").findAllFlat(
28
+ (0, parsers_1.flatInput)(
29
+ relation,
30
+ (0, functions_1.getPluginService)("gql").graphQLFiltersToStrapiQuery(
31
+ filters,
32
+ comment_1.default
33
+ ),
34
+ sort,
35
+ pagination
36
+ ? {
37
+ ...pagination,
38
+ withCount: !(0, lodash_1.isEmpty)(pagination),
39
+ }
40
+ : undefined
41
+ ),
42
+ undefined
43
+ );
44
+ },
45
+ };
46
+ };
47
+ //# sourceMappingURL=findAllFlat.js.map
@@ -0,0 +1,18 @@
1
+ import { Id } from "strapi-typed";
2
+ import { StrapiGraphQLContext, ToBeFixed } from "../../../types";
3
+ declare type findAllInHierarchyProps = {
4
+ relation: Id;
5
+ filters: ToBeFixed;
6
+ sort: ToBeFixed;
7
+ pagination: ToBeFixed;
8
+ };
9
+ declare const _default: ({ strapi, nexus }: StrapiGraphQLContext) => {
10
+ type: any;
11
+ args: {
12
+ relation: any;
13
+ sort: any;
14
+ };
15
+ resolve(obj: Object, args: findAllInHierarchyProps): Promise<import("../../../types").Comment[]>;
16
+ };
17
+ export = _default;
18
+ //# sourceMappingURL=findAllInHierarchy.d.ts.map
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ const comment_1 = __importDefault(require("../../../content-types/comment"));
8
+ const parsers_1 = require("../../controllers/utils/parsers");
9
+ const functions_1 = require("../../utils/functions");
10
+ module.exports = ({ strapi, nexus }) => {
11
+ const { nonNull, list, stringArg } = nexus;
12
+ const { service: getService } = strapi.plugin("graphql");
13
+ const { args } = getService("internals");
14
+ return {
15
+ type: nonNull(list("CommentNested")),
16
+ args: {
17
+ relation: nonNull(stringArg()),
18
+ sort: args.SortArg,
19
+ },
20
+ async resolve(obj, args) {
21
+ const { relation, filters, sort } = args;
22
+ return await (0, functions_1.getPluginService)(
23
+ "common"
24
+ ).findAllInHierarchy({
25
+ ...(0, parsers_1.flatInput)(
26
+ relation,
27
+ (0, functions_1.getPluginService)("gql").graphQLFiltersToStrapiQuery(
28
+ filters,
29
+ comment_1.default
30
+ ),
31
+ sort
32
+ ),
33
+ dropBlockedThreads: true,
34
+ });
35
+ },
36
+ };
37
+ };
38
+ //# sourceMappingURL=findAllInHierarchy.js.map
@@ -0,0 +1,4 @@
1
+ import { StrapiGraphQLContext } from "../../../types";
2
+ declare const _default: (context: StrapiGraphQLContext) => any;
3
+ export = _default;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault =
3
+ (this && this.__importDefault) ||
4
+ function (mod) {
5
+ return mod && mod.__esModule ? mod : { default: mod };
6
+ };
7
+ const findAllFlat_1 = __importDefault(require("./findAllFlat"));
8
+ const findAllInHierarchy_1 = __importDefault(require("./findAllInHierarchy"));
9
+ module.exports = (context) => {
10
+ const queries = {
11
+ findAllFlat: findAllFlat_1.default,
12
+ findAllInHierarchy: findAllInHierarchy_1.default,
13
+ };
14
+ return context.nexus.extendType({
15
+ type: "Query",
16
+ definition(t) {
17
+ for (const [name, configFactory] of Object.entries(queries)) {
18
+ const config = configFactory(context);
19
+ t.field(name, config);
20
+ }
21
+ },
22
+ });
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ import { StrapiGraphQLContext } from "../../types";
2
+ declare const _default: ({ config }: StrapiGraphQLContext) => {
3
+ "Query.findAllFlat": {
4
+ auth: any;
5
+ };
6
+ "Query.findAllInHierarchy": {
7
+ auth: any;
8
+ };
9
+ "Mutation.createComment": {
10
+ auth: any;
11
+ };
12
+ "Mutation.updateComment": {
13
+ auth: any;
14
+ };
15
+ "Mutation.removeComment": {
16
+ auth: any;
17
+ };
18
+ "Mutation.createAbuseReport": {
19
+ auth: any;
20
+ };
21
+ };
22
+ export = _default;
23
+ //# sourceMappingURL=resolvers-config.d.ts.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ module.exports = ({ config }) => {
3
+ const { gql: { auth = false } = {} } = config;
4
+ return {
5
+ "Query.findAllFlat": { auth },
6
+ "Query.findAllInHierarchy": { auth },
7
+ "Mutation.createComment": { auth },
8
+ "Mutation.updateComment": { auth },
9
+ "Mutation.removeComment": { auth },
10
+ "Mutation.createAbuseReport": { auth },
11
+ };
12
+ };
13
+ //# sourceMappingURL=resolvers-config.js.map