@webiny/api-apw 5.33.5-beta.0 → 5.34.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/ApwChangeRequestNotification.d.ts +27 -0
  2. package/ApwChangeRequestNotification.js +40 -0
  3. package/ApwChangeRequestNotification.js.map +1 -0
  4. package/ApwCommentNotification.d.ts +27 -0
  5. package/ApwCommentNotification.js +40 -0
  6. package/ApwCommentNotification.js.map +1 -0
  7. package/ApwContentReviewNotification.d.ts +26 -0
  8. package/ApwContentReviewNotification.js +40 -0
  9. package/ApwContentReviewNotification.js.map +1 -0
  10. package/ApwContentUrlPlugin.d.ts +19 -0
  11. package/ApwContentUrlPlugin.js +40 -0
  12. package/ApwContentUrlPlugin.js.map +1 -0
  13. package/ContentApwSettingsPlugin.js +1 -1
  14. package/crud/createChangeRequestMethods.js +21 -18
  15. package/crud/createChangeRequestMethods.js.map +1 -1
  16. package/crud/createCommentMethods.js +21 -18
  17. package/crud/createCommentMethods.js.map +1 -1
  18. package/crud/createContentReviewMethods.js +60 -50
  19. package/crud/createContentReviewMethods.js.map +1 -1
  20. package/crud/createReviewerMethods.js +21 -18
  21. package/crud/createReviewerMethods.js.map +1 -1
  22. package/crud/createWorkflowMethods.d.ts +1 -1
  23. package/crud/createWorkflowMethods.js +42 -20
  24. package/crud/createWorkflowMethods.js.map +1 -1
  25. package/crud/index.js +3 -7
  26. package/crud/index.js.map +1 -1
  27. package/crud/utils.js +4 -8
  28. package/crud/utils.js.map +1 -1
  29. package/index.d.ts +3 -3
  30. package/index.js +8 -4
  31. package/index.js.map +1 -1
  32. package/package.json +38 -37
  33. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +1 -1
  34. package/plugins/cms/apwEntryPlugins.js +4 -8
  35. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  36. package/plugins/cms/index.js +9 -1
  37. package/plugins/cms/index.js.map +1 -1
  38. package/plugins/cms/linkContentReviewToEntry.js +4 -4
  39. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  40. package/plugins/cms/linkWorkflowToEntry.js +5 -5
  41. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  42. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  43. package/plugins/cms/notifications/changeRequestNotification.js +35 -0
  44. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  45. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  46. package/plugins/cms/notifications/commentNotification.js +35 -0
  47. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  48. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  49. package/plugins/cms/notifications/contentReviewNotification.js +35 -0
  50. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  51. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  52. package/plugins/cms/notifications/contentUrl.js +60 -0
  53. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  54. package/plugins/cms/triggerContentReview.js +3 -3
  55. package/plugins/cms/triggerContentReview.js.map +1 -1
  56. package/plugins/cms/updateContentReviewStatus.js +10 -14
  57. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  58. package/plugins/cms/utils.js +4 -8
  59. package/plugins/cms/utils.js.map +1 -1
  60. package/plugins/context.js +1 -1
  61. package/plugins/graphql/changeRequest.gql.js +1 -1
  62. package/plugins/graphql/comment.gql.js +1 -1
  63. package/plugins/graphql/contentReview.gql.js +4 -4
  64. package/plugins/graphql/contentReview.gql.js.map +1 -1
  65. package/plugins/graphql/reviewer.gql.js +3 -1
  66. package/plugins/graphql/reviewer.gql.js.map +1 -1
  67. package/plugins/graphql/workflow.gql.js +1 -1
  68. package/plugins/graphql.js +1 -1
  69. package/plugins/hooks/createReviewerFromIdentity.js +28 -8
  70. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  71. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -1
  72. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  73. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -1
  74. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  75. package/plugins/hooks/index.js +6 -0
  76. package/plugins/hooks/index.js.map +1 -1
  77. package/plugins/hooks/initializeContentReviewSteps.js +5 -8
  78. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  79. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  80. package/plugins/hooks/initializeNotifications.js +20 -0
  81. package/plugins/hooks/initializeNotifications.js.map +1 -0
  82. package/plugins/hooks/listContentReviews.d.ts +10 -0
  83. package/plugins/hooks/listContentReviews.js +68 -0
  84. package/plugins/hooks/listContentReviews.js.map +1 -0
  85. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  86. package/plugins/hooks/notifications/appUrl.js +22 -0
  87. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  88. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  89. package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
  90. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  91. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  92. package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
  93. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  94. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  95. package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
  96. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  97. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  98. package/plugins/hooks/notifications/commentUrl.js +31 -0
  99. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  100. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  101. package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
  102. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  103. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  104. package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
  105. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  106. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  107. package/plugins/hooks/notifications/contentUrl.js +29 -0
  108. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  109. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  110. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
  111. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  112. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  113. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
  114. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  115. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  116. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
  117. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  118. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  119. package/plugins/hooks/notifications/reviewers.js +51 -0
  120. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  121. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  122. package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
  123. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  124. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  125. package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
  126. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  127. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  128. package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
  129. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  130. package/plugins/hooks/updatePendingChangeRequests.js +7 -11
  131. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  132. package/plugins/hooks/updateTotalComments.js +14 -18
  133. package/plugins/hooks/updateTotalComments.js.map +1 -1
  134. package/plugins/hooks/validateChangeRequest.js +30 -5
  135. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  136. package/plugins/hooks/validateComment.js +14 -4
  137. package/plugins/hooks/validateComment.js.map +1 -1
  138. package/plugins/hooks/validateContentReview.js +2 -2
  139. package/plugins/hooks/validateContentReview.js.map +1 -1
  140. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +1 -1
  141. package/plugins/pageBuilder/index.js +9 -1
  142. package/plugins/pageBuilder/index.js.map +1 -1
  143. package/plugins/pageBuilder/linkContentReviewToPage.js +41 -29
  144. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  145. package/plugins/pageBuilder/linkWorkflowToPage.js +18 -6
  146. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  147. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  148. package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
  149. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  150. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  151. package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
  152. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  153. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  154. package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
  155. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  156. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  157. package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
  158. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  159. package/plugins/pageBuilder/triggerContentReview.js +3 -3
  160. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  161. package/plugins/pageBuilder/updateContentReviewStatus.js +10 -14
  162. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  163. package/plugins/pageBuilder/utils.js +1 -1
  164. package/plugins/pageBuilder/utils.js.map +1 -1
  165. package/plugins/utils.d.ts +1 -1
  166. package/plugins/utils.js +4 -14
  167. package/plugins/utils.js.map +1 -1
  168. package/scheduler/createScheduleActionMethods.js +17 -14
  169. package/scheduler/createScheduleActionMethods.js.map +1 -1
  170. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +1 -1
  171. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -1
  172. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +1 -1
  173. package/scheduler/handlers/scheduleAction/index.js +8 -9
  174. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  175. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +5 -9
  176. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  177. package/scheduler/handlers/utils.js +1 -1
  178. package/storageOperations/changeRequestStorageOperations.js +5 -9
  179. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  180. package/storageOperations/commentStorageOperations.js +4 -8
  181. package/storageOperations/commentStorageOperations.js.map +1 -1
  182. package/storageOperations/contentReviewStorageOperations.js +5 -9
  183. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  184. package/storageOperations/index.js +5 -9
  185. package/storageOperations/index.js.map +1 -1
  186. package/storageOperations/models/contentModelPluginFactory.js +3 -7
  187. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  188. package/storageOperations/models/contentReview.model.js +6 -5
  189. package/storageOperations/models/contentReview.model.js.map +1 -1
  190. package/storageOperations/models/index.js +1 -1
  191. package/storageOperations/models/reviewer.model.js +18 -2
  192. package/storageOperations/models/reviewer.model.js.map +1 -1
  193. package/storageOperations/models/utils.js +3 -2
  194. package/storageOperations/models/utils.js.map +1 -1
  195. package/storageOperations/reviewerStorageOperations.js +18 -14
  196. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  197. package/storageOperations/workflowStorageOperations.js +8 -12
  198. package/storageOperations/workflowStorageOperations.js.map +1 -1
  199. package/types.d.ts +99 -84
  200. package/types.js.map +1 -1
  201. package/utils/errors.js +1 -1
  202. package/utils/fieldResolver.js +3 -9
  203. package/utils/fieldResolver.js.map +1 -1
