@webiny/api-apw 0.0.0-unstable.5e7233243f

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 (229) hide show
  1. package/ContentApwSettingsPlugin.d.ts +10 -0
  2. package/ContentApwSettingsPlugin.js +17 -0
  3. package/ContentApwSettingsPlugin.js.map +1 -0
  4. package/LICENSE +21 -0
  5. package/README.md +34 -0
  6. package/crud/createChangeRequestMethods.d.ts +2 -0
  7. package/crud/createChangeRequestMethods.js +95 -0
  8. package/crud/createChangeRequestMethods.js.map +1 -0
  9. package/crud/createCommentMethods.d.ts +2 -0
  10. package/crud/createCommentMethods.js +96 -0
  11. package/crud/createCommentMethods.js.map +1 -0
  12. package/crud/createContentReviewMethods.d.ts +10 -0
  13. package/crud/createContentReviewMethods.js +552 -0
  14. package/crud/createContentReviewMethods.js.map +1 -0
  15. package/crud/createReviewerMethods.d.ts +2 -0
  16. package/crud/createReviewerMethods.js +96 -0
  17. package/crud/createReviewerMethods.js.map +1 -0
  18. package/crud/createWorkflowMethods.d.ts +2 -0
  19. package/crud/createWorkflowMethods.js +96 -0
  20. package/crud/createWorkflowMethods.js.map +1 -0
  21. package/crud/index.d.ts +2 -0
  22. package/crud/index.js +100 -0
  23. package/crud/index.js.map +1 -0
  24. package/crud/utils.d.ts +21 -0
  25. package/crud/utils.js +142 -0
  26. package/crud/utils.js.map +1 -0
  27. package/index.d.ts +4 -0
  28. package/index.js +34 -0
  29. package/index.js.map +1 -0
  30. package/package.json +75 -0
  31. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +10 -0
  32. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +51 -0
  33. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -0
  34. package/plugins/cms/README.md +49 -0
  35. package/plugins/cms/apwEntryPlugins.d.ts +8 -0
  36. package/plugins/cms/apwEntryPlugins.js +50 -0
  37. package/plugins/cms/apwEntryPlugins.js.map +1 -0
  38. package/plugins/cms/index.d.ts +12 -0
  39. package/plugins/cms/index.js +37 -0
  40. package/plugins/cms/index.js.map +1 -0
  41. package/plugins/cms/linkContentReviewToEntry.d.ts +8 -0
  42. package/plugins/cms/linkContentReviewToEntry.js +108 -0
  43. package/plugins/cms/linkContentReviewToEntry.js.map +1 -0
  44. package/plugins/cms/linkWorkflowToEntry.d.ts +8 -0
  45. package/plugins/cms/linkWorkflowToEntry.js +166 -0
  46. package/plugins/cms/linkWorkflowToEntry.js.map +1 -0
  47. package/plugins/cms/triggerContentReview.d.ts +8 -0
  48. package/plugins/cms/triggerContentReview.js +59 -0
  49. package/plugins/cms/triggerContentReview.js.map +1 -0
  50. package/plugins/cms/updateContentReviewStatus.d.ts +10 -0
  51. package/plugins/cms/updateContentReviewStatus.js +101 -0
  52. package/plugins/cms/updateContentReviewStatus.js.map +1 -0
  53. package/plugins/cms/utils.d.ts +27 -0
  54. package/plugins/cms/utils.js +211 -0
  55. package/plugins/cms/utils.js.map +1 -0
  56. package/plugins/context.d.ts +5 -0
  57. package/plugins/context.js +146 -0
  58. package/plugins/context.js.map +1 -0
  59. package/plugins/graphql/changeRequest.gql.d.ts +4 -0
  60. package/plugins/graphql/changeRequest.gql.js +155 -0
  61. package/plugins/graphql/changeRequest.gql.js.map +1 -0
  62. package/plugins/graphql/comment.gql.d.ts +4 -0
  63. package/plugins/graphql/comment.gql.js +160 -0
  64. package/plugins/graphql/comment.gql.js.map +1 -0
  65. package/plugins/graphql/contentReview.gql.d.ts +4 -0
  66. package/plugins/graphql/contentReview.gql.js +382 -0
  67. package/plugins/graphql/contentReview.gql.js.map +1 -0
  68. package/plugins/graphql/reviewer.gql.d.ts +4 -0
  69. package/plugins/graphql/reviewer.gql.js +114 -0
  70. package/plugins/graphql/reviewer.gql.js.map +1 -0
  71. package/plugins/graphql/workflow.gql.d.ts +4 -0
  72. package/plugins/graphql/workflow.gql.js +205 -0
  73. package/plugins/graphql/workflow.gql.js.map +1 -0
  74. package/plugins/graphql.d.ts +4 -0
  75. package/plugins/graphql.js +95 -0
  76. package/plugins/graphql.js.map +1 -0
  77. package/plugins/hooks/createReviewerFromIdentity.d.ts +2 -0
  78. package/plugins/hooks/createReviewerFromIdentity.js +62 -0
  79. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -0
  80. package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +2 -0
  81. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +67 -0
  82. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -0
  83. package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +2 -0
  84. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +59 -0
  85. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -0
  86. package/plugins/hooks/index.d.ts +3 -0
  87. package/plugins/hooks/index.js +68 -0
  88. package/plugins/hooks/index.js.map +1 -0
  89. package/plugins/hooks/initializeContentReviewSteps.d.ts +2 -0
  90. package/plugins/hooks/initializeContentReviewSteps.js +89 -0
  91. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -0
  92. package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
  93. package/plugins/hooks/updatePendingChangeRequests.js +98 -0
  94. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -0
  95. package/plugins/hooks/updateTotalComments.d.ts +3 -0
  96. package/plugins/hooks/updateTotalComments.js +157 -0
  97. package/plugins/hooks/updateTotalComments.js.map +1 -0
  98. package/plugins/hooks/validateChangeRequest.d.ts +2 -0
  99. package/plugins/hooks/validateChangeRequest.js +64 -0
  100. package/plugins/hooks/validateChangeRequest.js.map +1 -0
  101. package/plugins/hooks/validateComment.d.ts +2 -0
  102. package/plugins/hooks/validateComment.js +47 -0
  103. package/plugins/hooks/validateComment.js.map +1 -0
  104. package/plugins/hooks/validateContentReview.d.ts +2 -0
  105. package/plugins/hooks/validateContentReview.js +38 -0
  106. package/plugins/hooks/validateContentReview.js.map +1 -0
  107. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
  108. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
  109. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
  110. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
  111. package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
  112. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
  113. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +3 -0
  114. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +25 -0
  115. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
  116. package/plugins/pageBuilder/index.d.ts +11 -0
  117. package/plugins/pageBuilder/index.js +45 -0
  118. package/plugins/pageBuilder/index.js.map +1 -0
  119. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
  120. package/plugins/pageBuilder/linkContentReviewToPage.js +93 -0
  121. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
  122. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
  123. package/plugins/pageBuilder/linkWorkflowToPage.js +182 -0
  124. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
  125. package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
  126. package/plugins/pageBuilder/triggerContentReview.js +50 -0
  127. package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
  128. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
  129. package/plugins/pageBuilder/updateContentReviewStatus.js +83 -0
  130. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
  131. package/plugins/pageBuilder/utils.d.ts +22 -0
  132. package/plugins/pageBuilder/utils.js +184 -0
  133. package/plugins/pageBuilder/utils.js.map +1 -0
  134. package/plugins/utils.d.ts +35 -0
  135. package/plugins/utils.js +197 -0
  136. package/plugins/utils.js.map +1 -0
  137. package/scheduler/createScheduleActionMethods.d.ts +2 -0
  138. package/scheduler/createScheduleActionMethods.js +146 -0
  139. package/scheduler/createScheduleActionMethods.js.map +1 -0
  140. package/scheduler/handlers/executeAction/index.d.ts +13 -0
  141. package/scheduler/handlers/executeAction/index.js +172 -0
  142. package/scheduler/handlers/executeAction/index.js.map +1 -0
  143. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
  144. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
  145. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
  146. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
  147. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
  148. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
  149. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
  150. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
  151. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
  152. package/scheduler/handlers/executeAction/security.d.ts +4 -0
  153. package/scheduler/handlers/executeAction/security.js +68 -0
  154. package/scheduler/handlers/executeAction/security.js.map +1 -0
  155. package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
  156. package/scheduler/handlers/scheduleAction/index.js +165 -0
  157. package/scheduler/handlers/scheduleAction/index.js.map +1 -0
  158. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
  159. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +176 -0
  160. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
  161. package/scheduler/handlers/utils.d.ts +33 -0
  162. package/scheduler/handlers/utils.js +168 -0
  163. package/scheduler/handlers/utils.js.map +1 -0
  164. package/scheduler/index.d.ts +2 -0
  165. package/scheduler/index.js +27 -0
  166. package/scheduler/index.js.map +1 -0
  167. package/scheduler/types.d.ts +171 -0
  168. package/scheduler/types.js +34 -0
  169. package/scheduler/types.js.map +1 -0
  170. package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
  171. package/storageOperations/changeRequestStorageOperations.js +126 -0
  172. package/storageOperations/changeRequestStorageOperations.js.map +1 -0
  173. package/storageOperations/commentStorageOperations.d.ts +3 -0
  174. package/storageOperations/commentStorageOperations.js +142 -0
  175. package/storageOperations/commentStorageOperations.js.map +1 -0
  176. package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
  177. package/storageOperations/contentReviewStorageOperations.js +97 -0
  178. package/storageOperations/contentReviewStorageOperations.js.map +1 -0
  179. package/storageOperations/index.d.ts +15 -0
  180. package/storageOperations/index.js +52 -0
  181. package/storageOperations/index.js.map +1 -0
  182. package/storageOperations/models/changeRequest.model.d.ts +3 -0
  183. package/storageOperations/models/changeRequest.model.js +59 -0
  184. package/storageOperations/models/changeRequest.model.js.map +1 -0
  185. package/storageOperations/models/comment.model.d.ts +7 -0
  186. package/storageOperations/models/comment.model.js +60 -0
  187. package/storageOperations/models/comment.model.js.map +1 -0
  188. package/storageOperations/models/contentModelPluginFactory.d.ts +15 -0
  189. package/storageOperations/models/contentModelPluginFactory.js +32 -0
  190. package/storageOperations/models/contentModelPluginFactory.js.map +1 -0
  191. package/storageOperations/models/contentReview.model.d.ts +7 -0
  192. package/storageOperations/models/contentReview.model.js +257 -0
  193. package/storageOperations/models/contentReview.model.js.map +1 -0
  194. package/storageOperations/models/index.d.ts +2 -0
  195. package/storageOperations/models/index.js +115 -0
  196. package/storageOperations/models/index.js.map +1 -0
  197. package/storageOperations/models/reviewer.model.d.ts +3 -0
  198. package/storageOperations/models/reviewer.model.js +55 -0
  199. package/storageOperations/models/reviewer.model.js.map +1 -0
  200. package/storageOperations/models/utils.d.ts +3 -0
  201. package/storageOperations/models/utils.js +36 -0
  202. package/storageOperations/models/utils.js.map +1 -0
  203. package/storageOperations/models/workflow.model.d.ts +12 -0
  204. package/storageOperations/models/workflow.model.js +208 -0
  205. package/storageOperations/models/workflow.model.js.map +1 -0
  206. package/storageOperations/reviewerStorageOperations.d.ts +3 -0
  207. package/storageOperations/reviewerStorageOperations.js +93 -0
  208. package/storageOperations/reviewerStorageOperations.js.map +1 -0
  209. package/storageOperations/types.d.ts +34 -0
  210. package/storageOperations/types.js +5 -0
  211. package/storageOperations/types.js.map +1 -0
  212. package/storageOperations/workflowStorageOperations.d.ts +3 -0
  213. package/storageOperations/workflowStorageOperations.js +115 -0
  214. package/storageOperations/workflowStorageOperations.js.map +1 -0
  215. package/types.d.ts +737 -0
  216. package/types.js +69 -0
  217. package/types.js.map +1 -0
  218. package/utils/contentApwSettingsPlugin.d.ts +9 -0
  219. package/utils/contentApwSettingsPlugin.js +26 -0
  220. package/utils/contentApwSettingsPlugin.js.map +1 -0
  221. package/utils/errors.d.ts +16 -0
  222. package/utils/errors.js +75 -0
  223. package/utils/errors.js.map +1 -0
  224. package/utils/fieldResolver.d.ts +16 -0
  225. package/utils/fieldResolver.js +60 -0
  226. package/utils/fieldResolver.js.map +1 -0
  227. package/utils/resolve.d.ts +3 -0
  228. package/utils/resolve.js +18 -0
  229. package/utils/resolve.js.map +1 -0
