@webiny/api-apw 0.0.0-unstable.1e66d121db

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 (232) 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 +98 -0
  8. package/crud/createChangeRequestMethods.js.map +1 -0
  9. package/crud/createCommentMethods.d.ts +2 -0
  10. package/crud/createCommentMethods.js +99 -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 +99 -0
  17. package/crud/createReviewerMethods.js.map +1 -0
  18. package/crud/createWorkflowMethods.d.ts +2 -0
  19. package/crud/createWorkflowMethods.js +118 -0
  20. package/crud/createWorkflowMethods.js.map +1 -0
  21. package/crud/index.d.ts +2 -0
  22. package/crud/index.js +96 -0
  23. package/crud/index.js.map +1 -0
  24. package/crud/utils.d.ts +21 -0
  25. package/crud/utils.js +138 -0
  26. package/crud/utils.js.map +1 -0
  27. package/index.d.ts +4 -0
  28. package/index.js +36 -0
  29. package/index.js.map +1 -0
  30. package/package.json +76 -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 +46 -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 +97 -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 +207 -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 +71 -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 +86 -0
  91. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -0
  92. package/plugins/hooks/listContentReviews.d.ts +10 -0
  93. package/plugins/hooks/listContentReviews.js +80 -0
  94. package/plugins/hooks/listContentReviews.js.map +1 -0
  95. package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
  96. package/plugins/hooks/updatePendingChangeRequests.js +94 -0
  97. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -0
  98. package/plugins/hooks/updateTotalComments.d.ts +3 -0
  99. package/plugins/hooks/updateTotalComments.js +153 -0
  100. package/plugins/hooks/updateTotalComments.js.map +1 -0
  101. package/plugins/hooks/validateChangeRequest.d.ts +2 -0
  102. package/plugins/hooks/validateChangeRequest.js +64 -0
  103. package/plugins/hooks/validateChangeRequest.js.map +1 -0
  104. package/plugins/hooks/validateComment.d.ts +2 -0
  105. package/plugins/hooks/validateComment.js +47 -0
  106. package/plugins/hooks/validateComment.js.map +1 -0
  107. package/plugins/hooks/validateContentReview.d.ts +2 -0
  108. package/plugins/hooks/validateContentReview.js +38 -0
  109. package/plugins/hooks/validateContentReview.js.map +1 -0
  110. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
  111. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
  112. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
  113. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
  114. package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
  115. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
  116. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +3 -0
  117. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +25 -0
  118. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
  119. package/plugins/pageBuilder/index.d.ts +11 -0
  120. package/plugins/pageBuilder/index.js +45 -0
  121. package/plugins/pageBuilder/index.js.map +1 -0
  122. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
  123. package/plugins/pageBuilder/linkContentReviewToPage.js +105 -0
  124. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
  125. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
  126. package/plugins/pageBuilder/linkWorkflowToPage.js +194 -0
  127. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
  128. package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
  129. package/plugins/pageBuilder/triggerContentReview.js +50 -0
  130. package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
  131. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
  132. package/plugins/pageBuilder/updateContentReviewStatus.js +79 -0
  133. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
  134. package/plugins/pageBuilder/utils.d.ts +22 -0
  135. package/plugins/pageBuilder/utils.js +184 -0
  136. package/plugins/pageBuilder/utils.js.map +1 -0
  137. package/plugins/utils.d.ts +36 -0
  138. package/plugins/utils.js +193 -0
  139. package/plugins/utils.js.map +1 -0
  140. package/scheduler/createScheduleActionMethods.d.ts +2 -0
  141. package/scheduler/createScheduleActionMethods.js +149 -0
  142. package/scheduler/createScheduleActionMethods.js.map +1 -0
  143. package/scheduler/handlers/executeAction/index.d.ts +13 -0
  144. package/scheduler/handlers/executeAction/index.js +172 -0
  145. package/scheduler/handlers/executeAction/index.js.map +1 -0
  146. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
  147. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
  148. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
  149. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
  150. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
  151. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
  152. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
  153. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
  154. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
  155. package/scheduler/handlers/executeAction/security.d.ts +4 -0
  156. package/scheduler/handlers/executeAction/security.js +68 -0
  157. package/scheduler/handlers/executeAction/security.js.map +1 -0
  158. package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
  159. package/scheduler/handlers/scheduleAction/index.js +164 -0
  160. package/scheduler/handlers/scheduleAction/index.js.map +1 -0
  161. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
  162. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +172 -0
  163. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
  164. package/scheduler/handlers/utils.d.ts +33 -0
  165. package/scheduler/handlers/utils.js +168 -0
  166. package/scheduler/handlers/utils.js.map +1 -0
  167. package/scheduler/index.d.ts +2 -0
  168. package/scheduler/index.js +27 -0
  169. package/scheduler/index.js.map +1 -0
  170. package/scheduler/types.d.ts +171 -0
  171. package/scheduler/types.js +34 -0
  172. package/scheduler/types.js.map +1 -0
  173. package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
  174. package/storageOperations/changeRequestStorageOperations.js +122 -0
  175. package/storageOperations/changeRequestStorageOperations.js.map +1 -0
  176. package/storageOperations/commentStorageOperations.d.ts +3 -0
  177. package/storageOperations/commentStorageOperations.js +138 -0
  178. package/storageOperations/commentStorageOperations.js.map +1 -0
  179. package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
  180. package/storageOperations/contentReviewStorageOperations.js +93 -0
  181. package/storageOperations/contentReviewStorageOperations.js.map +1 -0
  182. package/storageOperations/index.d.ts +15 -0
  183. package/storageOperations/index.js +48 -0
  184. package/storageOperations/index.js.map +1 -0
  185. package/storageOperations/models/changeRequest.model.d.ts +3 -0
  186. package/storageOperations/models/changeRequest.model.js +59 -0
  187. package/storageOperations/models/changeRequest.model.js.map +1 -0
  188. package/storageOperations/models/comment.model.d.ts +7 -0
  189. package/storageOperations/models/comment.model.js +60 -0
  190. package/storageOperations/models/comment.model.js.map +1 -0
  191. package/storageOperations/models/contentModelPluginFactory.d.ts +15 -0
  192. package/storageOperations/models/contentModelPluginFactory.js +28 -0
  193. package/storageOperations/models/contentModelPluginFactory.js.map +1 -0
  194. package/storageOperations/models/contentReview.model.d.ts +7 -0
  195. package/storageOperations/models/contentReview.model.js +258 -0
  196. package/storageOperations/models/contentReview.model.js.map +1 -0
  197. package/storageOperations/models/index.d.ts +2 -0
  198. package/storageOperations/models/index.js +115 -0
  199. package/storageOperations/models/index.js.map +1 -0
  200. package/storageOperations/models/reviewer.model.d.ts +3 -0
  201. package/storageOperations/models/reviewer.model.js +55 -0
  202. package/storageOperations/models/reviewer.model.js.map +1 -0
  203. package/storageOperations/models/utils.d.ts +3 -0
  204. package/storageOperations/models/utils.js +37 -0
  205. package/storageOperations/models/utils.js.map +1 -0
  206. package/storageOperations/models/workflow.model.d.ts +12 -0
  207. package/storageOperations/models/workflow.model.js +208 -0
  208. package/storageOperations/models/workflow.model.js.map +1 -0
  209. package/storageOperations/reviewerStorageOperations.d.ts +3 -0
  210. package/storageOperations/reviewerStorageOperations.js +89 -0
  211. package/storageOperations/reviewerStorageOperations.js.map +1 -0
  212. package/storageOperations/types.d.ts +34 -0
  213. package/storageOperations/types.js +5 -0
  214. package/storageOperations/types.js.map +1 -0
  215. package/storageOperations/workflowStorageOperations.d.ts +3 -0
  216. package/storageOperations/workflowStorageOperations.js +109 -0
  217. package/storageOperations/workflowStorageOperations.js.map +1 -0
  218. package/types.d.ts +740 -0
  219. package/types.js +69 -0
  220. package/types.js.map +1 -0
  221. package/utils/contentApwSettingsPlugin.d.ts +9 -0
  222. package/utils/contentApwSettingsPlugin.js +26 -0
  223. package/utils/contentApwSettingsPlugin.js.map +1 -0
  224. package/utils/errors.d.ts +16 -0
  225. package/utils/errors.js +75 -0
  226. package/utils/errors.js.map +1 -0
  227. package/utils/fieldResolver.d.ts +16 -0
  228. package/utils/fieldResolver.js +54 -0
  229. package/utils/fieldResolver.js.map +1 -0
  230. package/utils/resolve.d.ts +3 -0
  231. package/utils/resolve.js +18 -0
  232. 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").default;
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,98 @@
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
+ // create
14
+ const onChangeRequestBeforeCreate = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeCreate");
15
+ const onChangeRequestAfterCreate = (0, _pubsub.createTopic)("apw.onChangeRequestAfterCreate"); // update
16
+
17
+ const onChangeRequestBeforeUpdate = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeUpdate");
18
+ const onChangeRequestAfterUpdate = (0, _pubsub.createTopic)("apw.onChangeRequestAfterUpdate"); // delete
19
+
20
+ const onChangeRequestBeforeDelete = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeDelete");
21
+ const onChangeRequestAfterDelete = (0, _pubsub.createTopic)("apw.onChangeRequestAfterDelete");
22
+ return {
23
+ async get(id) {
24
+ return storageOperations.getChangeRequest({
25
+ id
26
+ });
27
+ },
28
+
29
+ async list(params) {
30
+ return storageOperations.listChangeRequests(params);
31
+ },
32
+
33
+ async create(data) {
34
+ await onChangeRequestBeforeCreate.publish({
35
+ input: data
36
+ });
37
+ const changeRequest = await storageOperations.createChangeRequest({
38
+ data
39
+ });
40
+ await onChangeRequestAfterCreate.publish({
41
+ changeRequest
42
+ });
43
+ return changeRequest;
44
+ },
45
+
46
+ async update(id, data) {
47
+ const original = await storageOperations.getChangeRequest({
48
+ id
49
+ });
50
+ await onChangeRequestBeforeUpdate.publish({
51
+ original,
52
+ input: {
53
+ id,
54
+ data
55
+ }
56
+ });
57
+ const changeRequest = await storageOperations.updateChangeRequest({
58
+ id,
59
+ data
60
+ });
61
+ await onChangeRequestAfterUpdate.publish({
62
+ original,
63
+ input: {
64
+ id,
65
+ data
66
+ },
67
+ changeRequest
68
+ });
69
+ return changeRequest;
70
+ },
71
+
72
+ async delete(id) {
73
+ const changeRequest = await storageOperations.getChangeRequest({
74
+ id
75
+ });
76
+ await onChangeRequestBeforeDelete.publish({
77
+ changeRequest
78
+ });
79
+ await storageOperations.deleteChangeRequest({
80
+ id
81
+ });
82
+ await onChangeRequestAfterDelete.publish({
83
+ changeRequest
84
+ });
85
+ return true;
86
+ },
87
+
88
+ /**
89
+ * Lifecycle events
90
+ */
91
+ onChangeRequestBeforeCreate,
92
+ onChangeRequestAfterCreate,
93
+ onChangeRequestBeforeUpdate,
94
+ onChangeRequestAfterUpdate,
95
+ onChangeRequestBeforeDelete,
96
+ onChangeRequestAfterDelete
97
+ };
98
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createChangeRequestMethods","storageOperations","onChangeRequestBeforeCreate","createTopic","onChangeRequestAfterCreate","onChangeRequestBeforeUpdate","onChangeRequestAfterUpdate","onChangeRequestBeforeDelete","onChangeRequestAfterDelete","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 OnChangeRequestAfterCreateTopicParams,\n OnChangeRequestAfterDeleteTopicParams,\n OnChangeRequestAfterUpdateTopicParams,\n OnChangeRequestBeforeCreateTopicParams,\n OnChangeRequestBeforeDeleteTopicParams,\n OnChangeRequestBeforeUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n // create\n const onChangeRequestBeforeCreate = createTopic<OnChangeRequestBeforeCreateTopicParams>(\n \"apw.onChangeRequestBeforeCreate\"\n );\n const onChangeRequestAfterCreate = createTopic<OnChangeRequestAfterCreateTopicParams>(\n \"apw.onChangeRequestAfterCreate\"\n );\n // update\n const onChangeRequestBeforeUpdate = createTopic<OnChangeRequestBeforeUpdateTopicParams>(\n \"apw.onChangeRequestBeforeUpdate\"\n );\n const onChangeRequestAfterUpdate = createTopic<OnChangeRequestAfterUpdateTopicParams>(\n \"apw.onChangeRequestAfterUpdate\"\n );\n // delete\n const onChangeRequestBeforeDelete = createTopic<OnChangeRequestBeforeDeleteTopicParams>(\n \"apw.onChangeRequestBeforeDelete\"\n );\n const onChangeRequestAfterDelete = createTopic<OnChangeRequestAfterDeleteTopicParams>(\n \"apw.onChangeRequestAfterDelete\"\n );\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 onChangeRequestBeforeCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onChangeRequestAfterCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onChangeRequestAfterUpdate.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 onChangeRequestBeforeDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onChangeRequestAfterDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate,\n onChangeRequestAfterCreate,\n onChangeRequestBeforeUpdate,\n onChangeRequestAfterUpdate,\n onChangeRequestBeforeDelete,\n onChangeRequestAfterDelete\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,0BAAT,CAAoC;EACvCC;AADuC,CAApC,EAEmC;EACtC;EACA,MAAMC,2BAA2B,GAAG,IAAAC,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMC,0BAA0B,GAAG,IAAAD,mBAAA,EAC/B,gCAD+B,CAAnC,CALsC,CAQtC;;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMG,0BAA0B,GAAG,IAAAH,mBAAA,EAC/B,g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ACH,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,99 @@
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
+ // create
14
+ const onCommentBeforeCreate = (0, _pubsub.createTopic)("apw.onCommentBeforeCreate");
15
+ const onCommentAfterCreate = (0, _pubsub.createTopic)("apw.onCommentAfterCreate"); // update
16
+
17
+ const onCommentBeforeUpdate = (0, _pubsub.createTopic)("apw.onCommentBeforeUpdate");
18
+ const onCommentAfterUpdate = (0, _pubsub.createTopic)("apw.onCommentAfterUpdate"); // delete
19
+
20
+ const onCommentBeforeDelete = (0, _pubsub.createTopic)("apw.onCommentBeforeDelete");
21
+ const onCommentAfterDelete = (0, _pubsub.createTopic)("apw.onCommentAfterDelete");
22
+ return {
23
+ /**
24
+ * Lifecycle events
25
+ */
26
+ onCommentBeforeCreate,
27
+ onCommentAfterCreate,
28
+ onCommentBeforeUpdate,
29
+ onCommentAfterUpdate,
30
+ onCommentBeforeDelete,
31
+ onCommentAfterDelete,
32
+
33
+ async get(id) {
34
+ return storageOperations.getComment({
35
+ id
36
+ });
37
+ },
38
+
39
+ async list(params) {
40
+ return storageOperations.listComments(params);
41
+ },
42
+
43
+ async create(data) {
44
+ await onCommentBeforeCreate.publish({
45
+ input: data
46
+ });
47
+ const comment = await storageOperations.createComment({
48
+ data
49
+ });
50
+ await onCommentAfterCreate.publish({
51
+ comment
52
+ });
53
+ return comment;
54
+ },
55
+
56
+ async update(id, data) {
57
+ const original = await storageOperations.getComment({
58
+ id
59
+ });
60
+ await onCommentBeforeUpdate.publish({
61
+ original,
62
+ input: {
63
+ id,
64
+ data
65
+ }
66
+ });
67
+ const comment = await storageOperations.updateComment({
68
+ id,
69
+ data
70
+ });
71
+ await onCommentAfterUpdate.publish({
72
+ original,
73
+ comment,
74
+ input: {
75
+ id,
76
+ data
77
+ }
78
+ });
79
+ return comment;
80
+ },
81
+
82
+ async delete(id) {
83
+ const comment = await storageOperations.getComment({
84
+ id
85
+ });
86
+ await onCommentBeforeDelete.publish({
87
+ comment
88
+ });
89
+ await storageOperations.deleteComment({
90
+ id
91
+ });
92
+ await onCommentAfterDelete.publish({
93
+ comment
94
+ });
95
+ return true;
96
+ }
97
+
98
+ };
99
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCommentMethods","storageOperations","onCommentBeforeCreate","createTopic","onCommentAfterCreate","onCommentBeforeUpdate","onCommentAfterUpdate","onCommentBeforeDelete","onCommentAfterDelete","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 OnCommentBeforeCreateTopicParams,\n OnCommentAfterCreateTopicParams,\n OnCommentBeforeUpdateTopicParams,\n OnCommentAfterUpdateTopicParams,\n OnCommentBeforeDeleteTopicParams,\n OnCommentAfterDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n // create\n const onCommentBeforeCreate = createTopic<OnCommentBeforeCreateTopicParams>(\n \"apw.onCommentBeforeCreate\"\n );\n const onCommentAfterCreate = createTopic<OnCommentAfterCreateTopicParams>(\n \"apw.onCommentAfterCreate\"\n );\n // update\n const onCommentBeforeUpdate = createTopic<OnCommentBeforeUpdateTopicParams>(\n \"apw.onCommentBeforeUpdate\"\n );\n const onCommentAfterUpdate = createTopic<OnCommentAfterUpdateTopicParams>(\n \"apw.onCommentAfterUpdate\"\n );\n // delete\n const onCommentBeforeDelete = createTopic<OnCommentBeforeDeleteTopicParams>(\n \"apw.onCommentBeforeDelete\"\n );\n const onCommentAfterDelete = createTopic<OnCommentAfterDeleteTopicParams>(\n \"apw.onCommentAfterDelete\"\n );\n\n return {\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate,\n onCommentAfterCreate,\n onCommentBeforeUpdate,\n onCommentAfterUpdate,\n onCommentBeforeDelete,\n onCommentAfterDelete,\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 onCommentBeforeCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onCommentAfterCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onCommentBeforeUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onCommentAfterUpdate.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 onCommentBeforeDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onCommentAfterDelete.publish({ comment });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,oBAAT,CAA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vB;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;