@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
@@ -0,0 +1,27 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ApwChangeRequest, ApwContentReview, ApwContentTypes, ApwContext, ApwReviewerWithEmail, ApwWorkflow } from "./types";
3
+ export interface ApwChangeRequestNotificationCbParams {
4
+ context: ApwContext;
5
+ reviewers: ApwReviewerWithEmail[];
6
+ changeRequestUrl: string;
7
+ contentUrl: string;
8
+ changeRequest: ApwChangeRequest;
9
+ contentReview: ApwContentReview;
10
+ workflow: ApwWorkflow;
11
+ }
12
+ export interface ApwChangeRequestNotificationCbParamsResponse {
13
+ text: string;
14
+ html?: string;
15
+ }
16
+ export interface ApwChangeRequestNotificationCb {
17
+ (params: ApwChangeRequestNotificationCbParams): ApwChangeRequestNotificationCbParamsResponse | null | undefined;
18
+ }
19
+ export declare class ApwChangeRequestNotification extends Plugin {
20
+ static readonly type: string;
21
+ private readonly contentType;
22
+ private readonly cb;
23
+ constructor(contentType: ApwContentTypes, cb: ApwChangeRequestNotificationCb);
24
+ canUse(contentType: ApwContentTypes): boolean;
25
+ create(params: ApwChangeRequestNotificationCbParams): ApwChangeRequestNotificationCbParamsResponse | null | undefined;
26
+ }
27
+ export declare const createApwChangeRequestNotification: (contentType: ApwContentTypes, cb: ApwChangeRequestNotificationCb) => ApwChangeRequestNotification;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createApwChangeRequestNotification = exports.ApwChangeRequestNotification = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class ApwChangeRequestNotification extends _plugins.Plugin {
15
+ constructor(contentType, cb) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "contentType", void 0);
18
+ (0, _defineProperty2.default)(this, "cb", void 0);
19
+ this.contentType = contentType;
20
+ this.cb = cb;
21
+ }
22
+
23
+ canUse(contentType) {
24
+ return contentType === this.contentType;
25
+ }
26
+
27
+ create(params) {
28
+ return this.cb(params);
29
+ }
30
+
31
+ }
32
+
33
+ exports.ApwChangeRequestNotification = ApwChangeRequestNotification;
34
+ (0, _defineProperty2.default)(ApwChangeRequestNotification, "type", "apw.notification.changeRequest");
35
+
36
+ const createApwChangeRequestNotification = (contentType, cb) => {
37
+ return new ApwChangeRequestNotification(contentType, cb);
38
+ };
39
+
40
+ exports.createApwChangeRequestNotification = createApwChangeRequestNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ApwChangeRequestNotification","Plugin","constructor","contentType","cb","canUse","create","params","createApwChangeRequestNotification"],"sources":["ApwChangeRequestNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwChangeRequestNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n changeRequestUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwChangeRequestNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwChangeRequestNotificationCb {\n (params: ApwChangeRequestNotificationCbParams):\n | ApwChangeRequestNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwChangeRequestNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.changeRequest\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwChangeRequestNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwChangeRequestNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwChangeRequestNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwChangeRequestNotification = (\n contentType: ApwContentTypes,\n cb: ApwChangeRequestNotificationCb\n) => {\n return new ApwChangeRequestNotification(contentType, cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AA6BO,MAAMA,4BAAN,SAA2CC,eAA3C,CAAkD;EAM9CC,WAAW,CAACC,WAAD,EAA+BC,EAA/B,EAAmE;IACjF;IADiF;IAAA;IAEjF,KAAKD,WAAL,GAAmBA,WAAnB;IACA,KAAKC,EAAL,GAAUA,EAAV;EACH;;EAEMC,MAAM,CAACF,WAAD,EAAwC;IACjD,OAAOA,WAAW,KAAK,KAAKA,WAA5B;EACH;;EAEMG,MAAM,CAACC,MAAD,EAA+C;IACxD,OAAO,KAAKH,EAAL,CAAQG,MAAR,CAAP;EACH;;AAlBoD;;;8BAA5CP,4B,UACsC,gC;;AAoB5C,MAAMQ,kCAAkC,GAAG,CAC9CL,WAD8C,EAE9CC,EAF8C,KAG7C;EACD,OAAO,IAAIJ,4BAAJ,CAAiCG,WAAjC,EAA8CC,EAA9C,CAAP;AACH,CALM"}
@@ -0,0 +1,27 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ApwChangeRequest, ApwContentReview, ApwContentTypes, ApwContext, ApwReviewerWithEmail, ApwWorkflow } from "./types";
3
+ export interface ApwCommentNotificationCbParams {
4
+ context: ApwContext;
5
+ reviewers: ApwReviewerWithEmail[];
6
+ commentUrl: string;
7
+ contentUrl: string;
8
+ changeRequest: ApwChangeRequest;
9
+ contentReview: ApwContentReview;
10
+ workflow: ApwWorkflow;
11
+ }
12
+ export interface ApwCommentNotificationCbParamsResponse {
13
+ text: string;
14
+ html?: string;
15
+ }
16
+ export interface ApwCommentNotificationCb {
17
+ (params: ApwCommentNotificationCbParams): ApwCommentNotificationCbParamsResponse | null | undefined;
18
+ }
19
+ export declare class ApwCommentNotification extends Plugin {
20
+ static readonly type: string;
21
+ private readonly contentType;
22
+ private readonly cb;
23
+ constructor(contentType: ApwContentTypes, cb: ApwCommentNotificationCb);
24
+ canUse(contentType: ApwContentTypes): boolean;
25
+ create(params: ApwCommentNotificationCbParams): ApwCommentNotificationCbParamsResponse | null | undefined;
26
+ }
27
+ export declare const createApwCommentNotification: (contentType: ApwContentTypes, cb: ApwCommentNotificationCb) => ApwCommentNotification;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createApwCommentNotification = exports.ApwCommentNotification = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class ApwCommentNotification extends _plugins.Plugin {
15
+ constructor(contentType, cb) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "contentType", void 0);
18
+ (0, _defineProperty2.default)(this, "cb", void 0);
19
+ this.contentType = contentType;
20
+ this.cb = cb;
21
+ }
22
+
23
+ canUse(contentType) {
24
+ return contentType === this.contentType;
25
+ }
26
+
27
+ create(params) {
28
+ return this.cb(params);
29
+ }
30
+
31
+ }
32
+
33
+ exports.ApwCommentNotification = ApwCommentNotification;
34
+ (0, _defineProperty2.default)(ApwCommentNotification, "type", "apw.notification.comment");
35
+
36
+ const createApwCommentNotification = (contentType, cb) => {
37
+ return new ApwCommentNotification(contentType, cb);
38
+ };
39
+
40
+ exports.createApwCommentNotification = createApwCommentNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ApwCommentNotification","Plugin","constructor","contentType","cb","canUse","create","params","createApwCommentNotification"],"sources":["ApwCommentNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwCommentNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n commentUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwCommentNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwCommentNotificationCb {\n (params: ApwCommentNotificationCbParams):\n | ApwCommentNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwCommentNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.comment\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwCommentNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwCommentNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwCommentNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwCommentNotification = (\n contentType: ApwContentTypes,\n cb: ApwCommentNotificationCb\n) => {\n return new ApwCommentNotification(contentType, cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AA6BO,MAAMA,sBAAN,SAAqCC,eAArC,CAA4C;EAMxCC,WAAW,CAACC,WAAD,EAA+BC,EAA/B,EAA6D;IAC3E;IAD2E;IAAA;IAE3E,KAAKD,WAAL,GAAmBA,WAAnB;IACA,KAAKC,EAAL,GAAUA,EAAV;EACH;;EAEMC,MAAM,CAACF,WAAD,EAAwC;IACjD,OAAOA,WAAW,KAAK,KAAKA,WAA5B;EACH;;EAEMG,MAAM,CAACC,MAAD,EAAyC;IAClD,OAAO,KAAKH,EAAL,CAAQG,MAAR,CAAP;EACH;;AAlB8C;;;8BAAtCP,sB,UACsC,0B;;AAoB5C,MAAMQ,4BAA4B,GAAG,CACxCL,WADwC,EAExCC,EAFwC,KAGvC;EACD,OAAO,IAAIJ,sBAAJ,CAA2BG,WAA3B,EAAwCC,EAAxC,CAAP;AACH,CALM"}
@@ -0,0 +1,26 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ApwContentReview, ApwContentTypes, ApwContext, ApwReviewerWithEmail, ApwWorkflow } from "./types";
3
+ export interface ApwContentReviewNotificationCbParams {
4
+ context: ApwContext;
5
+ reviewers: ApwReviewerWithEmail[];
6
+ contentReviewUrl: string;
7
+ contentUrl: string;
8
+ contentReview: ApwContentReview;
9
+ workflow: ApwWorkflow;
10
+ }
11
+ export interface ApwContentReviewNotificationCbParamsResponse {
12
+ text: string;
13
+ html?: string;
14
+ }
15
+ export interface ApwContentReviewNotificationCb {
16
+ (params: ApwContentReviewNotificationCbParams): ApwContentReviewNotificationCbParamsResponse | null | undefined;
17
+ }
18
+ export declare class ApwContentReviewNotification extends Plugin {
19
+ static readonly type: string;
20
+ private readonly contentType;
21
+ private readonly cb;
22
+ constructor(contentType: ApwContentTypes, cb: ApwContentReviewNotificationCb);
23
+ canUse(contentType: ApwContentTypes): boolean;
24
+ create(params: ApwContentReviewNotificationCbParams): ApwContentReviewNotificationCbParamsResponse | null | undefined;
25
+ }
26
+ export declare const createApwContentReviewNotification: (contentType: ApwContentTypes, cb: ApwContentReviewNotificationCb) => ApwContentReviewNotification;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createApwContentReviewNotification = exports.ApwContentReviewNotification = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class ApwContentReviewNotification extends _plugins.Plugin {
15
+ constructor(contentType, cb) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "contentType", void 0);
18
+ (0, _defineProperty2.default)(this, "cb", void 0);
19
+ this.contentType = contentType;
20
+ this.cb = cb;
21
+ }
22
+
23
+ canUse(contentType) {
24
+ return contentType === this.contentType;
25
+ }
26
+
27
+ create(params) {
28
+ return this.cb(params);
29
+ }
30
+
31
+ }
32
+
33
+ exports.ApwContentReviewNotification = ApwContentReviewNotification;
34
+ (0, _defineProperty2.default)(ApwContentReviewNotification, "type", "apw.notification.contentReview");
35
+
36
+ const createApwContentReviewNotification = (contentType, cb) => {
37
+ return new ApwContentReviewNotification(contentType, cb);
38
+ };
39
+
40
+ exports.createApwContentReviewNotification = createApwContentReviewNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ApwContentReviewNotification","Plugin","constructor","contentType","cb","canUse","create","params","createApwContentReviewNotification"],"sources":["ApwContentReviewNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwContentReviewNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n contentReviewUrl: string;\n contentUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentReviewNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwContentReviewNotificationCb {\n (params: ApwContentReviewNotificationCbParams):\n | ApwContentReviewNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwContentReviewNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.contentReview\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwContentReviewNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentReviewNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwContentReviewNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwContentReviewNotification = (\n contentType: ApwContentTypes,\n cb: ApwContentReviewNotificationCb\n) => {\n return new ApwContentReviewNotification(contentType, cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AA2BO,MAAMA,4BAAN,SAA2CC,eAA3C,CAAkD;EAM9CC,WAAW,CAACC,WAAD,EAA+BC,EAA/B,EAAmE;IACjF;IADiF;IAAA;IAEjF,KAAKD,WAAL,GAAmBA,WAAnB;IACA,KAAKC,EAAL,GAAUA,EAAV;EACH;;EAEMC,MAAM,CAACF,WAAD,EAAwC;IACjD,OAAOA,WAAW,KAAK,KAAKA,WAA5B;EACH;;EAEMG,MAAM,CAACC,MAAD,EAA+C;IACxD,OAAO,KAAKH,EAAL,CAAQG,MAAR,CAAP;EACH;;AAlBoD;;;8BAA5CP,4B,UACsC,gC;;AAoB5C,MAAMQ,kCAAkC,GAAG,CAC9CL,WAD8C,EAE9CC,EAF8C,KAG7C;EACD,OAAO,IAAIJ,4BAAJ,CAAiCG,WAAjC,EAA8CC,EAA9C,CAAP;AACH,CALM"}
@@ -0,0 +1,19 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { ApwContentReview, ApwContentTypes, ApwWorkflow } from "./types";
3
+ export interface ApwContentUrlPluginCbParams {
4
+ baseUrl: string;
5
+ contentReview: ApwContentReview;
6
+ workflow: ApwWorkflow;
7
+ }
8
+ export interface ApwContentUrlPluginCb {
9
+ (params: ApwContentUrlPluginCbParams): string | null;
10
+ }
11
+ export declare class ApwContentUrlPlugin extends Plugin {
12
+ static type: string;
13
+ private readonly cb;
14
+ private readonly contentType;
15
+ constructor(contentType: ApwContentTypes, cb: ApwContentUrlPluginCb);
16
+ canUse(contentType: ApwContentTypes): boolean;
17
+ create(params: ApwContentUrlPluginCbParams): string | null;
18
+ }
19
+ export declare const createApwContentUrlPlugin: (contentType: ApwContentTypes, cb: ApwContentUrlPluginCb) => ApwContentUrlPlugin;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createApwContentUrlPlugin = exports.ApwContentUrlPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class ApwContentUrlPlugin extends _plugins.Plugin {
15
+ constructor(contentType, cb) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "cb", void 0);
18
+ (0, _defineProperty2.default)(this, "contentType", void 0);
19
+ this.contentType = contentType;
20
+ this.cb = cb;
21
+ }
22
+
23
+ canUse(contentType) {
24
+ return this.contentType === contentType;
25
+ }
26
+
27
+ create(params) {
28
+ return this.cb(params);
29
+ }
30
+
31
+ }
32
+
33
+ exports.ApwContentUrlPlugin = ApwContentUrlPlugin;
34
+ (0, _defineProperty2.default)(ApwContentUrlPlugin, "type", "apw.contentUrl");
35
+
36
+ const createApwContentUrlPlugin = (contentType, cb) => {
37
+ return new ApwContentUrlPlugin(contentType, cb);
38
+ };
39
+
40
+ exports.createApwContentUrlPlugin = createApwContentUrlPlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ApwContentUrlPlugin","Plugin","constructor","contentType","cb","canUse","create","params","createApwContentUrlPlugin"],"sources":["ApwContentUrlPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApwContentReview, ApwContentTypes, ApwWorkflow } from \"~/types\";\n\nexport interface ApwContentUrlPluginCbParams {\n baseUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentUrlPluginCb {\n (params: ApwContentUrlPluginCbParams): string | null;\n}\n\nexport class ApwContentUrlPlugin extends Plugin {\n public static override type = \"apw.contentUrl\";\n\n private readonly cb: ApwContentUrlPluginCb;\n private readonly contentType: ApwContentTypes;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentUrlPluginCb) {\n super();\n\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return this.contentType === contentType;\n }\n\n public create(params: ApwContentUrlPluginCbParams): string | null {\n return this.cb(params);\n }\n}\n\nexport const createApwContentUrlPlugin = (\n contentType: ApwContentTypes,\n cb: ApwContentUrlPluginCb\n) => {\n return new ApwContentUrlPlugin(contentType, cb);\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAYO,MAAMA,mBAAN,SAAkCC,eAAlC,CAAyC;EAMrCC,WAAW,CAACC,WAAD,EAA+BC,EAA/B,EAA0D;IACxE;IADwE;IAAA;IAGxE,KAAKD,WAAL,GAAmBA,WAAnB;IACA,KAAKC,EAAL,GAAUA,EAAV;EACH;;EAEMC,MAAM,CAACF,WAAD,EAAwC;IACjD,OAAO,KAAKA,WAAL,KAAqBA,WAA5B;EACH;;EAEMG,MAAM,CAACC,MAAD,EAAqD;IAC9D,OAAO,KAAKH,EAAL,CAAQG,MAAR,CAAP;EACH;;AAnB2C;;;8BAAnCP,mB,UACqB,gB;;AAqB3B,MAAMQ,yBAAyB,GAAG,CACrCL,WADqC,EAErCC,EAFqC,KAGpC;EACD,OAAO,IAAIJ,mBAAJ,CAAwBG,WAAxB,EAAqCC,EAArC,CAAP;AACH,CALM"}
@@ -49,7 +49,9 @@ function createContentReviewMethods(params) {
49
49
  const onContentReviewAfterUpdate = (0, _pubsub.createTopic)("apw.onContentReviewAfterUpdate"); // delete
50
50
 
51
51
  const onContentReviewBeforeDelete = (0, _pubsub.createTopic)("apw.onContentReviewBeforeDelete");
52
- const onContentReviewAfterDelete = (0, _pubsub.createTopic)("apw.onContentReviewAfterDelete");
52
+ const onContentReviewAfterDelete = (0, _pubsub.createTopic)("apw.onContentReviewAfterDelete"); // list
53
+
54
+ const onContentReviewBeforeList = (0, _pubsub.createTopic)("apw.onContentReviewBeforeList");
53
55
  return {
54
56
  /**
55
57
  * Lifecycle events
@@ -60,6 +62,7 @@ function createContentReviewMethods(params) {
60
62
  onContentReviewAfterUpdate,
61
63
  onContentReviewBeforeDelete,
62
64
  onContentReviewAfterDelete,
65
+ onContentReviewBeforeList,
63
66
 
64
67
  async get(id) {
65
68
  return storageOperations.getContentReview({
@@ -68,18 +71,25 @@ function createContentReviewMethods(params) {
68
71
  },
69
72
 
70
73
  async list(params) {
71
- var _params$where;
74
+ const where = params.where || {};
75
+ await onContentReviewBeforeList.publish({
76
+ where
77
+ });
72
78
 
73
- if (((_params$where = params.where) === null || _params$where === void 0 ? void 0 : _params$where.reviewStatus) === "requiresMyAttention") {
79
+ if (where.reviewStatus === "requiresMyAttention") {
74
80
  return (0, _utils2.filterContentReviewsByRequiresMyAttention)({
75
- listParams: params,
81
+ listParams: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
82
+ where
83
+ }),
76
84
  listContentReviews: storageOperations.listContentReviews,
77
85
  getReviewer,
78
86
  getIdentity
79
87
  });
80
88
  }
81
89
 
82
- return storageOperations.listContentReviews(params);
90
+ return storageOperations.listContentReviews((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
91
+ where
92
+ }));
83
93
  },
84
94
 
85
95
  async create(data) {
@@ -1 +1 @@
1
- {"version":3,"names":["createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","get","id","getContentReview","list","where","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","publish","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","NoSignOffProvidedError","isReviewRequired","contentGetter","content","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduledActionId","scheduleAction","scheduledOn","scheduledBy","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n if (params.where?.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: params,\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews(params);\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIA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CAA4BxG,EAA5B,EAAgC;MAC5B,MAAMc,aAAa,GAAG,MAAM,KAAKf,GAAL,CAASC,EAAT,CAA5B;MACA,MAAMmF,iBAAiB,GAAG,IAAApF,YAAA,EAAIe,aAAJ,EAAmB,2BAAnB,CAA1B;MAEA;AACZ;AACA;;MACY,IAAI,CAACqE,iBAAL,EAAwB;QACpB,MAAM,IAAIV,cAAJ,CAAU;UACZC,OAAO,EAAG,kDADE;UAEZC,IAAI,EAAE,qBAFM;UAGZlE,IAAI,EAAE;YACFT;UADE;QAHM,CAAV,CAAN;MAOH;MACD;AACZ;AACA;;;MACY,MAAMb,SAAS,CAACgC,MAAV,CAAiBgE,iBAAjB,CAAN;MAEA;AACZ;AACA;;MACY,MAAM,KAAKnE,MAAL,CAAYhB,EAAZ,EAAgB;QAClB+D,OAAO,8DACAjD,aAAa,CAACiD,OADd,GAEA0C,oDAFA;MADW,CAAhB,CAAN;MAOA,OAAO,IAAP;IACH;;EAzaE,CAAP;AA2aH"}
1
+ {"version":3,"names":["createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","onContentReviewBeforeList","get","id","getContentReview","list","where","publish","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","NoSignOffProvidedError","isReviewRequired","contentGetter","content","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduledActionId","scheduleAction","scheduledOn","scheduledBy","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeListTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n // list\n const onContentReviewBeforeList = createTopic<OnContentReviewBeforeListTopicParams>(\n \"apw.onContentReviewBeforeList\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n onContentReviewBeforeList,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n const where = params.where || {};\n\n await onContentReviewBeforeList.publish({\n where\n });\n\n if (where.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: {\n ...params,\n where\n },\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews({\n ...params,\n where\n });\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n }\n });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAoBA;;AACA;;AAOA;;AACA;;AAMA;;AAWO,SAASA,0BAAT,CACHC,MADG,EAEiB;EACpB,MAAM;IACFC,WADE;IAEFC,iBAFE;IAGFC,WAHE;IAIFC,gBAJE;IAKFC,mBALE;IAMFC,qBANE;IAOFC,SAPE;IAQFC,aARE;IASFC,SATE;IAUFC,SAVE;IAWFC;EAXE,IAYFX,MAZJ,CADoB,CAepB;;EACA,MAAMY,2BAA2B,GAAG,IAAAC,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMC,0BAA0B,GAAG,IAAAD,mBAAA,EAC/B,gCAD+B,CAAnC,CAnBoB,CAsBpB;;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMG,0BAA0B,GAAG,IAAAH,mBAAA,EAC/B,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AS,CAACiC,MAAV,CAAiBgE,iBAAjB,CAAN;MAEA;AACZ;AACA;;MACY,MAAM,KAAKnE,MAAL,CAAYhB,EAAZ,EAAgB;QAClB+D,OAAO,8DACAjD,aAAa,CAACiD,OADd,GAEA0C,oDAFA;MADW,CAAhB,CAAN;MAOA,OAAO,IAAP;IACH;;EAtbE,CAAP;AAwbH"}
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { CreateApwContextParams } from "./scheduler/types";
2
- export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
3
- export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection)[];
4
- export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>;
2
+ export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection)[];
3
+ export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
4
+ export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
package/index.js CHANGED
@@ -13,24 +13,26 @@ var _context = require("./plugins/context");
13
13
 
14
14
  var _apiMailer = require("@webiny/api-mailer");
15
15
 
16
+ var _apiAdminSettings = require("@webiny/api-admin-settings");
17
+
16
18
  /**
17
19
  * We have separated context and GraphQL creation so user can initialize only context if required.
18
20
  * GraphQL will not work without context, but context will without GraphQL.
19
21
  */
20
22
  const createApwHeadlessCmsContext = params => {
21
- return [(0, _context.createApwHeadlessCmsContext)(params)];
23
+ return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
22
24
  };
23
25
 
24
26
  exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
25
27
 
26
28
  const createApwPageBuilderContext = params => {
27
- return [...(0, _apiMailer.createMailer)(), (0, _context.createApwPageBuilderContext)(params)];
29
+ return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
28
30
  };
29
31
 
30
32
  exports.createApwPageBuilderContext = createApwPageBuilderContext;
31
33
 
32
34
  const createApwGraphQL = () => {
33
- return (0, _graphql.default)();
35
+ return [(0, _graphql.default)()];
34
36
  };
35
37
 
36
38
  exports.createApwGraphQL = createApwGraphQL;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createApwHeadlessCmsContext","params","createHeadlessCms","createApwPageBuilderContext","createMailer","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailer } from \"@webiny/api-mailer\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [...createMailer(), createPageBuilder(params)];\n};\n\nexport const createApwGraphQL = () => {\n return graphql();\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AAVA;AACA;AACA;AACA;AASO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,IAAAC,oCAAA,EAAkBD,MAAlB,CAAD,CAAP;AACH,CAFM;;;;AAIA,MAAME,2BAA2B,GAAIF,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAG,uBAAA,GAAJ,EAAoB,IAAAC,oCAAA,EAAkBJ,MAAlB,CAApB,CAAP;AACH,CAFM;;;;AAIA,MAAMK,gBAAgB,GAAG,MAAM;EAClC,OAAO,IAAAC,gBAAA,GAAP;AACH,CAFM"}
1
+ {"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAC,4CAAA,GAAJ,EAAkC,GAAG,IAAAC,8BAAA,GAArC,EAA4D,IAAAC,oCAAA,EAAkBH,MAAlB,CAA5D,CAAP;AACH,CAFM;;;;AAIA,MAAMI,2BAA2B,GAAIJ,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAG,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBN,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMO,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}