@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.40876133bb

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 (118) 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/crud/createContentReviewMethods.js +15 -5
  14. package/crud/createContentReviewMethods.js.map +1 -1
  15. package/index.d.ts +3 -3
  16. package/index.js +5 -3
  17. package/index.js.map +1 -1
  18. package/package.json +32 -32
  19. package/plugins/cms/index.js +9 -1
  20. package/plugins/cms/index.js.map +1 -1
  21. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  22. package/plugins/cms/notifications/changeRequestNotification.js +35 -0
  23. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  24. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  25. package/plugins/cms/notifications/commentNotification.js +35 -0
  26. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  27. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  28. package/plugins/cms/notifications/contentReviewNotification.js +35 -0
  29. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  30. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  31. package/plugins/cms/notifications/contentUrl.js +60 -0
  32. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  33. package/plugins/graphql/reviewer.gql.js +2 -0
  34. package/plugins/graphql/reviewer.gql.js.map +1 -1
  35. package/plugins/hooks/createReviewerFromIdentity.js +28 -8
  36. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  37. package/plugins/hooks/index.js +3 -0
  38. package/plugins/hooks/index.js.map +1 -1
  39. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  40. package/plugins/hooks/initializeNotifications.js +20 -0
  41. package/plugins/hooks/initializeNotifications.js.map +1 -0
  42. package/plugins/hooks/listContentReviews.d.ts +1 -1
  43. package/plugins/hooks/listContentReviews.js +11 -23
  44. package/plugins/hooks/listContentReviews.js.map +1 -1
  45. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  46. package/plugins/hooks/notifications/appUrl.js +22 -0
  47. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  48. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  49. package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
  50. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  51. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  52. package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
  53. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  54. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  55. package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
  56. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  57. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  58. package/plugins/hooks/notifications/commentUrl.js +31 -0
  59. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  60. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  61. package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
  62. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  63. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  64. package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
  65. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  66. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  67. package/plugins/hooks/notifications/contentUrl.js +29 -0
  68. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  69. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  70. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
  71. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  72. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  73. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
  74. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  75. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  76. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
  77. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  78. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  79. package/plugins/hooks/notifications/reviewers.js +51 -0
  80. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  81. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  82. package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
  83. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  84. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  85. package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
  86. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  87. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  88. package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
  89. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  90. package/plugins/hooks/validateChangeRequest.js +28 -3
  91. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  92. package/plugins/hooks/validateComment.js +12 -2
  93. package/plugins/hooks/validateComment.js.map +1 -1
  94. package/plugins/pageBuilder/index.js +9 -1
  95. package/plugins/pageBuilder/index.js.map +1 -1
  96. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  97. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  98. package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
  99. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  100. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  101. package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
  102. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  103. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  104. package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
  105. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  106. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  107. package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
  108. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  109. package/plugins/pageBuilder/utils.js.map +1 -1
  110. package/plugins/utils.d.ts +0 -1
  111. package/plugins/utils.js +1 -7
  112. package/plugins/utils.js.map +1 -1
  113. package/storageOperations/models/reviewer.model.js +18 -2
  114. package/storageOperations/models/reviewer.model.js.map +1 -1
  115. package/storageOperations/reviewerStorageOperations.js +13 -5
  116. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  117. package/types.d.ts +21 -9
  118. package/types.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-apw",
3
- "version": "0.0.0-unstable.1e66d121db",
3
+ "version": "0.0.0-unstable.40876133bb",
4
4
  "keywords": [
5
5
  "apw:base"
6
6
  ],
@@ -17,43 +17,43 @@
17
17
  "@aws-sdk/client-cloudwatch-events": "3.186.0",
18
18
  "@babel/runtime": "7.19.0",
19
19
  "@commodo/fields": "1.1.2-beta.20",
20
- "@webiny/api": "0.0.0-unstable.1e66d121db",
21
- "@webiny/api-headless-cms": "0.0.0-unstable.1e66d121db",
22
- "@webiny/api-i18n": "0.0.0-unstable.1e66d121db",
23
- "@webiny/api-i18n-ddb": "0.0.0-unstable.1e66d121db",
24
- "@webiny/api-mailer": "0.0.0-unstable.1e66d121db",
25
- "@webiny/api-page-builder": "0.0.0-unstable.1e66d121db",
26
- "@webiny/api-security": "0.0.0-unstable.1e66d121db",
27
- "@webiny/api-tenancy": "0.0.0-unstable.1e66d121db",
28
- "@webiny/api-wcp": "0.0.0-unstable.1e66d121db",
29
- "@webiny/db-dynamodb": "0.0.0-unstable.1e66d121db",
30
- "@webiny/error": "0.0.0-unstable.1e66d121db",
31
- "@webiny/handler": "0.0.0-unstable.1e66d121db",
32
- "@webiny/handler-client": "0.0.0-unstable.1e66d121db",
33
- "@webiny/handler-db": "0.0.0-unstable.1e66d121db",
34
- "@webiny/handler-graphql": "0.0.0-unstable.1e66d121db",
35
- "@webiny/handler-logs": "0.0.0-unstable.1e66d121db",
36
- "@webiny/plugins": "0.0.0-unstable.1e66d121db",
37
- "@webiny/pubsub": "0.0.0-unstable.1e66d121db",
38
- "@webiny/validation": "0.0.0-unstable.1e66d121db",
20
+ "@webiny/api": "0.0.0-unstable.40876133bb",
21
+ "@webiny/api-admin-settings": "0.0.0-unstable.40876133bb",
22
+ "@webiny/api-headless-cms": "0.0.0-unstable.40876133bb",
23
+ "@webiny/api-i18n": "0.0.0-unstable.40876133bb",
24
+ "@webiny/api-i18n-ddb": "0.0.0-unstable.40876133bb",
25
+ "@webiny/api-mailer": "0.0.0-unstable.40876133bb",
26
+ "@webiny/api-page-builder": "0.0.0-unstable.40876133bb",
27
+ "@webiny/api-security": "0.0.0-unstable.40876133bb",
28
+ "@webiny/api-tenancy": "0.0.0-unstable.40876133bb",
29
+ "@webiny/api-wcp": "0.0.0-unstable.40876133bb",
30
+ "@webiny/db-dynamodb": "0.0.0-unstable.40876133bb",
31
+ "@webiny/error": "0.0.0-unstable.40876133bb",
32
+ "@webiny/handler": "0.0.0-unstable.40876133bb",
33
+ "@webiny/handler-client": "0.0.0-unstable.40876133bb",
34
+ "@webiny/handler-db": "0.0.0-unstable.40876133bb",
35
+ "@webiny/handler-graphql": "0.0.0-unstable.40876133bb",
36
+ "@webiny/handler-logs": "0.0.0-unstable.40876133bb",
37
+ "@webiny/plugins": "0.0.0-unstable.40876133bb",
38
+ "@webiny/pubsub": "0.0.0-unstable.40876133bb",
39
+ "@webiny/utils": "0.0.0-unstable.40876133bb",
40
+ "@webiny/validation": "0.0.0-unstable.40876133bb",
39
41
  "dayjs": "1.11.5",