@@ -0,0 +1,10 @@
1
+ import { Plugin } from "@webiny/plugins/Plugin";
2
+ import { ApwContentTypes } from "./types";
3
+ export declare abstract class ContentApwSettingsPlugin extends Plugin {
4
+ static type: string;
5
+ abstract canUse(type: ApwContentTypes): boolean;
6
+ abstract setWorkflowId(content: any, id: string | null): void;
7
+ abstract getWorkflowId(content: any): string | null;
8
+ abstract setContentReviewId(content: any, id: string | null): void;
9
+ abstract getContentReviewId(content: any): string | null;
10
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ContentApwSettingsPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _Plugin = require("@webiny/plugins/Plugin");
13
+
14
+ class ContentApwSettingsPlugin extends _Plugin.Plugin {}
15
+
16
+ exports.ContentApwSettingsPlugin = ContentApwSettingsPlugin;
17
+ (0, _defineProperty2.default)(ContentApwSettingsPlugin, "type", "apw.contentApwSettings");
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ContentApwSettingsPlugin","Plugin"],"sources":["ContentApwSettingsPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport abstract class ContentApwSettingsPlugin extends Plugin {\n public static override type = \"apw.contentApwSettings\";\n\n public abstract canUse(type: ApwContentTypes): boolean;\n\n public abstract setWorkflowId(content: any, id: string | null): void;\n\n public abstract getWorkflowId(content: any): string | null;\n\n public abstract setContentReviewId(content: any, id: string | null): void;\n\n public abstract getContentReviewId(content: any): string | null;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAGO,MAAeA,wBAAf,SAAgDC,cAAhD,CAAuD;;;8BAAxCD,wB,UACY,wB"}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @webiny/api-awp
2
+
3
+ [![](https://img.shields.io/npm/dw/@webiny/api-awp.svg)](https://www.npmjs.com/package/@webiny/api-awp)
4
+ [![](https://img.shields.io/npm/v/@webiny/api-awp.svg)](https://www.npmjs.com/package/@webiny/api-awp)
5
+ [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
7
+
8
+ ## Install
9
+
10
+ ```
11
+ npm install --save @webiny/api-awp
12
+ ```
13
+
14
+ Or if you prefer yarn:
15
+
16
+ ```
17
+ yarn add @webiny/api-awp
18
+ ```
19
+
20
+ ## Testing
21
+
22
+ To run tests api-apw tests with targeted storage operations loaded use:
23
+
24
+ #### DynamoDB
25
+
26
+ ```
27
+ yarn test packages/api-apw --keyword=apw:ddb --keyword=apw:base
28
+ ```
29
+
30
+ #### Note
31
+
32
+ > All the tests in `@webiny/api-apw` package are being tested against ddb-only storage operations because
33
+ current jest setup doesn't allow usage of more than one storage operations at a time with the help of --keyword flag.
34
+ We should revisit these tests once we have the ability to load multiple storage operations in the jest setup.
@@ -0,0 +1,2 @@
1
+ import { ApwChangeRequestCrud, CreateApwParams } from "../types";
2
+ export declare function createChangeRequestMethods({ storageOperations }: CreateApwParams): ApwChangeRequestCrud;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createChangeRequestMethods = createChangeRequestMethods;
7
+
8
+ var _pubsub = require("@webiny/pubsub");
9
+
10
+ function createChangeRequestMethods({
11
+ storageOperations
12
+ }) {
13
+ const onBeforeChangeRequestCreate = (0, _pubsub.createTopic)();
14
+ const onAfterChangeRequestCreate = (0, _pubsub.createTopic)();
15
+ const onBeforeChangeRequestUpdate = (0, _pubsub.createTopic)();
16
+ const onAfterChangeRequestUpdate = (0, _pubsub.createTopic)();
17
+ const onBeforeChangeRequestDelete = (0, _pubsub.createTopic)();
18
+ const onAfterChangeRequestDelete = (0, _pubsub.createTopic)();
19
+ return {
20
+ async get(id) {
21
+ return storageOperations.getChangeRequest({
22
+ id
23
+ });
24
+ },
25
+
26
+ async list(params) {
27
+ return storageOperations.listChangeRequests(params);
28
+ },
29
+
30
+ async create(data) {
31
+ await onBeforeChangeRequestCreate.publish({
32
+ input: data
33
+ });
34
+ const changeRequest = await storageOperations.createChangeRequest({
35
+ data
36
+ });
37
+ await onAfterChangeRequestCreate.publish({
38
+ changeRequest
39
+ });
40
+ return changeRequest;
41
+ },
42
+
43
+ async update(id, data) {
44
+ const original = await storageOperations.getChangeRequest({
45
+ id
46
+ });
47
+ await onBeforeChangeRequestUpdate.publish({
48
+ original,
49
+ input: {
50
+ id,
51
+ data
52
+ }
53
+ });
54
+ const changeRequest = await storageOperations.updateChangeRequest({
55
+ id,
56
+ data
57
+ });
58
+ await onAfterChangeRequestUpdate.publish({
59
+ original,
60
+ input: {
61
+ id,
62
+ data
63
+ },
64
+ changeRequest
65
+ });
66
+ return changeRequest;
67
+ },
68
+
69
+ async delete(id) {
70
+ const changeRequest = await storageOperations.getChangeRequest({
71
+ id
72
+ });
73
+ await onBeforeChangeRequestDelete.publish({
74
+ changeRequest
75
+ });
76
+ await storageOperations.deleteChangeRequest({
77
+ id
78
+ });
79
+ await onAfterChangeRequestDelete.publish({
80
+ changeRequest
81
+ });
82
+ return true;
83
+ },
84
+
85
+ /**
86
+ * Lifecycle events
87
+ */
88
+ onBeforeChangeRequestCreate,
89
+ onAfterChangeRequestCreate,
90
+ onBeforeChangeRequestUpdate,
91
+ onAfterChangeRequestUpdate,
92
+ onBeforeChangeRequestDelete,
93
+ onAfterChangeRequestDelete
94
+ };
95
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createChangeRequestMethods","storageOperations","onBeforeChangeRequestCreate","createTopic","onAfterChangeRequestCreate","onBeforeChangeRequestUpdate","onAfterChangeRequestUpdate","onBeforeChangeRequestDelete","onAfterChangeRequestDelete","get","id","getChangeRequest","list","params","listChangeRequests","create","data","publish","input","changeRequest","createChangeRequest","update","original","updateChangeRequest","delete","deleteChangeRequest"],"sources":["createChangeRequestMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwChangeRequestCrud,\n CreateApwParams,\n OnAfterChangeRequestCreateTopicParams,\n OnAfterChangeRequestDeleteTopicParams,\n OnAfterChangeRequestUpdateTopicParams,\n OnBeforeChangeRequestCreateTopicParams,\n OnBeforeChangeRequestDeleteTopicParams,\n OnBeforeChangeRequestUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n const onBeforeChangeRequestCreate = createTopic<OnBeforeChangeRequestCreateTopicParams>();\n const onAfterChangeRequestCreate = createTopic<OnAfterChangeRequestCreateTopicParams>();\n const onBeforeChangeRequestUpdate = createTopic<OnBeforeChangeRequestUpdateTopicParams>();\n const onAfterChangeRequestUpdate = createTopic<OnAfterChangeRequestUpdateTopicParams>();\n const onBeforeChangeRequestDelete = createTopic<OnBeforeChangeRequestDeleteTopicParams>();\n const onAfterChangeRequestDelete = createTopic<OnAfterChangeRequestDeleteTopicParams>();\n\n return {\n async get(id) {\n return storageOperations.getChangeRequest({ id });\n },\n async list(params) {\n return storageOperations.listChangeRequests(params);\n },\n async create(data) {\n await onBeforeChangeRequestCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onAfterChangeRequestCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onBeforeChangeRequestUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onAfterChangeRequestUpdate.publish({\n original,\n input: { id, data },\n changeRequest\n });\n\n return changeRequest;\n },\n async delete(id: string) {\n const changeRequest = await storageOperations.getChangeRequest({ id });\n\n await onBeforeChangeRequestDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onAfterChangeRequestDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onBeforeChangeRequestCreate,\n onAfterChangeRequestCreate,\n onBeforeChangeRequestUpdate,\n onAfterChangeRequestUpdate,\n onBeforeChangeRequestDelete,\n onAfterChangeRequestDelete\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,0BAAT,CAAoC;EACvCC;AADuC,CAApC,EAEmC;EACtC,MAAMC,2BAA2B,GAAG,IAAAC,mBAAA,GAApC;EACA,MAAMC,0BAA0B,GAAG,IAAAD,mBAAA,GAAnC;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAA,GAApC;EACA,MAAMG,0BAA0B,GAAG,IAAAH,mBAAA,GAAnC;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAA,GAApC;EACA,MAAMK,0BAA0B,GAAG,IAAAL,mBAAA,GAAnC;EAEA,OAAO;IACH,MAAMM,GAAN,CAAUC,EAAV,EAAc;MACV,OAAOT,iBAAiB,CAACU,gBAAlB,CAAmC;QAAED;MAAF,CAAnC,CAAP;IACH,CAHE;;IAIH,MAAME,IAAN,CAAWC,MAAX,EAAmB;MACf,OAAOZ,iBAAiB,CAACa,kBAAlB,CAAqCD,MAArC,CAAP;IACH,CANE;;IAOH,MAAME,MAAN,CAAaC,IAAb,EAAmB;MACf,MAAMd,2BAA2B,CAACe,OAA5B,CAAoC;QAAEC,KAAK,EAAEF;MAAT,CAApC,CAAN;MAEA,MAAMG,aAAa,GAAG,MAAMlB,iBAAiB,CAACmB,mBAAlB,CAAsC;QAAEJ;MAAF,CAAtC,CAA5B;MAEA,MAAMZ,0BAA0B,CAACa,OAA3B,CAAmC;QAAEE;MAAF,CAAnC,CAAN;MAEA,OAAOA,aAAP;IACH,CAfE;;IAgBH,MAAME,MAAN,CAAaX,EAAb,EAAiBM,IAAjB,EAAuB;MACnB,MAAMM,QAAQ,GAAG,MAAMrB,iBAAiB,CAACU,gBAAlB,CAAmC;QAAED;MAAF,CAAnC,CAAvB;MAEA,MAAML,2BAA2B,CAACY,OAA5B,CAAoC;QAAEK,QAAF;QAAYJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN;MAAnB,CAApC,CAAN;MAEA,MAAMG,aAAa,GAAG,MAAMlB,iBAAiB,CAACsB,mBAAlB,CAAsC;QAAEb,EAAF;QAAMM;MAAN,CAAtC,CAA5B;MAEA,MAAMV,0BAA0B,CAACW,OAA3B,CAAmC;QACrCK,QADqC;QAErCJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN,CAF8B;QAGrCG;MAHqC,CAAnC,CAAN;MAMA,OAAOA,aAAP;IACH,CA9BE;;IA+BH,MAAMK,MAAN,CAAad,EAAb,EAAyB;MACrB,MAAMS,aAAa,GAAG,MAAMlB,iBAAiB,CAACU,gBAAlB,CAAmC;QAAED;MAAF,CAAnC,CAA5B;MAEA,MAAMH,2BAA2B,CAACU,OAA5B,CAAoC;QAAEE;MAAF,CAApC,CAAN;MAEA,MAAMlB,iBAAiB,CAACwB,mBAAlB,CAAsC;QAAEf;MAAF,CAAtC,CAAN;MAEA,MAAMF,0BAA0B,CAACS,OAA3B,CAAmC;QAAEE;MAAF,CAAnC,CAAN;MAEA,OAAO,IAAP;IACH,CAzCE;;IA0CH;AACR;AACA;IACQjB,2BA7CG;IA8CHE,0BA9CG;IA+CHC,2BA/CG;IAgDHC,0BAhDG;IAiDHC,2BAjDG;IAkDHC;EAlDG,CAAP;AAoDH"}
@@ -0,0 +1,2 @@
1
+ import { ApwCommentCrud, CreateApwParams } from "../types";
2
+ export declare function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCommentMethods = createCommentMethods;
7
+
8
+ var _pubsub = require("@webiny/pubsub");
9
+
10
+ function createCommentMethods({
11
+ storageOperations
12
+ }) {
13
+ const onBeforeCommentCreate = (0, _pubsub.createTopic)();
14
+ const onAfterCommentCreate = (0, _pubsub.createTopic)();
15
+ const onBeforeCommentUpdate = (0, _pubsub.createTopic)();
16
+ const onAfterCommentUpdate = (0, _pubsub.createTopic)();
17
+ const onBeforeCommentDelete = (0, _pubsub.createTopic)();
18
+ const onAfterCommentDelete = (0, _pubsub.createTopic)();
19
+ return {
20
+ /**
21
+ * Lifecycle events
22
+ */
23
+ onBeforeCommentCreate,
24
+ onAfterCommentCreate,
25
+ onBeforeCommentUpdate,
26
+ onAfterCommentUpdate,
27
+ onBeforeCommentDelete,
28
+ onAfterCommentDelete,
29
+
30
+ async get(id) {
31
+ return storageOperations.getComment({
32
+ id
33
+ });
34
+ },
35
+
36
+ async list(params) {
37
+ return storageOperations.listComments(params);
38
+ },
39
+
40
+ async create(data) {
41
+ await onBeforeCommentCreate.publish({
42
+ input: data
43
+ });
44
+ const comment = await storageOperations.createComment({
45
+ data
46
+ });
47
+ await onAfterCommentCreate.publish({
48
+ comment
49
+ });
50
+ return comment;
51
+ },
52
+
53
+ async update(id, data) {
54
+ const original = await storageOperations.getComment({
55
+ id
56
+ });
57
+ await onBeforeCommentUpdate.publish({
58
+ original,
59
+ input: {
60
+ id,
61
+ data
62
+ }
63
+ });
64
+ const comment = await storageOperations.updateComment({
65
+ id,
66
+ data
67
+ });
68
+ await onAfterCommentUpdate.publish({
69
+ original,
70
+ comment,
71
+ input: {
72
+ id,
73
+ data
74
+ }
75
+ });
76
+ return comment;
77
+ },
78
+
79
+ async delete(id) {
80
+ const comment = await storageOperations.getComment({
81
+ id
82
+ });
83
+ await onBeforeCommentDelete.publish({
84
+ comment
85
+ });
86
+ await storageOperations.deleteComment({
87
+ id
88
+ });
89
+ await onAfterCommentDelete.publish({
90
+ comment
91
+ });
92
+ return true;
93
+ }
94
+
95
+ };
96
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCommentMethods","storageOperations","onBeforeCommentCreate","createTopic","onAfterCommentCreate","onBeforeCommentUpdate","onAfterCommentUpdate","onBeforeCommentDelete","onAfterCommentDelete","get","id","getComment","list","params","listComments","create","data","publish","input","comment","createComment","update","original","updateComment","delete","deleteComment"],"sources":["createCommentMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwCommentCrud,\n CreateApwParams,\n OnBeforeCommentCreateTopicParams,\n OnAfterCommentCreateTopicParams,\n OnBeforeCommentUpdateTopicParams,\n OnAfterCommentUpdateTopicParams,\n OnBeforeCommentDeleteTopicParams,\n OnAfterCommentDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n const onBeforeCommentCreate = createTopic<OnBeforeCommentCreateTopicParams>();\n const onAfterCommentCreate = createTopic<OnAfterCommentCreateTopicParams>();\n const onBeforeCommentUpdate = createTopic<OnBeforeCommentUpdateTopicParams>();\n const onAfterCommentUpdate = createTopic<OnAfterCommentUpdateTopicParams>();\n const onBeforeCommentDelete = createTopic<OnBeforeCommentDeleteTopicParams>();\n const onAfterCommentDelete = createTopic<OnAfterCommentDeleteTopicParams>();\n\n return {\n /**\n * Lifecycle events\n */\n onBeforeCommentCreate,\n onAfterCommentCreate,\n onBeforeCommentUpdate,\n onAfterCommentUpdate,\n onBeforeCommentDelete,\n onAfterCommentDelete,\n async get(id) {\n return storageOperations.getComment({ id });\n },\n async list(params) {\n return storageOperations.listComments(params);\n },\n async create(data) {\n await onBeforeCommentCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onAfterCommentCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onBeforeCommentUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onAfterCommentUpdate.publish({ original, comment, input: { id, data } });\n\n return comment;\n },\n async delete(id: string) {\n const comment = await storageOperations.getComment({ id });\n\n await onBeforeCommentDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onAfterCommentDelete.publish({ comment });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,oBAAT,CAA8B;EAAEC;AAAF,CAA9B,EAAsF;EACzF,MAAMC,qBAAqB,GAAG,IAAAC,mBAAA,GAA9B;EACA,MAAMC,oBAAoB,GAAG,IAAAD,mBAAA,GAA7B;EACA,MAAME,qBAAqB,GAAG,IAAAF,mBAAA,GAA9B;EACA,MAAMG,oBAAoB,GAAG,IAAAH,mBAAA,GAA7B;EACA,MAAMI,qBAAqB,GAAG,IAAAJ,mBAAA,GAA9B;EACA,MAAMK,oBAAoB,GAAG,IAAAL,mBAAA,GAA7B;EAEA,OAAO;IACH;AACR;AACA;IACQD,qBAJG;IAKHE,oBALG;IAMHC,qBANG;IAOHC,oBAPG;IAQHC,qBARG;IASHC,oBATG;;IAUH,MAAMC,GAAN,CAAUC,EAAV,EAAc;MACV,OAAOT,iBAAiB,CAACU,UAAlB,CAA6B;QAAED;MAAF,CAA7B,CAAP;IACH,CAZE;;IAaH,MAAME,IAAN,CAAWC,MAAX,EAAmB;MACf,OAAOZ,iBAAiB,CAACa,YAAlB,CAA+BD,MAA/B,CAAP;IACH,CAfE;;IAgBH,MAAME,MAAN,CAAaC,IAAb,EAAmB;MACf,MAAMd,qBAAqB,CAACe,OAAtB,CAA8B;QAAEC,KAAK,EAAEF;MAAT,CAA9B,CAAN;MAEA,MAAMG,OAAO,GAAG,MAAMlB,iBAAiB,CAACmB,aAAlB,CAAgC;QAClDJ;MADkD,CAAhC,CAAtB;MAGA,MAAMZ,oBAAoB,CAACa,OAArB,CAA6B;QAAEE;MAAF,CAA7B,CAAN;MAEA,OAAOA,OAAP;IACH,CAzBE;;IA0BH,MAAME,MAAN,CAAaX,EAAb,EAAiBM,IAAjB,EAAuB;MACnB,MAAMM,QAAQ,GAAG,MAAMrB,iBAAiB,CAACU,UAAlB,CAA6B;QAAED;MAAF,CAA7B,CAAvB;MAEA,MAAML,qBAAqB,CAACY,OAAtB,CAA8B;QAAEK,QAAF;QAAYJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN;MAAnB,CAA9B,CAAN;MAEA,MAAMG,OAAO,GAAG,MAAMlB,iBAAiB,CAACsB,aAAlB,CAAgC;QAAEb,EAAF;QAAMM;MAAN,CAAhC,CAAtB;MAEA,MAAMV,oBAAoB,CAACW,OAArB,CAA6B;QAAEK,QAAF;QAAYH,OAAZ;QAAqBD,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN;MAA5B,CAA7B,CAAN;MAEA,OAAOG,OAAP;IACH,CApCE;;IAqCH,MAAMK,MAAN,CAAad,EAAb,EAAyB;MACrB,MAAMS,OAAO,GAAG,MAAMlB,iBAAiB,CAACU,UAAlB,CAA6B;QAAED;MAAF,CAA7B,CAAtB;MAEA,MAAMH,qBAAqB,CAACU,OAAtB,CAA8B;QAAEE;MAAF,CAA9B,CAAN;MAEA,MAAMlB,iBAAiB,CAACwB,aAAlB,CAAgC;QAAEf;MAAF,CAAhC,CAAN;MAEA,MAAMF,oBAAoB,CAACS,OAArB,CAA6B;QAAEE;MAAF,CAA7B,CAAN;MAEA,OAAO,IAAP;IACH;;EA/CE,CAAP;AAiDH"}
@@ -0,0 +1,10 @@
1
+ import { AdvancedPublishingWorkflow, ApwContentReviewCrud, ApwReviewerCrud, CreateApwParams } from "../types";
2
+ import { PluginsContainer } from "@webiny/plugins";
3
+ export interface CreateContentReviewMethodsParams extends CreateApwParams {
4
+ getReviewer: ApwReviewerCrud["get"];
5
+ getContentGetter: AdvancedPublishingWorkflow["getContentGetter"];
6
+ getContentPublisher: AdvancedPublishingWorkflow["getContentPublisher"];
7
+ getContentUnPublisher: AdvancedPublishingWorkflow["getContentUnPublisher"];
8
+ plugins: PluginsContainer;
9
+ }
10
+ export declare function createContentReviewMethods(params: CreateContentReviewMethodsParams): ApwContentReviewCrud;