@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.3386f66516
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.
- package/ApwChangeRequestNotification.d.ts +27 -0
- package/ApwChangeRequestNotification.js +40 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +40 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +40 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +40 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/crud/createContentReviewMethods.js +15 -5
- package/crud/createContentReviewMethods.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +5 -9
- package/index.js.map +1 -1
- package/package.json +32 -32
- package/plugins/cms/index.js +9 -1
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +35 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/cms/notifications/commentNotification.d.ts +1 -0
- package/plugins/cms/notifications/commentNotification.js +35 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -0
- package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/cms/notifications/contentReviewNotification.js +35 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/cms/notifications/contentUrl.d.ts +8 -0
- package/plugins/cms/notifications/contentUrl.js +60 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/context.d.ts +0 -1
- package/plugins/context.js +2 -19
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +2 -0
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql.js +2 -2
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +28 -8
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/index.js +3 -0
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +20 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +1 -1
- package/plugins/hooks/listContentReviews.js +11 -23
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +2 -0
- package/plugins/hooks/notifications/appUrl.js +22 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
- package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
- package/plugins/hooks/notifications/commentUrl.js +31 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentUrl.js +29 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/reviewers.d.ts +15 -0
- package/plugins/hooks/notifications/reviewers.js +51 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/validateChangeRequest.js +28 -3
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +12 -2
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/pageBuilder/index.js +9 -1
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +0 -1
- package/plugins/utils.js +1 -7
- package/plugins/utils.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +18 -2
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +13 -5
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +3 -1
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +21 -9
- 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.
|
3
|
+
"version": "0.0.0-unstable.3386f66516",
|
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.
|
21
|
-
"@webiny/api-
|
22
|
-
"@webiny/api-
|
23
|
-
"@webiny/api-i18n
|
24
|
-
"@webiny/api-
|
25
|
-
"@webiny/api-
|
26
|
-
"@webiny/api-
|
27
|
-
"@webiny/api-
|
28
|
-
"@webiny/api-
|
29
|
-
"@webiny/
|
30
|
-
"@webiny/
|
31
|
-
"@webiny/
|
32
|
-
"@webiny/handler
|
33
|
-
"@webiny/handler-
|
34
|
-
"@webiny/handler-
|
35
|
-
"@webiny/handler-
|
36
|
-
"@webiny/
|
37
|
-
"@webiny/
|
38
|
-
"@webiny/
|
20
|
+
"@webiny/api": "0.0.0-unstable.3386f66516",
|
21
|
+
"@webiny/api-admin-settings": "0.0.0-unstable.3386f66516",
|
22
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.3386f66516",
|
23
|
+
"@webiny/api-i18n": "0.0.0-unstable.3386f66516",
|
24
|
+
"@webiny/api-i18n-ddb": "0.0.0-unstable.3386f66516",
|
25
|
+
"@webiny/api-mailer": "0.0.0-unstable.3386f66516",
|
26
|
+
"@webiny/api-page-builder": "0.0.0-unstable.3386f66516",
|
27
|
+
"@webiny/api-security": "0.0.0-unstable.3386f66516",
|
28
|
+
"@webiny/api-tenancy": "0.0.0-unstable.3386f66516",
|
29
|
+
"@webiny/api-wcp": "0.0.0-unstable.3386f66516",
|
30
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.3386f66516",
|
31
|
+
"@webiny/error": "0.0.0-unstable.3386f66516",
|
32
|
+
"@webiny/handler": "0.0.0-unstable.3386f66516",
|
33
|
+
"@webiny/handler-client": "0.0.0-unstable.3386f66516",
|
34
|
+
"@webiny/handler-db": "0.0.0-unstable.3386f66516",
|
35
|
+
"@webiny/handler-graphql": "0.0.0-unstable.3386f66516",
|
36
|
+
"@webiny/handler-logs": "0.0.0-unstable.3386f66516",
|
37
|
+
"@webiny/plugins": "0.0.0-unstable.3386f66516",
|
38
|
+
"@webiny/pubsub": "0.0.0-unstable.3386f66516",
|
39
|
+
"@webiny/utils": "0.0.0-unstable.3386f66516",
|
40
|
+
"@webiny/validation": "0.0.0-unstable.3386f66516",
|
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
|
-
"@
|
49
|
-
"@webiny/api-
|
50
|
-
"@webiny/api-
|
51
|
-
"@webiny/api-
|
52
|
-
"@webiny/
|
53
|
-
"@webiny/
|
54
|
-
"@webiny/
|
55
|
-
"@webiny/
|
56
|
-
"@webiny/wcp": "^0.0.0-unstable.1e66d121db",
|
49
|
+
"@webiny/api-headless-cms-ddb": "^0.0.0-unstable.3386f66516",
|
50
|
+
"@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.3386f66516",
|
51
|
+
"@webiny/api-security-so-ddb": "^0.0.0-unstable.3386f66516",
|
52
|
+
"@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.3386f66516",
|
53
|
+
"@webiny/cli": "^0.0.0-unstable.3386f66516",
|
54
|
+
"@webiny/handler-aws": "^0.0.0-unstable.3386f66516",
|
55
|
+
"@webiny/project-utils": "^0.0.0-unstable.3386f66516",
|
56
|
+
"@webiny/wcp": "^0.0.0-unstable.3386f66516",
|
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": "
|
75
|
+
"gitHead": "3386f66516b16fe54e2508243b91dfff1a0156f9"
|
76
76
|
}
|
package/plugins/cms/index.js
CHANGED
@@ -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);
|
package/plugins/cms/index.js.map
CHANGED
@@ -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 \"
|
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"}
|
package/plugins/context.d.ts
CHANGED
@@ -2,4 +2,3 @@ import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import { ApwContext } from "../types";
|
3
3
|
import { CreateApwContextParams } from "../scheduler/types";
|
4
4
|
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
|
5
|
-
export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
|
package/plugins/context.js
CHANGED
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
6
6
|
value: true
|
7
7
|
});
|
8
|
-
exports.createApwPageBuilderContext =
|
8
|
+
exports.createApwPageBuilderContext = void 0;
|
9
9
|
|
10
10
|
var _hooks = require("./hooks");
|
11
11
|
|
@@ -126,21 +126,4 @@ const createApwPageBuilderContext = params => {
|
|
126
126
|
});
|
127
127
|
};
|
128
128
|
|
129
|
-
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
130
|
-
|
131
|
-
const createApwHeadlessCmsContext = params => {
|
132
|
-
return new _api.ContextPlugin(async context => {
|
133
|
-
if (!context.wcp.canUseFeature("advancedPublishingWorkflow")) {
|
134
|
-
return;
|
135
|
-
} else if ((0, _utils.isInstallationPending)(context)) {
|
136
|
-
return;
|
137
|
-
}
|
138
|
-
|
139
|
-
await setupApwContext(params).apply(context);
|
140
|
-
await setupApwHeadlessCms().apply(context);
|
141
|
-
await (0, _hooks.attachApwHooks)().apply(context);
|
142
|
-
await (0, _security.createCustomAuth)(params).apply(context);
|
143
|
-
});
|
144
|
-
};
|
145
|
-
|
146
|
-
exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
|
129
|
+
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
package/plugins/context.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema"
|
1
|
+
{"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwPageBuilder","apwPageBuilderHooks","setupApwHeadlessCms","apwCmsHooks","createApwPageBuilderContext","wcp","canUseFeature","apply","apwContentPagePlugins","attachApwHooks","createCustomAuth","register","extendPbPageSettingsSchema"],"sources":["context.ts"],"sourcesContent":["import { attachApwHooks } from \"./hooks\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { createApw } from \"~/crud\";\nimport { apwPageBuilderHooks } from \"./pageBuilder\";\nimport { createStorageOperations } from \"~/storageOperations\";\nimport { SecurityPermission } from \"@webiny/api-security/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { CreateApwContextParams } from \"~/scheduler/types\";\nimport { createScheduler } from \"~/scheduler\";\nimport { createCustomAuth } from \"~/scheduler/handlers/executeAction/security\";\nimport { isInstallationPending } from \"./utils\";\nimport { extendPbPageSettingsSchema } from \"~/plugins/pageBuilder/extendPbPageSettingsSchema\";\nimport { apwContentPagePlugins } from \"~/plugins/pageBuilder/apwContentPagePlugins\";\nimport { apwCmsHooks } from \"~/plugins/cms\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst setupApwContext = (params: CreateApwContextParams) =>\n new ContextPlugin<ApwContext>(async context => {\n const { tenancy, security, i18n, handlerClient } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getPermission = async (name: string): Promise<SecurityPermission | null> => {\n return security.getPermission(name);\n };\n const getIdentity = () => security.getIdentity();\n\n const scheduler = createScheduler({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: params.storageOperations\n });\n\n context.apw = createApw({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: createStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n }),\n scheduler,\n handlerClient,\n plugins: context.plugins\n });\n });\n\nconst setupApwPageBuilder = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwPageBuilderHooks(context);\n });\n};\n\nconst setupApwHeadlessCms = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwCmsHooks(context);\n });\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwPageBuilder().apply(context);\n await setupApwHeadlessCms().apply(context);\n await apwContentPagePlugins().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);\n\n context.plugins.register(extendPbPageSettingsSchema());\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,eAAe,GAAIC,MAAD,IACpB,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC,IAArB;IAA2BC;EAA3B,IAA6CJ,OAAnD;;EAEA,IAAI,IAAAK,4BAAA,EAAsB;IAAEJ,OAAF;IAAWE;EAAX,CAAtB,CAAJ,EAA8C;IAC1C;EACH;;EAED,MAAMG,SAAS,GAAG,MAAkB;IAChC,MAAMC,MAAM,GAAGJ,IAAI,CAACK,gBAAL,EAAf;;IACA,IAAI,CAACD,MAAL,EAAa;MACT,MAAM,IAAIE,cAAJ,CACF,sDADE,EAEF,cAFE,CAAN;IAIH;;IAED,OAAOF,MAAP;EACH,CAVD;;EAYA,MAAMG,SAAS,GAAG,MAAc;IAC5B,OAAOT,OAAO,CAACU,gBAAR,EAAP;EACH,CAFD;;EAIA,MAAMC,aAAa,GAAG,MAAOC,IAAP,IAA4D;IAC9E,OAAOX,QAAQ,CAACU,aAAT,CAAuBC,IAAvB,CAAP;EACH,CAFD;;EAGA,MAAMC,WAAW,GAAG,MAAMZ,QAAQ,CAACY,WAAT,EAA1B;;EAEA,MAAMC,SAAS,GAAG,IAAAC,0BAAA,EAAgB;IAC9BV,SAD8B;IAE9BQ,WAF8B;IAG9BJ,SAH8B;IAI9BE,aAJ8B;IAK9BK,iBAAiB,EAAEnB,MAAM,CAACmB;EALI,CAAhB,CAAlB;EAQAjB,OAAO,CAACkB,GAAR,GAAc,IAAAC,eAAA,EAAU;IACpBb,SADoB;IAEpBQ,WAFoB;IAGpBJ,SAHoB;IAIpBE,aAJoB;IAKpBK,iBAAiB,EAAE,IAAAG,0CAAA,EAAwB;MACvC;AAChB;AACA;MACgBC,GAAG,EAAErB,OAAO,CAACqB,GAJ0B;;MAKvC;AAChB;AACA;MACgBC,aAAa,EAAE,MAAMtB,OARkB;MASvCE;IATuC,CAAxB,CALC;IAgBpBa,SAhBoB;IAiBpBX,aAjBoB;IAkBpBmB,OAAO,EAAEvB,OAAO,CAACuB;EAlBG,CAAV,CAAd;AAoBH,CAxDD,CADJ;;AA2DA,MAAMC,mBAAmB,GAAG,MAAM;EAC9B,OAAO,IAAIzB,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;IAClD,IAAAyB,gCAAA,EAAoBzB,OAApB;EACH,CAFM,CAAP;AAGH,CAJD;;AAMA,MAAM0B,mBAAmB,GAAG,MAAM;EAC9B,OAAO,IAAI3B,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;IAClD,IAAA2B,gBAAA,EAAY3B,OAAZ;EACH,CAFM,CAAP;AAGH,CAJD;;AAMO,MAAM4B,2BAA2B,GAAI9B,MAAD,IAAoC;EAC3E,OAAO,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;IAClD,IAAI,CAACA,OAAO,CAAC6B,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH,CAFD,MAEO,IAAI,IAAAzB,4BAAA,EAAsBL,OAAtB,CAAJ,EAAoC;MACvC;IACH;;IAED,MAAMH,eAAe,CAACC,MAAD,CAAf,CAAwBiC,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAMwB,mBAAmB,GAAGO,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM0B,mBAAmB,GAAGK,KAAtB,CAA4B/B,OAA5B,CAAN;IACA,MAAM,IAAAgC,4CAAA,IAAwBD,KAAxB,CAA8B/B,OAA9B,CAAN;IACA,MAAM,IAAAiC,qBAAA,IAAiBF,KAAjB,CAAuB/B,OAAvB,CAAN;IACA,MAAM,IAAAkC,0BAAA,EAAiBpC,MAAjB,EAAyBiC,KAAzB,CAA+B/B,OAA/B,CAAN;IAEAA,OAAO,CAACuB,OAAR,CAAgBY,QAAhB,CAAyB,IAAAC,sDAAA,GAAzB;EACH,CAfM,CAAP;AAgBH,CAjBM"}
|
@@ -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,
|
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"}
|
package/plugins/graphql.js
CHANGED
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.default = void 0;
|
9
9
|
|
10
|
-
var _plugins = require("@webiny/handler-graphql/plugins");
|
11
|
-
|
12
10
|
var _workflow = _interopRequireDefault(require("./graphql/workflow.gql"));
|
13
11
|
|
14
12
|
var _contentReview = _interopRequireDefault(require("./graphql/contentReview.gql"));
|
@@ -19,6 +17,8 @@ var _comment = _interopRequireDefault(require("./graphql/comment.gql"));
|
|
19
17
|
|
20
18
|
var _changeRequest = _interopRequireDefault(require("./graphql/changeRequest.gql"));
|
21
19
|
|
20
|
+
var _plugins = require("@webiny/handler-graphql/plugins");
|
21
|
+
|
22
22
|
var _api = require("@webiny/api");
|
23
23
|
|
24
24
|
const emptyResolver = () => ({});
|
package/plugins/graphql.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import
|
1
|
+
{"version":3,"names":["emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwCreatedBy {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA,MAAMA,aAAa,GAAG,OAAO,EAAP,CAAtB;;AAEA,MAAMC,UAAU,GAAG,IAAIC,4BAAJ,CAAwB;EACvCC,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,KA9C2C;EA+CvCC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IADF,CADA;IAIPO,QAAQ,EAAE;MACND,GAAG,EAAEN;IADC;EAJH;AA/C4B,CAAxB,CAAnB;;eAyDe,MAAM;EACjB,OAAO,IAAIQ,kBAAJ,CAA8BC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAR,CAAYC,aAAZ,CAA0B,4BAA1B,CAAL,EAA8D;MAC1D;IACH;;IAEDF,OAAO,CAACG,OAAR,CAAgBC,QAAhB,CAAyB,CACrBZ,UADqB,EAErBa,iBAFqB,EAGrBC,sBAHqB,EAIrBC,iBAJqB,EAKrBC,gBALqB,EAMrBC,sBANqB,CAAzB;EAQH,CAbM,CAAP;AAcH,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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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
|
-
|
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
|
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"}
|
package/plugins/hooks/index.js
CHANGED
@@ -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 \"
|
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"}
|