40
42
  "lodash": "4.17.21",
41
- "mdbid": "1.0.0",
42
- "nanoid": "3.3.4"
43
+ "mdbid": "1.0.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@babel/cli": "^7.19.3",
46
47
  "@babel/core": "^7.19.3",
47
48
  "@babel/preset-env": "^7.19.4",
48
- "@babel/preset-flow": "^7.0.0",
49
- "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.1e66d121db",
50
- "@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.1e66d121db",
51
- "@webiny/api-security-so-ddb": "^0.0.0-unstable.1e66d121db",
52
- "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.1e66d121db",
53
- "@webiny/cli": "^0.0.0-unstable.1e66d121db",
54
- "@webiny/handler-aws": "^0.0.0-unstable.1e66d121db",
55
- "@webiny/project-utils": "^0.0.0-unstable.1e66d121db",
56
- "@webiny/wcp": "^0.0.0-unstable.1e66d121db",
49
+ "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.40876133bb",
50
+ "@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.40876133bb",
51
+ "@webiny/api-security-so-ddb": "^0.0.0-unstable.40876133bb",
52
+ "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.40876133bb",
53
+ "@webiny/cli": "^0.0.0-unstable.40876133bb",
54
+ "@webiny/handler-aws": "^0.0.0-unstable.40876133bb",
55
+ "@webiny/project-utils": "^0.0.0-unstable.40876133bb",
56
+ "@webiny/wcp": "^0.0.0-unstable.40876133bb",
57
57
  "get-yarn-workspaces": "^1.0.2",
58
58
  "graphql": "^15.7.2",
59
59
  "jest": "^28.1.0",
@@ -72,5 +72,5 @@
72
72
  "build": "yarn webiny run build",
73
73
  "watch": "yarn webiny run watch"
74
74
  },
75
- "gitHead": "b670bf27c5039de1a2b0be764a09ba4cb94ad5e2"
75
+ "gitHead": "f33811072795d25c5787ae39808e75e3312fb247"
76
76
  }
@@ -17,6 +17,14 @@ var _updateContentReviewStatus = require("./updateContentReviewStatus");
17
17
 
18
18
  var _CmsEntryApwSettingsGetterPlugin = require("./CmsEntryApwSettingsGetterPlugin");
19
19
 