@@ -1,22 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.getTransformer = exports.getFieldValues = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
 
12
12
  var _pick = _interopRequireDefault(require("lodash/pick"));
13
13
 
14
14
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
15
15
 
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
-
20
16
  const getFieldValues = async params => {
21
17
  const {
22
18
  entry,
@@ -24,13 +20,11 @@ const getFieldValues = async params => {
24
20
  transformers = [],
25
21
  fields
26
22
  } = params;
27
-
28
- const values = _objectSpread(_objectSpread({}, (0, _pick.default)(entry, fields)), entry.values);
23
+ const values = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
29
24
  /**
30
25
  * Transform field value for each transformers.
31
26
  */
32
27
 
33
-
34
28
  for (const transformer of transformers) {
35
29
  const {
36
30
  fieldId,
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldValues","params","entry","context","transformers","fields","values","pick","transformer","fieldId","model","field","entryFieldFromStorageTransform","value","getTransformer","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { ApwBaseFields } from \"~/types\";\n\ninterface Transformer {\n fieldId: keyof ApwBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends ApwBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [], fields } = params;\n const values = {\n ...pick(entry, fields),\n ...entry.values\n } as T;\n /**\n * Transform field value for each transformers.\n */\n for (const transformer of transformers) {\n const { fieldId, model, field } = transformer;\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof ApwBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;AAgBO,MAAMA,cAAc,GAAG,MAC1BC,MAD0B,IAEb;EACb,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC,YAAY,GAAG,EAAjC;IAAqCC;EAArC,IAAgDJ,MAAtD;;EACA,MAAMK,MAAM,mCACL,IAAAC,aAAA,EAAKL,KAAL,EAAYG,MAAZ,CADK,GAELH,KAAK,CAACI,MAFD,CAAZ;EAIA;AACJ;AACA;;;EACI,KAAK,MAAME,WAAX,IAA0BJ,YAA1B,EAAwC;IACpC,MAAM;MAAEK,OAAF;MAAWC,KAAX;MAAkBC;IAAlB,IAA4BH,WAAlC,CADoC,CAEpC;;IACAF,MAAM,CAACG,OAAD,CAAN,GAAkB,MAAM,IAAAG,8CAAA,EAA+B;MACnDT,OADmD;MAEnDO,KAFmD;MAGnDC,KAHmD;MAInDE,KAAK,EAAEP,MAAM,CAACG,OAAD;IAJsC,CAA/B,CAAxB;EAMH;;EAED,OAAOH,MAAP;AACH,CAvBM;;;;AAyBA,MAAMQ,cAAc,GAAG,CAACJ,KAAD,EAAkBD,OAAlB,MAAoD;EAC9EA,OAAO,EAAEA,OADqE;EAE9EC,KAAK,EAAEA,KAFuE;EAG9EC,KAAK,EAAED,KAAK,CAACL,MAAN,CAAaU,IAAb,CAAkBJ,KAAK,IAAIA,KAAK,CAACF,OAAN,KAAkBA,OAA7C;AAHuE,CAApD,CAAvB"}
1
+ {"version":3,"names":["getFieldValues","params","entry","context","transformers","fields","values","pick","transformer","fieldId","model","field","entryFieldFromStorageTransform","value","getTransformer","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { ApwBaseFields } from \"~/types\";\n\ninterface Transformer {\n fieldId: keyof ApwBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends ApwBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [], fields } = params;\n const values = {\n ...pick(entry, fields),\n ...entry.values\n } as T;\n /**\n * Transform field value for each transformers.\n */\n for (const transformer of transformers) {\n const { fieldId, model, field } = transformer;\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof ApwBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AAgBO,MAAMA,cAAc,GAAG,MAC1BC,MAD0B,IAEb;EACb,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC,YAAY,GAAG,EAAjC;IAAqCC;EAArC,IAAgDJ,MAAtD;EACA,MAAMK,MAAM,+DACL,IAAAC,aAAA,EAAKL,KAAL,EAAYG,MAAZ,CADK,GAELH,KAAK,CAACI,MAFD,CAAZ;EAIA;AACJ;AACA;;EACI,KAAK,MAAME,WAAX,IAA0BJ,YAA1B,EAAwC;IACpC,MAAM;MAAEK,OAAF;MAAWC,KAAX;MAAkBC;IAAlB,IAA4BH,WAAlC,CADoC,CAEpC;;IACAF,MAAM,CAACG,OAAD,CAAN,GAAkB,MAAM,IAAAG,8CAAA,EAA+B;MACnDT,OADmD;MAEnDO,KAFmD;MAGnDC,KAHmD;MAInDE,KAAK,EAAEP,MAAM,CAACG,OAAD;IAJsC,CAA/B,CAAxB;EAMH;;EAED,OAAOH,MAAP;AACH,CAvBM;;;;AAyBA,MAAMQ,cAAc,GAAG,CAACJ,KAAD,EAAkBD,OAAlB,MAAoD;EAC9EA,OAAO,EAAEA,OADqE;EAE9EC,KAAK,EAAEA,KAFuE;EAG9EC,KAAK,EAAED,KAAK,CAACL,MAAN,CAAaU,IAAb,CAAkBJ,KAAK,IAAIA,KAAK,CAACF,OAAN,KAAkBA,OAA7C;AAHuE,CAApD,CAAvB"}