@webiny/api-apw 0.0.0-unstable.8c4d9f045a → 0.0.0-unstable.97a151f74d
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/ContentApwSettingsPlugin.js +1 -1
- package/crud/createChangeRequestMethods.js +21 -18
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +21 -18
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +60 -50
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +21 -18
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js +42 -20
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +3 -7
- package/crud/index.js.map +1 -1
- package/crud/utils.js +4 -8
- package/crud/utils.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +8 -4
- package/index.js.map +1 -1
- package/package.json +38 -37
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +1 -1
- package/plugins/cms/apwEntryPlugins.js +4 -8
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +9 -1
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +4 -4
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +5 -5
- package/plugins/cms/linkWorkflowToEntry.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/cms/triggerContentReview.js +3 -3
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +10 -14
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js +4 -8
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.js +1 -1
- package/plugins/graphql/changeRequest.gql.js +1 -1
- package/plugins/graphql/comment.gql.js +1 -1
- package/plugins/graphql/contentReview.gql.js +4 -4
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +3 -1
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +1 -1
- package/plugins/graphql.js +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +28 -8
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +6 -0
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +5 -8
- package/plugins/hooks/initializeContentReviewSteps.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 +10 -0
- package/plugins/hooks/listContentReviews.js +68 -0
- package/plugins/hooks/listContentReviews.js.map +1 -0
- 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/updatePendingChangeRequests.js +7 -11
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +14 -18
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +30 -5
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +14 -4
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +2 -2
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +1 -1
- package/plugins/pageBuilder/index.js +9 -1
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +41 -29
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +18 -6
- 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/triggerContentReview.js +3 -3
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +10 -14
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js +1 -1
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +1 -1
- package/plugins/utils.js +4 -14
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +17 -14
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js +8 -9
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +5 -9
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +1 -1
- package/scheduler/handlers/utils.js +1 -1
- package/storageOperations/changeRequestStorageOperations.js +5 -9
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +4 -8
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +5 -9
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js +5 -9
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.js +3 -7
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +6 -5
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +1 -1
- package/storageOperations/models/reviewer.model.js +18 -2
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +3 -2
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +18 -14
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +8 -12
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +99 -84
- package/types.js.map +1 -1
- package/utils/errors.js +1 -1
- package/utils/fieldResolver.js +3 -9
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.d.ts +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"}
|
@@ -10,12 +10,15 @@ var _pubsub = require("@webiny/pubsub");
|
|
10
10
|
function createChangeRequestMethods({
|
11
11
|
storageOperations
|
12
12
|
}) {
|
13
|
-
|
14
|
-
const
|
15
|
-
const
|
16
|
-
|
17
|
-
const
|
18
|
-
const
|
13
|
+
// create
|
14
|
+
const onChangeRequestBeforeCreate = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeCreate");
|
15
|
+
const onChangeRequestAfterCreate = (0, _pubsub.createTopic)("apw.onChangeRequestAfterCreate"); // update
|
16
|
+
|
17
|
+
const onChangeRequestBeforeUpdate = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeUpdate");
|
18
|
+
const onChangeRequestAfterUpdate = (0, _pubsub.createTopic)("apw.onChangeRequestAfterUpdate"); // delete
|
19
|
+
|
20
|
+
const onChangeRequestBeforeDelete = (0, _pubsub.createTopic)("apw.onChangeRequestBeforeDelete");
|
21
|
+
const onChangeRequestAfterDelete = (0, _pubsub.createTopic)("apw.onChangeRequestAfterDelete");
|
19
22
|
return {
|
20
23
|
async get(id) {
|
21
24
|
return storageOperations.getChangeRequest({
|
@@ -28,13 +31,13 @@ function createChangeRequestMethods({
|
|
28
31
|
},
|
29
32
|
|
30
33
|
async create(data) {
|
31
|
-
await
|
34
|
+
await onChangeRequestBeforeCreate.publish({
|
32
35
|
input: data
|
33
36
|
});
|
34
37
|
const changeRequest = await storageOperations.createChangeRequest({
|
35
38
|
data
|
36
39
|
});
|
37
|
-
await
|
40
|
+
await onChangeRequestAfterCreate.publish({
|
38
41
|
changeRequest
|
39
42
|
});
|
40
43
|
return changeRequest;
|
@@ -44,7 +47,7 @@ function createChangeRequestMethods({
|
|
44
47
|
const original = await storageOperations.getChangeRequest({
|
45
48
|
id
|
46
49
|
});
|
47
|
-
await
|
50
|
+
await onChangeRequestBeforeUpdate.publish({
|
48
51
|
original,
|
49
52
|
input: {
|
50
53
|
id,
|
@@ -55,7 +58,7 @@ function createChangeRequestMethods({
|
|
55
58
|
id,
|
56
59
|
data
|
57
60
|
});
|
58
|
-
await
|
61
|
+
await onChangeRequestAfterUpdate.publish({
|
59
62
|
original,
|
60
63
|
input: {
|
61
64
|
id,
|
@@ -70,13 +73,13 @@ function createChangeRequestMethods({
|
|
70
73
|
const changeRequest = await storageOperations.getChangeRequest({
|
71
74
|
id
|
72
75
|
});
|
73
|
-
await
|
76
|
+
await onChangeRequestBeforeDelete.publish({
|
74
77
|
changeRequest
|
75
78
|
});
|
76
79
|
await storageOperations.deleteChangeRequest({
|
77
80
|
id
|
78
81
|
});
|
79
|
-
await
|
82
|
+
await onChangeRequestAfterDelete.publish({
|
80
83
|
changeRequest
|
81
84
|
});
|
82
85
|
return true;
|
@@ -85,11 +88,11 @@ function createChangeRequestMethods({
|
|
85
88
|
/**
|
86
89
|
* Lifecycle events
|
87
90
|
*/
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
onChangeRequestBeforeCreate,
|
92
|
+
onChangeRequestAfterCreate,
|
93
|
+
onChangeRequestBeforeUpdate,
|
94
|
+
onChangeRequestAfterUpdate,
|
95
|
+
onChangeRequestBeforeDelete,
|
96
|
+
onChangeRequestAfterDelete
|
94
97
|
};
|
95
98
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createChangeRequestMethods","storageOperations","
|
1
|
+
{"version":3,"names":["createChangeRequestMethods","storageOperations","onChangeRequestBeforeCreate","createTopic","onChangeRequestAfterCreate","onChangeRequestBeforeUpdate","onChangeRequestAfterUpdate","onChangeRequestBeforeDelete","onChangeRequestAfterDelete","get","id","getChangeRequest","list","params","listChangeRequests","create","data","publish","input","changeRequest","createChangeRequest","update","original","updateChangeRequest","delete","deleteChangeRequest"],"sources":["createChangeRequestMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwChangeRequestCrud,\n CreateApwParams,\n OnChangeRequestAfterCreateTopicParams,\n OnChangeRequestAfterDeleteTopicParams,\n OnChangeRequestAfterUpdateTopicParams,\n OnChangeRequestBeforeCreateTopicParams,\n OnChangeRequestBeforeDeleteTopicParams,\n OnChangeRequestBeforeUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n // create\n const onChangeRequestBeforeCreate = createTopic<OnChangeRequestBeforeCreateTopicParams>(\n \"apw.onChangeRequestBeforeCreate\"\n );\n const onChangeRequestAfterCreate = createTopic<OnChangeRequestAfterCreateTopicParams>(\n \"apw.onChangeRequestAfterCreate\"\n );\n // update\n const onChangeRequestBeforeUpdate = createTopic<OnChangeRequestBeforeUpdateTopicParams>(\n \"apw.onChangeRequestBeforeUpdate\"\n );\n const onChangeRequestAfterUpdate = createTopic<OnChangeRequestAfterUpdateTopicParams>(\n \"apw.onChangeRequestAfterUpdate\"\n );\n // delete\n const onChangeRequestBeforeDelete = createTopic<OnChangeRequestBeforeDeleteTopicParams>(\n \"apw.onChangeRequestBeforeDelete\"\n );\n const onChangeRequestAfterDelete = createTopic<OnChangeRequestAfterDeleteTopicParams>(\n \"apw.onChangeRequestAfterDelete\"\n );\n\n return {\n async get(id) {\n return storageOperations.getChangeRequest({ id });\n },\n async list(params) {\n return storageOperations.listChangeRequests(params);\n },\n async create(data) {\n await onChangeRequestBeforeCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onChangeRequestAfterCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onChangeRequestAfterUpdate.publish({\n original,\n input: { id, data },\n changeRequest\n });\n\n return changeRequest;\n },\n async delete(id: string) {\n const changeRequest = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onChangeRequestAfterDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate,\n onChangeRequestAfterCreate,\n onChangeRequestBeforeUpdate,\n onChangeRequestAfterUpdate,\n onChangeRequestBeforeDelete,\n onChangeRequestAfterDelete\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAYO,SAASA,0BAAT,CAAoC;EACvCC;AADuC,CAApC,EAEmC;EACtC;EACA,MAAMC,2BAA2B,GAAG,IAAAC,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMC,0BAA0B,GAAG,IAAAD,mBAAA,EAC/B,gCAD+B,CAAnC,CALsC,CAQtC;;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMG,0BAA0B,GAAG,IAAAH,mBAAA,EAC/B,gCAD+B,CAAnC,CAZsC,CAetC;;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAA,EAChC,iCADgC,CAApC;EAGA,MAAMK,0BAA0B,GAAG,IAAAL,mBAAA,EAC/B,gCAD+B,CAAnC;EAIA,OAAO;IACH,MAAMM,GAAN,CAAUC,EAAV,EAAc;M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AN;MAEA,MAAMlB,iBAAiB,CAACwB,mBAAlB,CAAsC;QAAEf;MAAF,CAAtC,CAAN;MAEA,MAAMF,0BAA0B,CAACS,OAA3B,CAAmC;QAAEE;MAAF,CAAnC,CAAN;MAEA,OAAO,IAAP;IACH,CAzCE;;IA0CH;AACR;AACA;IACQjB,2BA7CG;IA8CHE,0BA9CG;IA+CHC,2BA/CG;IAgDHC,0BAhDG;IAiDHC,2BAjDG;IAkDHC;EAlDG,CAAP;AAoDH"}
|
@@ -10,22 +10,25 @@ var _pubsub = require("@webiny/pubsub");
|
|
10
10
|
function createCommentMethods({
|
11
11
|
storageOperations
|
12
12
|
}) {
|
13
|
-
|
14
|
-
const
|
15
|
-
const
|
16
|
-
|
17
|
-
const
|
18
|
-
const
|
13
|
+
// create
|
14
|
+
const onCommentBeforeCreate = (0, _pubsub.createTopic)("apw.onCommentBeforeCreate");
|
15
|
+
const onCommentAfterCreate = (0, _pubsub.createTopic)("apw.onCommentAfterCreate"); // update
|
16
|
+
|
17
|
+
const onCommentBeforeUpdate = (0, _pubsub.createTopic)("apw.onCommentBeforeUpdate");
|
18
|
+
const onCommentAfterUpdate = (0, _pubsub.createTopic)("apw.onCommentAfterUpdate"); // delete
|
19
|
+
|
20
|
+
const onCommentBeforeDelete = (0, _pubsub.createTopic)("apw.onCommentBeforeDelete");
|
21
|
+
const onCommentAfterDelete = (0, _pubsub.createTopic)("apw.onCommentAfterDelete");
|
19
22
|
return {
|
20
23
|
/**
|
21
24
|
* Lifecycle events
|
22
25
|
*/
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
onCommentBeforeCreate,
|
27
|
+
onCommentAfterCreate,
|
28
|
+
onCommentBeforeUpdate,
|
29
|
+
onCommentAfterUpdate,
|
30
|
+
onCommentBeforeDelete,
|
31
|
+
onCommentAfterDelete,
|
29
32
|
|
30
33
|
async get(id) {
|
31
34
|
return storageOperations.getComment({
|
@@ -38,13 +41,13 @@ function createCommentMethods({
|
|
38
41
|
},
|
39
42
|
|
40
43
|
async create(data) {
|
41
|
-
await
|
44
|
+
await onCommentBeforeCreate.publish({
|
42
45
|
input: data
|
43
46
|
});
|
44
47
|
const comment = await storageOperations.createComment({
|
45
48
|
data
|
46
49
|
});
|
47
|
-
await
|
50
|
+
await onCommentAfterCreate.publish({
|
48
51
|
comment
|
49
52
|
});
|
50
53
|
return comment;
|
@@ -54,7 +57,7 @@ function createCommentMethods({
|
|
54
57
|
const original = await storageOperations.getComment({
|
55
58
|
id
|
56
59
|
});
|
57
|
-
await
|
60
|
+
await onCommentBeforeUpdate.publish({
|
58
61
|
original,
|
59
62
|
input: {
|
60
63
|
id,
|
@@ -65,7 +68,7 @@ function createCommentMethods({
|
|
65
68
|
id,
|
66
69
|
data
|
67
70
|
});
|
68
|
-
await
|
71
|
+
await onCommentAfterUpdate.publish({
|
69
72
|
original,
|
70
73
|
comment,
|
71
74
|
input: {
|
@@ -80,13 +83,13 @@ function createCommentMethods({
|
|
80
83
|
const comment = await storageOperations.getComment({
|
81
84
|
id
|
82
85
|
});
|
83
|
-
await
|
86
|
+
await onCommentBeforeDelete.publish({
|
84
87
|
comment
|
85
88
|
});
|
86
89
|
await storageOperations.deleteComment({
|
87
90
|
id
|
88
91
|
});
|
89
|
-
await
|
92
|
+
await onCommentAfterDelete.publish({
|
90
93
|
comment
|
91
94
|
});
|
92
95
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createCommentMethods","storageOperations","
|
1
|
+
{"version":3,"names":["createCommentMethods","storageOperations","onCommentBeforeCreate","createTopic","onCommentAfterCreate","onCommentBeforeUpdate","onCommentAfterUpdate","onCommentBeforeDelete","onCommentAfterDelete","get","id","getComment","list","params","listComments","create","data","publish","input","comment","createComment","update","original","updateComment","delete","deleteComment"],"sources":["createCommentMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwCommentCrud,\n CreateApwParams,\n OnCommentBeforeCreateTopicParams,\n OnCommentAfterCreateTopicParams,\n OnCommentBeforeUpdateTopicParams,\n OnCommentAfterUpdateTopicParams,\n OnCommentBeforeDeleteTopicParams,\n OnCommentAfterDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n // create\n const onCommentBeforeCreate = createTopic<OnCommentBeforeCreateTopicParams>(\n \"apw.onCommentBeforeCreate\"\n );\n const onCommentAfterCreate = createTopic<OnCommentAfterCreateTopicParams>(\n \"apw.onCommentAfterCreate\"\n );\n // update\n const onCommentBeforeUpdate = createTopic<OnCommentBeforeUpdateTopicParams>(\n \"apw.onCommentBeforeUpdate\"\n );\n const onCommentAfterUpdate = createTopic<OnCommentAfterUpdateTopicParams>(\n \"apw.onCommentAfterUpdate\"\n );\n // delete\n const onCommentBeforeDelete = createTopic<OnCommentBeforeDeleteTopicParams>(\n \"apw.onCommentBeforeDelete\"\n );\n const onCommentAfterDelete = createTopic<OnCommentAfterDeleteTopicParams>(\n \"apw.onCommentAfterDelete\"\n );\n\n return {\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate,\n onCommentAfterCreate,\n onCommentBeforeUpdate,\n onCommentAfterUpdate,\n onCommentBeforeDelete,\n onCommentAfterDelete,\n async get(id) {\n return storageOperations.getComment({ id });\n },\n async list(params) {\n return storageOperations.listComments(params);\n },\n async create(data) {\n await onCommentBeforeCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onCommentAfterCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onCommentBeforeUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onCommentAfterUpdate.publish({ original, comment, input: { id, data } });\n\n return comment;\n },\n async delete(id: string) {\n const comment = await storageOperations.getComment({ id });\n\n await onCommentBeforeDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onCommentAfterDelete.publish({ comment });\n\n return true;\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