20
+ var _commentNotification = require("./notifications/commentNotification");
21
+
22
+ var _contentUrl = require("./notifications/contentUrl");
23
+
24
+ var _changeRequestNotification = require("./notifications/changeRequestNotification");
25
+
26
+ var _contentReviewNotification = require("./notifications/contentReviewNotification");
27
+
20
28
  const apwCmsHooks = params => {
21
29
  /**
22
30
  * We do not need to assign anything if no apw or cms in the context.
@@ -26,7 +34,7 @@ const apwCmsHooks = params => {
26
34
  return;
27
35
  }
28
36
 
29
- params.plugins.register(new _CmsEntryApwSettingsGetterPlugin.CmsEntryApwSettingsGetterPlugin());
37
+ params.plugins.register([new _CmsEntryApwSettingsGetterPlugin.CmsEntryApwSettingsGetterPlugin(), (0, _commentNotification.createCommentNotification)(), (0, _changeRequestNotification.createChangeRequestNotification)(), (0, _contentUrl.createContentUrlPlugin)(), (0, _contentReviewNotification.createContentReviewNotification)()]);
30
38
  (0, _apwEntryPlugins.apwEntryPlugins)(params);
31
39
  (0, _linkContentReviewToEntry.linkContentReviewToEntry)(params);
32
40
  (0, _linkWorkflowToEntry.linkWorkflowToEntry)(params);
@@ -1 +1 @@
1
- {"version":3,"names":["apwCmsHooks","params","apw","cms","plugins","register","CmsEntryApwSettingsGetterPlugin","apwEntryPlugins","linkContentReviewToEntry","linkWorkflowToEntry","triggerContentReview","updateContentReviewStatus"],"sources":["index.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { apwEntryPlugins } from \"~/plugins/cms/apwEntryPlugins\";\nimport { linkContentReviewToEntry } from \"~/plugins/cms/linkContentReviewToEntry\";\nimport { linkWorkflowToEntry } from \"~/plugins/cms/linkWorkflowToEntry\";\nimport { triggerContentReview } from \"~/plugins/cms/triggerContentReview\";\nimport { updateContentReviewStatus } from \"~/plugins/cms/updateContentReviewStatus\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryApwSettingsGetterPlugin } from \"~/plugins/cms/CmsEntryApwSettingsGetterPlugin\";\n\ninterface ApwCmsHooksParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n plugins: PluginsContainer;\n security: Security;\n}\nexport const apwCmsHooks = (params: ApwCmsHooksParams) => {\n /**\n * We do not need to assign anything if no apw or cms in the context.\n * This might happen on options request.\n */\n if (!params.apw || !params.cms) {\n return;\n }\n\n params.plugins.register(new CmsEntryApwSettingsGetterPlugin());\n\n apwEntryPlugins(params);\n\n linkContentReviewToEntry(params);\n\n linkWorkflowToEntry(params);\n\n triggerContentReview(params);\n\n updateContentReviewStatus(params);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAQO,MAAMA,WAAW,GAAIC,MAAD,IAA+B;EACtD;AACJ;AACA;AACA;EACI,IAAI,CAACA,MAAM,CAACC,GAAR,IAAe,CAACD,MAAM,CAACE,GAA3B,EAAgC;IAC5B;EACH;;EAEDF,MAAM,CAACG,OAAP,CAAeC,QAAf,CAAwB,IAAIC,gEAAJ,EAAxB;EAEA,IAAAC,gCAAA,EAAgBN,MAAhB;EAEA,IAAAO,kDAAA,EAAyBP,MAAzB;EAEA,IAAAQ,wCAAA,EAAoBR,MAApB;EAEA,IAAAS,0CAAA,EAAqBT,MAArB;EAEA,IAAAU,oDAAA,EAA0BV,MAA1B;AACH,CApBM"}
1
+ {"version":3,"names":["apwCmsHooks","params","apw","cms","plugins","register","CmsEntryApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","apwEntryPlugins","linkContentReviewToEntry","linkWorkflowToEntry","triggerContentReview","updateContentReviewStatus"],"sources":["index.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { apwEntryPlugins } from \"./apwEntryPlugins\";\nimport { linkContentReviewToEntry } from \"./linkContentReviewToEntry\";\nimport { linkWorkflowToEntry } from \"./linkWorkflowToEntry\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryApwSettingsGetterPlugin } from \"./CmsEntryApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\ninterface ApwCmsHooksParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n plugins: PluginsContainer;\n security: Security;\n}\nexport const apwCmsHooks = (params: ApwCmsHooksParams) => {\n /**\n * We do not need to assign anything if no apw or cms in the context.\n * This might happen on options request.\n */\n if (!params.apw || !params.cms) {\n return;\n }\n\n params.plugins.register([\n new CmsEntryApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n apwEntryPlugins(params);\n\n linkContentReviewToEntry(params);\n\n linkWorkflowToEntry(params);\n\n triggerContentReview(params);\n\n updateContentReviewStatus(params);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAQO,MAAMA,WAAW,GAAIC,MAAD,IAA+B;EACtD;AACJ;AACA;AACA;EACI,IAAI,CAACA,MAAM,CAACC,GAAR,IAAe,CAACD,MAAM,CAACE,GAA3B,EAAgC;IAC5B;EACH;;EAEDF,MAAM,CAACG,OAAP,CAAeC,QAAf,CAAwB,CACpB,IAAIC,gEAAJ,EADoB,EAEpB,IAAAC,8CAAA,GAFoB,EAGpB,IAAAC,0DAAA,GAHoB,EAIpB,IAAAC,kCAAA,GAJoB,EAKpB,IAAAC,0DAAA,GALoB,CAAxB;EAQA,IAAAC,gCAAA,EAAgBV,MAAhB;EAEA,IAAAW,kDAAA,EAAyBX,MAAzB;EAEA,IAAAY,wCAAA,EAAoBZ,MAApB;EAEA,IAAAa,0CAAA,EAAqBb,MAArB;EAEA,IAAAc,oDAAA,EAA0Bd,MAA1B;AACH,CA1BM"}
@@ -0,0 +1 @@
1
+ export declare const createChangeRequestNotification: () => import("../../../ApwChangeRequestNotification").ApwChangeRequestNotification;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createChangeRequestNotification = void 0;
7
+
8
+ var _types = require("../../../types");
9
+
10
+ var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
11
+
12
+ const createChangeRequestNotification = () => {
13
+ const plugin = (0, _ApwChangeRequestNotification.createApwChangeRequestNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
+ const {
15
+ changeRequestUrl,
16
+ contentUrl
17
+ } = params;
18
+ return {
19
+ text: `
20
+ Hi,<br /><br />
21
+
22
+ You have received a <a href="${changeRequestUrl}">change request</a>, for <a href="${contentUrl}">this</a> content entry.<br /><br />
23
+
24
+ Here are the full URLs:<br /><br />
25
+
26
+ Change Request: ${changeRequestUrl}<br />
27
+ Content Entry: ${contentUrl}
28
+ `
29
+ };
30
+ });
31
+ plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
+ return plugin;
33
+ };
34
+
35
+ exports.createChangeRequestNotification = createChangeRequestNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createChangeRequestNotification","plugin","createApwChangeRequestNotification","ApwContentTypes","CMS_ENTRY","params","changeRequestUrl","contentUrl","text","name","type"],"sources":["changeRequestNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\nexport const createChangeRequestNotification = () => {\n const plugin = createApwChangeRequestNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { changeRequestUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${changeRequestUrl}\">change request</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Change Request: ${changeRequestUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAA,EAAmCC,sBAAA,CAAgBC,SAAnD,EAA8DC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAF;MAAoBC;IAApB,IAAmCF,MAAzC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}
@@ -0,0 +1 @@
1
+ export declare const createCommentNotification: () => import("../../../ApwCommentNotification").ApwCommentNotification;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCommentNotification = void 0;
7
+
8
+ var _ApwCommentNotification = require("../../../ApwCommentNotification");
9
+
10
+ var _types = require("../../../types");
11
+
12
+ const createCommentNotification = () => {
13
+ const plugin = (0, _ApwCommentNotification.createApwCommentNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
+ const {
15
+ commentUrl,
16
+ contentUrl
17
+ } = params;
18
+ return {
19
+ text: `
20
+ Hi,<br /><br />
21
+
22
+ You have received a <a href="${commentUrl}">comment</a>, on a change request, for <a href="${contentUrl}">this</a> content entry.<br />
23
+
24
+ Here are the full URLs:<br /><br />
25
+
26
+ Comment: ${commentUrl}<br />
27
+ Content Entry: ${contentUrl}
28
+ `
29
+ };
30
+ });
31
+ plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
+ return plugin;
33
+ };
34
+
35
+ exports.createCommentNotification = createCommentNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCommentNotification","plugin","createApwCommentNotification","ApwContentTypes","CMS_ENTRY","params","commentUrl","contentUrl","text","name","type"],"sources":["commentNotification.ts"],"sourcesContent":["import { createApwCommentNotification } from \"~/ApwCommentNotification\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport const createCommentNotification = () => {\n const plugin = createApwCommentNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { commentUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${commentUrl}\">comment</a>, on a change request, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Comment: ${commentUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,MAAMC,MAAM,GAAG,IAAAC,oDAAA,EAA6BC,sBAAA,CAAgBC,SAA7C,EAAwDC,MAAM,IAAI;IAC7E,MAAM;MAAEC,UAAF;MAAcC;IAAd,IAA6BF,MAAnC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,UAAW,oDAAmDC,UAAW;AACxH;AACA;AACA;AACA,2BAA2BD,UAAW;AACtC,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}
@@ -0,0 +1 @@
1
+ export declare const createContentReviewNotification: () => import("../../../ApwContentReviewNotification").ApwContentReviewNotification;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createContentReviewNotification = void 0;
7
+
8
+ var _types = require("../../../types");
9
+
10
+ var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
11
+
12
+ const createContentReviewNotification = () => {
13
+ const plugin = (0, _ApwContentReviewNotification.createApwContentReviewNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
+ const {
15
+ contentReviewUrl,
16
+ contentUrl
17
+ } = params;
18
+ return {
19
+ text: `
20
+ Hi,<br /><br />
21
+
22
+ You have received a <a href="${contentReviewUrl}">content review</a>, for <a href="${contentUrl}">this</a> content entry.<br />
23
+
24
+ Here are the full URLs:<br /><br />
25
+
26
+ Content Review: ${contentReviewUrl}<br />
27
+ Content Entry: ${contentUrl}
28
+ `
29
+ };
30
+ });
31
+ plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
+ return plugin;
33
+ };
34
+
35
+ exports.createContentReviewNotification = createContentReviewNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContentReviewNotification","plugin","createApwContentReviewNotification","ApwContentTypes","CMS_ENTRY","params","contentReviewUrl","contentUrl","text","name","type"],"sources":["contentReviewNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\nexport const createContentReviewNotification = () => {\n const plugin = createApwContentReviewNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { contentReviewUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${contentReviewUrl}\">content review</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Content Review: ${contentReviewUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAA,EAAmCC,sBAAA,CAAgBC,SAAnD,EAA8DC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAF;MAAoBC;IAApB,IAAmCF,MAAzC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}
@@ -0,0 +1,8 @@
1
+ interface CreateContentEntryUrlParams {
2
+ baseUrl?: string;
3
+ modelId?: string;
4
+ id: string;
5
+ }
6
+ export declare const createContentEntryUrl: (params: CreateContentEntryUrlParams) => string | null;
7
+ export declare const createContentUrlPlugin: () => import("../../../ApwContentUrlPlugin").ApwContentUrlPlugin;
8
+ export {};
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createContentUrlPlugin = exports.createContentEntryUrl = void 0;
7
+
8
+ var _ApwContentUrlPlugin = require("../../../ApwContentUrlPlugin");
9
+
10
+ var _types = require("../../../types");
11
+
12
+ /**
13
+ * In this file we create a plugin which in turn creates a content entry url when requested by the code which sends notifications.
14
+ * Due to multiple content types for the APW, everything needs to be pluginable.
15
+ */
16
+ const createContentEntryUrl = params => {
17
+ /**
18
+ * All variables must exist for URL to be created.
19
+ * We go through all vars and throw a log if it does not exist.
20
+ */
21
+ for (const key in params) {
22
+ if (!!key) {
23
+ continue;
24
+ }
25
+
26
+ console.log(`Missing variable "${key}", which we use to create a content entry URL.`);
27
+ return null;
28
+ }
29
+
30
+ const {
31
+ baseUrl,
32
+ modelId,
33
+ id
34
+ } = params;
35
+ return `${baseUrl}/cms/content-entries/${modelId}?id=${id}`;
36
+ };
37
+
38
+ exports.createContentEntryUrl = createContentEntryUrl;
39
+
40
+ const createContentUrlPlugin = () => {
41
+ return (0, _ApwContentUrlPlugin.createApwContentUrlPlugin)(_types.ApwContentTypes.CMS_ENTRY, params => {
42
+ const {
43
+ baseUrl,
44
+ contentReview
45
+ } = params;
46
+ const {
47
+ id
48
+ } = contentReview.content;
49
+ const {
50
+ modelId
51
+ } = contentReview.content.settings;
52
+ return createContentEntryUrl({
53
+ baseUrl,
54
+ modelId,
55
+ id
56
+ });
57
+ });
58
+ };
59
+
60
+ exports.createContentUrlPlugin = createContentUrlPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createContentEntryUrl","params","key","console","log","baseUrl","modelId","id","createContentUrlPlugin","createApwContentUrlPlugin","ApwContentTypes","CMS_ENTRY","contentReview","content","settings"],"sources":["contentUrl.ts"],"sourcesContent":["/**\n * In this file we create a plugin which in turn creates a content entry url when requested by the code which sends notifications.\n * Due to multiple content types for the APW, everything needs to be pluginable.\n */\nimport { createApwContentUrlPlugin } from \"~/ApwContentUrlPlugin\";\nimport { ApwContentTypes } from \"~/types\";\n\ninterface CreateContentEntryUrlParams {\n baseUrl?: string;\n modelId?: string;\n id: string;\n}\nexport const createContentEntryUrl = (params: CreateContentEntryUrlParams): string | null => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a content entry URL.`);\n return null;\n }\n const { baseUrl, modelId, id } = params;\n return `${baseUrl}/cms/content-entries/${modelId}?id=${id}`;\n};\n\nexport const createContentUrlPlugin = () => {\n return createApwContentUrlPlugin(ApwContentTypes.CMS_ENTRY, params => {\n const { baseUrl, contentReview } = params;\n const { id } = contentReview.content;\n const { modelId } = contentReview.content.settings;\n return createContentEntryUrl({\n baseUrl,\n modelId,\n id\n });\n });\n};\n"],"mappings":";;;;;;;AAIA;;AACA;;AALA;AACA;AACA;AACA;AASO,MAAMA,qBAAqB,GAAIC,MAAD,IAAwD;EACzF;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAI,CAAC,CAACC,GAAN,EAAW;MACP;IACH;;IACDC,OAAO,CAACC,GAAR,CAAa,qBAAoBF,GAAI,gDAArC;IACA,OAAO,IAAP;EACH;;EACD,MAAM;IAAEG,OAAF;IAAWC,OAAX;IAAoBC;EAApB,IAA2BN,MAAjC;EACA,OAAQ,GAAEI,OAAQ,wBAAuBC,OAAQ,OAAMC,EAAG,EAA1D;AACH,CAdM;;;;AAgBA,MAAMC,sBAAsB,GAAG,MAAM;EACxC,OAAO,IAAAC,8CAAA,EAA0BC,sBAAA,CAAgBC,SAA1C,EAAqDV,MAAM,IAAI;IAClE,MAAM;MAAEI,OAAF;MAAWO;IAAX,IAA6BX,MAAnC;IACA,MAAM;MAAEM;IAAF,IAASK,aAAa,CAACC,OAA7B;IACA,MAAM;MAAEP;IAAF,IAAcM,aAAa,CAACC,OAAd,CAAsBC,QAA1C;IACA,OAAOd,qBAAqB,CAAC;MACzBK,OADyB;MAEzBC,OAFyB;MAGzBC;IAHyB,CAAD,CAA5B;EAKH,CATM,CAAP;AAUH,CAXM"}
@@ -27,6 +27,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
27
27
  identityId: ID
28
28
  displayName: String
29
29
  type: String
30
+ email: String
30
31
  }
31
32
 
32
33
  type ApwListReviewersResponse {
@@ -45,6 +46,7 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
45
46
  identityId: ID
46
47
  displayName: String
47
48
  type: String
49
+ email: String
48
50
  }
49
51
 
50
52
  type ApwReviewerResponse {
@@ -1 +1 @@
1
- {"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewerListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwReviewerListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n }\n\n type ApwListReviewersResponse {\n data: [ApwReviewerListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwReviewer {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n }\n\n type ApwReviewerResponse {\n data: ApwReviewer\n error: ApwError\n }\n\n type ApwDeleteReviewerResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListReviewersSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwListReviewersWhereInput {\n identityId: ID\n }\n\n input ApwListReviewersSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n extend type ApwQuery {\n getReviewer(id: ID!): ApwReviewerResponse\n\n listReviewers(\n where: ApwListReviewersWhereInput\n limit: Int\n after: String\n sort: [ApwListReviewersSort!]\n search: ApwListReviewersSearchInput\n ): ApwListReviewersResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getReviewer: async (_, args: any, context) => {\n return resolve(() => context.apw.reviewer.get(args.id));\n },\n listReviewers: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwReviewerListParams.\n */\n const [entries, meta] = await context.apw.reviewer.list(\n args as unknown as ApwReviewerListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAJ,CAAoC;EACvDC,QAAQ;EAAE;EAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA3E2D;EA4EvDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,WAAW,EAAE,OAAOC,CAAP,EAAUC,IAAV,EAAqBC,OAArB,KAAiC;QAC1C,OAAO,IAAAC,gBAAA,EAAQ,MAAMD,OAAO,CAACE,GAAR,CAAYC,QAAZ,CAAqBC,GAArB,CAAyBL,IAAI,CAACM,EAA9B,CAAd,CAAP;MACH,CAHK;MAINC,aAAa,EAAE,OAAOR,CAAP,EAAUC,IAAV,EAAqBC,OAArB,KAAiC;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAD,EAAUC,IAAV,IAAkB,MAAMR,OAAO,CAACE,GAAR,CAAYC,QAAZ,CAAqBM,IAArB,CAC1BV,IAD0B,CAA9B;UAGA,OAAO,IAAIW,4BAAJ,CAAiBH,OAAjB,EAA0BC,IAA1B,CAAP;QACH,CARD,CAQE,OAAOG,CAAP,EAAU;UACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;QACH;MACJ;IAhBK;EADH;AA5E4C,CAApC,CAAvB;eAkGenB,c"}
1
+ {"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewerListParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type ApwReviewerListItem {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwListReviewersResponse {\n data: [ApwReviewerListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwReviewer {\n # System generated fields\n id: ID\n savedOn: DateTime\n createdOn: DateTime\n createdBy: ApwCreatedBy\n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwReviewerResponse {\n data: ApwReviewer\n error: ApwError\n }\n\n type ApwDeleteReviewerResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListReviewersSort {\n id_ASC\n id_DESC\n savedOn_ASC\n savedOn_DESC\n createdOn_ASC\n createdOn_DESC\n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwListReviewersWhereInput {\n identityId: ID\n }\n\n input ApwListReviewersSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n extend type ApwQuery {\n getReviewer(id: ID!): ApwReviewerResponse\n\n listReviewers(\n where: ApwListReviewersWhereInput\n limit: Int\n after: String\n sort: [ApwListReviewersSort!]\n search: ApwListReviewersSearchInput\n ): ApwListReviewersResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getReviewer: async (_, args: any, context) => {\n return resolve(() => context.apw.reviewer.get(args.id));\n },\n listReviewers: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwReviewerListParams.\n */\n const [entries, meta] = await context.apw.reviewer.list(\n args as unknown as ApwReviewerListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA,MAAMA,cAAc,GAAG,IAAIC,4BAAJ,CAAoC;EACvDC,QAAQ;EAAE;EAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA7E2D;EA8EvDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,WAAW,EAAE,OAAOC,CAAP,EAAUC,IAAV,EAAqBC,OAArB,KAAiC;QAC1C,OAAO,IAAAC,gBAAA,EAAQ,MAAMD,OAAO,CAACE,GAAR,CAAYC,QAAZ,CAAqBC,GAArB,CAAyBL,IAAI,CAACM,EAA9B,CAAd,CAAP;MACH,CAHK;MAINC,aAAa,EAAE,OAAOR,CAAP,EAAUC,IAAV,EAAqBC,OAArB,KAAiC;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAD,EAAUC,IAAV,IAAkB,MAAMR,OAAO,CAACE,GAAR,CAAYC,QAAZ,CAAqBM,IAArB,CAC1BV,IAD0B,CAA9B;UAGA,OAAO,IAAIW,4BAAJ,CAAiBH,OAAjB,EAA0BC,IAA1B,CAAP;QACH,CARD,CAQE,OAAOG,CAAP,EAAU;UACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;QACH;MACJ;IAhBK;EADH;AA9E4C,CAApC,CAAvB;eAoGenB,c"}
@@ -30,17 +30,26 @@ const createReviewerFromIdentity = ({
30
30
  throw e;
31
31
  }
32
32
  }
33
+
34
+ const email = identity.email || null;
33
35
  /**
34
36
  * Create a reviewer if it doesn't exist already.
35
37
  */
36
38
 
37
-
38
39
  if (!reviewer) {
39
- await apw.reviewer.create({
40
- identityId: identity.id,
41
- displayName: identity.displayName,
42
- type: identity.type
43
- });
40
+ try {
41
+ await apw.reviewer.create({
42
+ identityId: identity.id,
43
+ displayName: identity.displayName,
44
+ type: identity.type,
45
+ email
46
+ });
47
+ } catch (ex) {
48
+ console.log(`There was an error while creating reviewer with identity: ${identity.id}`);
49
+ console.log(JSON.stringify(ex));
50
+ throw ex;
51
+ }
52
+
44
53
  return;
45
54
  }
46
55
  /**
@@ -49,12 +58,23 @@ const createReviewerFromIdentity = ({
49
58
  */
50
59
 
51
60
 
52
- if (reviewer.displayName !== identity.displayName) {
61
+ const update = reviewer.displayName !== identity.displayName || reviewer.email !== email;
62
+
63
+ if (!update) {
64
+ return;
65
+ }
66
+
67
+ try {
53
68
  await apw.reviewer.update(reviewer.id, {
54
69
  identityId: reviewer.identityId,
55
70
  type: reviewer.type,
56
- displayName: identity.displayName
71
+ displayName: identity.displayName,
72
+ email
57
73
  });
74
+ } catch (ex) {
75
+ console.log(`There was an error while updating reviewer: ${reviewer.id}`);
76
+ console.log(JSON.stringify(ex));
77
+ throw ex;
58
78
  }
59
79
  });
60
80
  };
@@ -1 +1 @@
1
- {"version":3,"names":["createReviewerFromIdentity","security","apw","onAfterLogin","subscribe","identity","reviewer","list","where","identityId","id","limit","e","message","create","displayName","type","update"],"sources":["createReviewerFromIdentity.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const createReviewerFromIdentity = ({ security, apw }: LifeCycleHookCallbackParams) => {\n /**\n * Replicate identity in \"AdvancedPublishingWorkflow\" system after login.\n */\n security.onAfterLogin.subscribe(async ({ identity }) => {\n let reviewer;\n try {\n [[reviewer]] = await apw.reviewer.list({\n where: { identityId: identity.id },\n limit: 1\n });\n } catch (e) {\n if (e.message === \"index_not_found_exception\") {\n // Do nothing\n } else {\n throw e;\n }\n }\n /**\n * Create a reviewer if it doesn't exist already.\n */\n if (!reviewer) {\n await apw.reviewer.create({\n identityId: identity.id,\n displayName: identity.displayName,\n type: identity.type\n });\n return;\n }\n /**\n * If \"displayName\" doesn't match it means it has been updated in the identity,\n * therefore, we need to update it on reviewer as well keep them in sync.\n */\n if (reviewer.displayName !== identity.displayName) {\n await apw.reviewer.update(reviewer.id, {\n identityId: reviewer.identityId,\n type: reviewer.type,\n displayName: identity.displayName\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,0BAA0B,GAAG,CAAC;EAAEC,QAAF;EAAYC;AAAZ,CAAD,KAAoD;EAC1F;AACJ;AACA;EACID,QAAQ,CAACE,YAAT,CAAsBC,SAAtB,CAAgC,OAAO;IAAEC;EAAF,CAAP,KAAwB;IACpD,IAAIC,QAAJ;;IACA,IAAI;MACA,CAAC,CAACA,QAAD,CAAD,IAAe,MAAMJ,GAAG,CAACI,QAAJ,CAAaC,IAAb,CAAkB;QACnCC,KAAK,EAAE;UAAEC,UAAU,EAAEJ,QAAQ,CAACK;QAAvB,CAD4B;QAEnCC,KAAK,EAAE;MAF4B,CAAlB,CAArB;IAIH,CALD,CAKE,OAAOC,CAAP,EAAU;MACR,IAAIA,CAAC,CAACC,OAAF,KAAc,2BAAlB,EAA+C,CAC3C;MACH,CAFD,MAEO;QACH,MAAMD,CAAN;MACH;IACJ;IACD;AACR;AACA;;;IACQ,IAAI,CAACN,QAAL,EAAe;MACX,MAAMJ,GAAG,CAACI,QAAJ,CAAaQ,MAAb,CAAoB;QACtBL,UAAU,EAAEJ,QAAQ,CAACK,EADC;QAEtBK,WAAW,EAAEV,QAAQ,CAACU,WAFA;QAGtBC,IAAI,EAAEX,QAAQ,CAACW;MAHO,CAApB,CAAN;MAKA;IACH;IACD;AACR;AACA;AACA;;;IACQ,IAAIV,QAAQ,CAACS,WAAT,KAAyBV,QAAQ,CAACU,WAAtC,EAAmD;MAC/C,MAAMb,GAAG,CAACI,QAAJ,CAAaW,MAAb,CAAoBX,QAAQ,CAACI,EAA7B,EAAiC;QACnCD,UAAU,EAAEH,QAAQ,CAACG,UADc;QAEnCO,IAAI,EAAEV,QAAQ,CAACU,IAFoB;QAGnCD,WAAW,EAAEV,QAAQ,CAACU;MAHa,CAAjC,CAAN;IAKH;EACJ,CApCD;AAqCH,CAzCM"}
1
+ {"version":3,"names":["createReviewerFromIdentity","security","apw","onAfterLogin","subscribe","identity","reviewer","list","where","identityId","id","limit","e","message","email","create","displayName","type","ex","console","log","JSON","stringify","update"],"sources":["createReviewerFromIdentity.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const createReviewerFromIdentity = ({ security, apw }: LifeCycleHookCallbackParams) => {\n /**\n * Replicate identity in \"AdvancedPublishingWorkflow\" system after login.\n */\n security.onAfterLogin.subscribe(async ({ identity }) => {\n let reviewer;\n try {\n [[reviewer]] = await apw.reviewer.list({\n where: { identityId: identity.id },\n limit: 1\n });\n } catch (e) {\n if (e.message === \"index_not_found_exception\") {\n // Do nothing\n } else {\n throw e;\n }\n }\n const email = (identity as any).email || null;\n /**\n * Create a reviewer if it doesn't exist already.\n */\n if (!reviewer) {\n try {\n await apw.reviewer.create({\n identityId: identity.id,\n displayName: identity.displayName,\n type: identity.type,\n email\n });\n } catch (ex) {\n console.log(\n `There was an error while creating reviewer with identity: ${identity.id}`\n );\n console.log(JSON.stringify(ex));\n throw ex;\n }\n return;\n }\n /**\n * If \"displayName\" doesn't match it means it has been updated in the identity,\n * therefore, we need to update it on reviewer as well keep them in sync.\n */\n const update = reviewer.displayName !== identity.displayName || reviewer.email !== email;\n if (!update) {\n return;\n }\n try {\n await apw.reviewer.update(reviewer.id, {\n identityId: reviewer.identityId,\n type: reviewer.type,\n displayName: identity.displayName,\n email\n });\n } catch (ex) {\n console.log(`There was an error while updating reviewer: ${reviewer.id}`);\n console.log(JSON.stringify(ex));\n throw ex;\n }\n });\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,0BAA0B,GAAG,CAAC;EAAEC,QAAF;EAAYC;AAAZ,CAAD,KAAoD;EAC1F;AACJ;AACA;EACID,QAAQ,CAACE,YAAT,CAAsBC,SAAtB,CAAgC,OAAO;IAAEC;EAAF,CAAP,KAAwB;IACpD,IAAIC,QAAJ;;IACA,IAAI;MACA,CAAC,CAACA,QAAD,CAAD,IAAe,MAAMJ,GAAG,CAACI,QAAJ,CAAaC,IAAb,CAAkB;QACnCC,KAAK,EAAE;UAAEC,UAAU,EAAEJ,QAAQ,CAACK;QAAvB,CAD4B;QAEnCC,KAAK,EAAE;MAF4B,CAAlB,CAArB;IAIH,CALD,CAKE,OAAOC,CAAP,EAAU;MACR,IAAIA,CAAC,CAACC,OAAF,KAAc,2BAAlB,EAA+C,CAC3C;MACH,CAFD,MAEO;QACH,MAAMD,CAAN;MACH;IACJ;;IACD,MAAME,KAAK,GAAIT,QAAD,CAAkBS,KAAlB,IAA2B,IAAzC;IACA;AACR;AACA;;IACQ,IAAI,CAACR,QAAL,EAAe;MACX,IAAI;QACA,MAAMJ,GAAG,CAACI,QAAJ,CAAaS,MAAb,CAAoB;UACtBN,UAAU,EAAEJ,QAAQ,CAACK,EADC;UAEtBM,WAAW,EAAEX,QAAQ,CAACW,WAFA;UAGtBC,IAAI,EAAEZ,QAAQ,CAACY,IAHO;UAItBH;QAJsB,CAApB,CAAN;MAMH,CAPD,CAOE,OAAOI,EAAP,EAAW;QACTC,OAAO,CAACC,GAAR,CACK,6DAA4Df,QAAQ,CAACK,EAAG,EAD7E;QAGAS,OAAO,CAACC,GAAR,CAAYC,IAAI,CAACC,SAAL,CAAeJ,EAAf,CAAZ;QACA,MAAMA,EAAN;MACH;;MACD;IACH;IACD;AACR;AACA;AACA;;;IACQ,MAAMK,MAAM,GAAGjB,QAAQ,CAACU,WAAT,KAAyBX,QAAQ,CAACW,WAAlC,IAAiDV,QAAQ,CAACQ,KAAT,KAAmBA,KAAnF;;IACA,IAAI,CAACS,MAAL,EAAa;MACT;IACH;;IACD,IAAI;MACA,MAAMrB,GAAG,CAACI,QAAJ,CAAaiB,MAAb,CAAoBjB,QAAQ,CAACI,EAA7B,EAAiC;QACnCD,UAAU,EAAEH,QAAQ,CAACG,UADc;QAEnCQ,IAAI,EAAEX,QAAQ,CAACW,IAFoB;QAGnCD,WAAW,EAAEX,QAAQ,CAACW,WAHa;QAInCF;MAJmC,CAAjC,CAAN;IAMH,CAPD,CAOE,OAAOI,EAAP,EAAW;MACTC,OAAO,CAACC,GAAR,CAAa,+CAA8Cd,QAAQ,CAACI,EAAG,EAAvE;MACAS,OAAO,CAACC,GAAR,CAAYC,IAAI,CAACC,SAAL,CAAeJ,EAAf,CAAZ;MACA,MAAMA,EAAN;IACH;EACJ,CAvDD;AAwDH,CA5DM"}
@@ -27,6 +27,8 @@ var _validateComment = require("./validateComment");
27
27
 
28
28
  var _listContentReviews = require("./listContentReviews");
29
29
 
30
+ var _initializeNotifications = require("./initializeNotifications");
31
+
30
32
  const attachApwHooks = () =>
31
33
  /**
32
34
  * Hook into CMS events and execute business logic.
@@ -66,6 +68,7 @@ new _api.ContextPlugin(async context => {
66
68
  apw
67
69
  });
68
70
  (0, _listContentReviews.listContentReviews)(context);
71
+ (0, _initializeNotifications.initializeNotifications)(context);
69
72
  });
70
73
 
71
74
  exports.attachApwHooks = attachApwHooks;
@@ -1 +1 @@
1
- {"version":3,"names":["attachApwHooks","ContextPlugin","context","security","apw","validateContentReview","validateChangeRequest","validateComment","createReviewerFromIdentity","initializeContentReviewSteps","updatePendingChangeRequestsCount","updateTotalCommentsCount","updateLatestCommentId","deleteCommentsAfterChangeRequest","deleteChangeRequestsWithContentReview","listContentReviews"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { deleteCommentsAfterChangeRequest } from \"./deleteCommentsAfterChangeRequest\";\nimport { deleteChangeRequestsWithContentReview } from \"./deleteChangeRequestsAfterContentReview\";\nimport { createReviewerFromIdentity } from \"./createReviewerFromIdentity\";\nimport { initializeContentReviewSteps } from \"./initializeContentReviewSteps\";\nimport { updatePendingChangeRequestsCount } from \"./updatePendingChangeRequests\";\nimport { updateTotalCommentsCount, updateLatestCommentId } from \"./updateTotalComments\";\nimport { validateChangeRequest } from \"./validateChangeRequest\";\nimport { validateContentReview } from \"./validateContentReview\";\nimport { validateComment } from \"./validateComment\";\nimport { listContentReviews } from \"~/plugins/hooks/listContentReviews\";\n\nexport const attachApwHooks = () =>\n /**\n * Hook into CMS events and execute business logic.\n */\n new ContextPlugin<ApwContext>(async context => {\n const { security, apw } = context;\n\n validateContentReview({ apw });\n\n validateChangeRequest({ apw });\n\n validateComment({ apw });\n\n createReviewerFromIdentity({ security, apw });\n\n initializeContentReviewSteps(context);\n\n updatePendingChangeRequestsCount({ apw });\n\n updateTotalCommentsCount({ apw });\n\n updateLatestCommentId({ apw });\n\n deleteCommentsAfterChangeRequest({ apw });\n\n deleteChangeRequestsWithContentReview({ apw });\n\n listContentReviews(context);\n });\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,cAAc,GAAG;AAC1B;AACJ;AACA;AACI,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,QAAF;IAAYC;EAAZ,IAAoBF,OAA1B;EAEA,IAAAG,4CAAA,EAAsB;IAAED;EAAF,CAAtB;EAEA,IAAAE,4CAAA,EAAsB;IAAEF;EAAF,CAAtB;EAEA,IAAAG,gCAAA,EAAgB;IAAEH;EAAF,CAAhB;EAEA,IAAAI,sDAAA,EAA2B;IAAEL,QAAF;IAAYC;EAAZ,CAA3B;EAEA,IAAAK,0DAAA,EAA6BP,OAA7B;EAEA,IAAAQ,6DAAA,EAAiC;IAAEN;EAAF,CAAjC;EAEA,IAAAO,6CAAA,EAAyB;IAAEP;EAAF,CAAzB;EAEA,IAAAQ,0CAAA,EAAsB;IAAER;EAAF,CAAtB;EAEA,IAAAS,kEAAA,EAAiC;IAAET;EAAF,CAAjC;EAEA,IAAAU,6EAAA,EAAsC;IAAEV;EAAF,CAAtC;EAEA,IAAAW,sCAAA,EAAmBb,OAAnB;AACH,CAxBD,CAJG"}
1
+ {"version":3,"names":["attachApwHooks","ContextPlugin","context","security","apw","validateContentReview","validateChangeRequest","validateComment","createReviewerFromIdentity","initializeContentReviewSteps","updatePendingChangeRequestsCount","updateTotalCommentsCount","updateLatestCommentId","deleteCommentsAfterChangeRequest","deleteChangeRequestsWithContentReview","listContentReviews","initializeNotifications"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { deleteCommentsAfterChangeRequest } from \"./deleteCommentsAfterChangeRequest\";\nimport { deleteChangeRequestsWithContentReview } from \"./deleteChangeRequestsAfterContentReview\";\nimport { createReviewerFromIdentity } from \"./createReviewerFromIdentity\";\nimport { initializeContentReviewSteps } from \"./initializeContentReviewSteps\";\nimport { updatePendingChangeRequestsCount } from \"./updatePendingChangeRequests\";\nimport { updateTotalCommentsCount, updateLatestCommentId } from \"./updateTotalComments\";\nimport { validateChangeRequest } from \"./validateChangeRequest\";\nimport { validateContentReview } from \"./validateContentReview\";\nimport { validateComment } from \"./validateComment\";\nimport { listContentReviews } from \"./listContentReviews\";\nimport { initializeNotifications } from \"./initializeNotifications\";\n\nexport const attachApwHooks = () =>\n /**\n * Hook into CMS events and execute business logic.\n */\n new ContextPlugin<ApwContext>(async context => {\n const { security, apw } = context;\n\n validateContentReview({ apw });\n\n validateChangeRequest({ apw });\n\n validateComment({ apw });\n\n createReviewerFromIdentity({ security, apw });\n\n initializeContentReviewSteps(context);\n\n updatePendingChangeRequestsCount({ apw });\n\n updateTotalCommentsCount({ apw });\n\n updateLatestCommentId({ apw });\n\n deleteCommentsAfterChangeRequest({ apw });\n\n deleteChangeRequestsWithContentReview({ apw });\n\n listContentReviews(context);\n\n initializeNotifications(context);\n });\n"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,cAAc,GAAG;AAC1B;AACJ;AACA;AACI,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,QAAF;IAAYC;EAAZ,IAAoBF,OAA1B;EAEA,IAAAG,4CAAA,EAAsB;IAAED;EAAF,CAAtB;EAEA,IAAAE,4CAAA,EAAsB;IAAEF;EAAF,CAAtB;EAEA,IAAAG,gCAAA,EAAgB;IAAEH;EAAF,CAAhB;EAEA,IAAAI,sDAAA,EAA2B;IAAEL,QAAF;IAAYC;EAAZ,CAA3B;EAEA,IAAAK,0DAAA,EAA6BP,OAA7B;EAEA,IAAAQ,6DAAA,EAAiC;IAAEN;EAAF,CAAjC;EAEA,IAAAO,6CAAA,EAAyB;IAAEP;EAAF,CAAzB;EAEA,IAAAQ,0CAAA,EAAsB;IAAER;EAAF,CAAtB;EAEA,IAAAS,kEAAA,EAAiC;IAAET;EAAF,CAAjC;EAEA,IAAAU,6EAAA,EAAsC;IAAEV;EAAF,CAAtC;EAEA,IAAAW,sCAAA,EAAmBb,OAAnB;EAEA,IAAAc,gDAAA,EAAwBd,OAAxB;AACH,CA1BD,CAJG"}
@@ -0,0 +1,2 @@
1
+ import { ApwContext } from "../../types";
2
+ export declare const initializeNotifications: (context: ApwContext) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initializeNotifications = void 0;
7
+
8
+ var _contentReviewAfterCreate = require("./notifications/contentReviewAfterCreate");
9
+
10
+ var _commentAfterCreate = require("./notifications/commentAfterCreate");
11
+
12
+ var _changeRequestAfterCreate = require("./notifications/changeRequestAfterCreate");
13
+
14
+ const initializeNotifications = context => {
15
+ (0, _contentReviewAfterCreate.attachContentReviewAfterCreate)(context);
16
+ (0, _commentAfterCreate.attachCommentAfterCreate)(context);
17
+ (0, _changeRequestAfterCreate.attachChangeRequestAfterCreate)(context);
18
+ };
19
+
20
+ exports.initializeNotifications = initializeNotifications;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate"],"sources":["initializeNotifications.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AAEO,MAAMA,uBAAuB,GAAIC,OAAD,IAAyB;EAC5D,IAAAC,wDAAA,EAA+BD,OAA/B;EACA,IAAAE,4CAAA,EAAyBF,OAAzB;EACA,IAAAG,wDAAA,EAA+BH,OAA/B;AACH,CAJM"}
@@ -6,5 +6,5 @@ interface ListWorkflowsParams {
6
6
  cms: HeadlessCms;
7
7
  security: Security;
8
8
  }
9
- export declare const listContentReviews: ({ apw, cms, security }: ListWorkflowsParams) => void;
9
+ export declare const listContentReviews: ({ apw, security }: ListWorkflowsParams) => void;
10
10
  export {};
@@ -5,24 +5,27 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.listContentReviews = void 0;
7
7
 
8
- var _contentReview = require("../../storageOperations/models/contentReview.model");
9
-
10
8
  const listContentReviews = ({
11
9
  apw,
12
- cms,
13
10
  security
14
11
  }) => {
15
12
  /**
16
13
  * We need to hook into listing the content review entries.
17
14
  * When listing content review entries, we need to check which ones current user can actually see.
18
15
  */
19
- cms.onEntryBeforeList.subscribe(async ({
20
- model,
16
+ apw.contentReview.onContentReviewBeforeList.subscribe(async ({
21
17
  where
22
18
  }) => {
19
+ /**
20
+ * If there is workflowId_in attached on where, we will not change it.
21
+ */
22
+ if (where.workflowId_in) {
23
+ return;
24
+ }
25
+
23
26
  const identity = security.getIdentity();
24
27
 
25
- if (!(identity !== null && identity !== void 0 && identity.id) || model.modelId !== _contentReview.CONTENT_REVIEW_MODEL_ID) {
28
+ if (!(identity !== null && identity !== void 0 && identity.id)) {
26
29
  return;
27
30
  }
28
31
  /**
@@ -35,31 +38,16 @@ const listContentReviews = ({
35
38
  if (workflows.length === 0) {
36
39
  return;
37
40
  }
38
- /**
39
- * We need to find the reviewer entryId to be able to match it to the reviewer entryId in the workflow steps.
40
- */
41
-
42
-
43
- const [reviewers] = await apw.reviewer.list({
44
- where: {
45
- identityId: identity.id
46
- }
47
- });
48
-
49
- if (reviewers.length === 0) {
50
- return;
51
- }
52
-
53
- const reviewerList = reviewers.map(reviewer => reviewer.entryId);
54
41
  /**
55
42
  * Find all workflows which user has access to.
56
43
  * User access is buried quite deep in the workflow data, so we need to do some traversing.
57
44
  */
58
45
 
46
+
59
47
  const userWorkflows = workflows.filter(workflow => {
60
48
  return workflow.steps.some(step => {
61
49
  return step.reviewers.some(reviewer => {
62
- return reviewerList.includes(reviewer.entryId);
50
+ return identity.id === reviewer.identityId;
63
51
  });
64
52
  });
65
53
  });