@webiny/api-apw 0.0.0-unstable.e3f4727c56 → 0.0.0-unstable.eb196ccd2f
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 +1 -1
- package/ApwChangeRequestNotification.js +4 -6
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.d.ts +1 -1
- package/ApwCommentNotification.js +4 -6
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.d.ts +1 -1
- package/ApwContentReviewNotification.js +4 -6
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.d.ts +1 -1
- package/ApwContentUrlPlugin.js +4 -6
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.d.ts +1 -1
- package/ContentApwSettingsPlugin.js +5 -4
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/README.md +3 -3
- package/crud/createChangeRequestMethods.d.ts +1 -1
- package/crud/createChangeRequestMethods.js +3 -1
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.d.ts +1 -1
- package/crud/createCommentMethods.js +3 -1
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.d.ts +2 -2
- package/crud/createContentReviewMethods.js +57 -32
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.d.ts +1 -1
- package/crud/createReviewerMethods.js +3 -1
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js +3 -1
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.d.ts +1 -1
- package/crud/index.js +6 -5
- package/crud/index.js.map +1 -1
- package/crud/utils.d.ts +2 -2
- package/crud/utils.js +8 -8
- package/crud/utils.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +7 -6
- package/index.js.map +1 -1
- package/package.json +32 -50
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +5 -5
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.d.ts +2 -2
- package/plugins/cms/apwEntryPlugins.js +19 -7
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.d.ts +4 -4
- package/plugins/cms/index.js +3 -1
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
- package/plugins/cms/linkContentReviewToEntry.js +5 -4
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
- package/plugins/cms/linkWorkflowToEntry.js +17 -16
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js +3 -1
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js +3 -1
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js +3 -1
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js +3 -1
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.d.ts +2 -2
- package/plugins/cms/triggerContentReview.js +6 -5
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
- package/plugins/cms/updateContentReviewStatus.js +15 -13
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +5 -4
- package/plugins/cms/utils.js +19 -13
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +3 -3
- package/plugins/context.js +5 -14
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.d.ts +1 -1
- package/plugins/graphql/changeRequest.gql.js +16 -13
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.d.ts +1 -1
- package/plugins/graphql/comment.gql.js +41 -36
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.d.ts +1 -1
- package/plugins/graphql/contentReview.gql.js +26 -17
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.d.ts +1 -1
- package/plugins/graphql/reviewer.gql.js +15 -13
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.d.ts +2 -0
- package/plugins/graphql/utils.js +10 -0
- package/plugins/graphql/utils.js.map +1 -0
- package/plugins/graphql/workflow.gql.d.ts +1 -1
- package/plugins/graphql/workflow.gql.js +15 -13
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.d.ts +1 -1
- package/plugins/graphql.js +4 -2
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +4 -2
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.d.ts +1 -1
- package/plugins/hooks/index.js +3 -1
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +6 -4
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +1 -1
- package/plugins/hooks/initializeNotifications.js +3 -1
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.d.ts +3 -3
- package/plugins/hooks/listContentReviews.js +4 -2
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +8 -11
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestUrl.js +3 -1
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +8 -11
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentUrl.js +3 -1
- package/plugins/hooks/notifications/commentUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +9 -12
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewUrl.js +3 -1
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.d.ts +2 -2
- package/plugins/hooks/notifications/contentUrl.js +3 -1
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/getAppUrl.d.ts +2 -0
- package/plugins/hooks/notifications/getAppUrl.js +19 -0
- package/plugins/hooks/notifications/getAppUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +3 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +3 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +3 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.d.ts +1 -1
- package/plugins/hooks/notifications/reviewers.js +18 -15
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +3 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js +3 -1
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js +3 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +8 -6
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.d.ts +1 -1
- package/plugins/hooks/updateTotalComments.js +22 -15
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.d.ts +1 -1
- package/plugins/hooks/validateChangeRequest.js +3 -1
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.d.ts +1 -1
- package/plugins/hooks/validateComment.js +3 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.d.ts +1 -1
- package/plugins/hooks/validateContentReview.js +3 -1
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/utils.d.ts +7 -6
- package/plugins/utils.js +12 -8
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.d.ts +1 -1
- package/scheduler/createScheduleActionMethods.js +105 -66
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +2 -2
- package/scheduler/handlers/executeAction/index.js +30 -9
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +5 -4
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +6 -7
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +3 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -7
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.d.ts +2 -2
- package/scheduler/handlers/executeAction/security.js +3 -1
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +2 -2
- package/scheduler/handlers/scheduleAction/index.js +20 -15
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +19 -14
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +2 -3
- package/scheduler/handlers/utils.js +20 -13
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.d.ts +1 -1
- package/scheduler/index.js +3 -1
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +20 -36
- package/scheduler/types.js +11 -17
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
- package/storageOperations/changeRequestStorageOperations.js +44 -23
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.d.ts +3 -3
- package/storageOperations/commentStorageOperations.js +17 -24
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
- package/storageOperations/contentReviewStorageOperations.js +20 -25
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +3 -9
- package/storageOperations/index.js +11 -16
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -2
- package/storageOperations/models/changeRequest.model.js +10 -11
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -2
- package/storageOperations/models/comment.model.js +10 -11
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -2
- package/storageOperations/models/contentReview.model.js +16 -15
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.d.ts +1 -1
- package/storageOperations/models/index.js +11 -31
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -2
- package/storageOperations/models/reviewer.model.js +11 -12
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.d.ts +2 -2
- package/storageOperations/models/utils.js +3 -1
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +2 -3
- package/storageOperations/models/workflow.model.js +22 -23
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +3 -3
- package/storageOperations/reviewerStorageOperations.js +24 -34
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.d.ts +2 -2
- package/storageOperations/types.js +3 -1
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.d.ts +2 -2
- package/storageOperations/workflowStorageOperations.js +25 -28
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +49 -64
- package/types.js +121 -29
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.d.ts +2 -2
- package/utils/contentApwSettingsPlugin.js +3 -1
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +3 -1
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.d.ts +2 -2
- package/utils/fieldResolver.js +7 -7
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +3 -0
- package/utils/pickEntryFieldValues.js +30 -0
- package/utils/pickEntryFieldValues.js.map +1 -0
- package/utils/resolve.js +3 -1
- package/utils/resolve.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +0 -2
- package/plugins/hooks/notifications/appUrl.js +0 -18
- package/plugins/hooks/notifications/appUrl.js.map +0 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -36
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -26
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -20
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
- package/plugins/pageBuilder/index.d.ts +0 -11
- package/plugins/pageBuilder/index.js +0 -42
- package/plugins/pageBuilder/index.js.map +0 -1
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkContentReviewToPage.js +0 -89
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkWorkflowToPage.js +0 -164
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -31
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +0 -31
- package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -31
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +0 -47
- package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
- package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
- package/plugins/pageBuilder/triggerContentReview.js +0 -39
- package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
- package/plugins/pageBuilder/updateContentReviewStatus.js +0 -67
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
- package/plugins/pageBuilder/utils.d.ts +0 -22
- package/plugins/pageBuilder/utils.js +0 -150
- package/plugins/pageBuilder/utils.js.map +0 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +0 -8
- package/storageOperations/models/contentModelPluginFactory.js +0 -19
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -1,11 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
5
4
|
value: true
|
6
5
|
});
|
7
6
|
exports.updateContentReviewStatus = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
7
|
var _types = require("../../types");
|
10
8
|
var _utils = require("../../crud/utils");
|
11
9
|
var _utils2 = require("./utils");
|
@@ -19,11 +17,10 @@ const updateContentReviewStatus = params => {
|
|
19
17
|
entry,
|
20
18
|
model
|
21
19
|
}) => {
|
22
|
-
|
23
|
-
if ((0, _utils2.isAwpModel)(model)) {
|
20
|
+
if ((0, _utils2.isApwDisabledOnModel)(model)) {
|
24
21
|
return;
|
25
22
|
}
|
26
|
-
const contentReviewId =
|
23
|
+
const contentReviewId = entry.meta?.apw?.contentReviewId;
|
27
24
|
/**
|
28
25
|
* Bail out if there is no "content review" linked.
|
29
26
|
*/
|
@@ -40,20 +37,21 @@ const updateContentReviewStatus = params => {
|
|
40
37
|
}
|
41
38
|
await apw.contentReview.update(contentReviewId, {
|
42
39
|
reviewStatus: _types.ApwContentReviewStatus.PUBLISHED,
|
43
|
-
content:
|
40
|
+
content: {
|
41
|
+
...contentReview.content,
|
42
|
+
..._utils.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,
|
44
43
|
publishedBy: identity.id
|
45
|
-
}
|
44
|
+
}
|
46
45
|
});
|
47
46
|
});
|
48
47
|
cms.onEntryAfterUnpublish.subscribe(async ({
|
49
48
|
entry,
|
50
49
|
model
|
51
50
|
}) => {
|
52
|
-
|
53
|
-
if ((0, _utils2.isAwpModel)(model)) {
|
51
|
+
if ((0, _utils2.isApwDisabledOnModel)(model)) {
|
54
52
|
return;
|
55
53
|
}
|
56
|
-
const contentReviewId =
|
54
|
+
const contentReviewId = entry.meta?.apw?.contentReviewId;
|
57
55
|
/**
|
58
56
|
* Bail out if there is no "content review" linked.
|
59
57
|
*/
|
@@ -70,10 +68,14 @@ const updateContentReviewStatus = params => {
|
|
70
68
|
}
|
71
69
|
await apw.contentReview.update(contentReviewId, {
|
72
70
|
reviewStatus: _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED,
|
73
|
-
content:
|
71
|
+
content: {
|
72
|
+
...contentReview.content,
|
73
|
+
..._utils.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,
|
74
74
|
publishedBy: null
|
75
|
-
}
|
75
|
+
}
|
76
76
|
});
|
77
77
|
});
|
78
78
|
};
|
79
|
-
exports.updateContentReviewStatus = updateContentReviewStatus;
|
79
|
+
exports.updateContentReviewStatus = updateContentReviewStatus;
|
80
|
+
|
81
|
+
//# sourceMappingURL=updateContentReviewStatus.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["updateContentReviewStatus","params","apw","cms","security","onEntryAfterPublish","subscribe","entry","model","
|
1
|
+
{"version":3,"names":["_types","require","_utils","_utils2","updateContentReviewStatus","params","apw","cms","security","onEntryAfterPublish","subscribe","entry","model","isApwDisabledOnModel","contentReviewId","meta","contentReview","get","identity","getIdentity","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED","update","PUBLISHED","content","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","publishedBy","id","onEntryAfterUnpublish","exports"],"sources":["updateContentReviewStatus.ts"],"sourcesContent":["import type {\n AdvancedPublishingWorkflow,\n OnCmsEntryAfterPublishTopicParams,\n OnCmsEntryAfterUnpublishTopicParams\n} from \"~/types\";\nimport { ApwContentReviewStatus } from \"~/types\";\nimport { INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META } from \"~/crud/utils\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { Security } from \"@webiny/api-security/types\";\nimport { isApwDisabledOnModel } from \"~/plugins/cms/utils\";\n\ninterface UpdateContentReviewStatusParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\n\nexport const updateContentReviewStatus = (params: UpdateContentReviewStatusParams) => {\n const { apw, cms, security } = params;\n\n cms.onEntryAfterPublish.subscribe<OnCmsEntryAfterPublishTopicParams>(\n async ({ entry, model }) => {\n if (isApwDisabledOnModel(model)) {\n return;\n }\n const contentReviewId = entry.meta?.apw?.contentReviewId;\n /**\n * Bail out if there is no \"content review\" linked.\n */\n if (!contentReviewId) {\n return;\n }\n\n const contentReview = await apw.contentReview.get(contentReviewId);\n const identity = security.getIdentity();\n /**\n * If content review is \"readyToBePublished set its status as \"published\" after page publish.\n */\n if (contentReview.reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n return;\n }\n await apw.contentReview.update(contentReviewId, {\n reviewStatus: ApwContentReviewStatus.PUBLISHED,\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,\n publishedBy: identity.id\n }\n });\n }\n );\n cms.onEntryAfterUnpublish.subscribe<OnCmsEntryAfterUnpublishTopicParams>(\n async ({ entry, model }) => {\n if (isApwDisabledOnModel(model)) {\n return;\n }\n const contentReviewId = entry.meta?.apw?.contentReviewId;\n /**\n * Bail out if there is no \"content review\" linked.\n */\n if (!contentReviewId) {\n return;\n }\n\n const contentReview = await apw.contentReview.get(contentReviewId);\n /**\n * If content review is \"published set its status as \"readyToBePublished\" after page unpublish.\n */\n\n if (contentReview.reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n return;\n }\n await apw.contentReview.update(contentReviewId, {\n reviewStatus: ApwContentReviewStatus.READY_TO_BE_PUBLISHED,\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,\n publishedBy: null\n }\n });\n }\n );\n};\n"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,OAAA,GAAAF,OAAA;AAQO,MAAMG,yBAAyB,GAAIC,MAAuC,IAAK;EAClF,MAAM;IAAEC,GAAG;IAAEC,GAAG;IAAEC;EAAS,CAAC,GAAGH,MAAM;EAErCE,GAAG,CAACE,mBAAmB,CAACC,SAAS,CAC7B,OAAO;IAAEC,KAAK;IAAEC;EAAM,CAAC,KAAK;IACxB,IAAI,IAAAC,4BAAoB,EAACD,KAAK,CAAC,EAAE;MAC7B;IACJ;IACA,MAAME,eAAe,GAAGH,KAAK,CAACI,IAAI,EAAET,GAAG,EAAEQ,eAAe;IACxD;AACZ;AACA;IACY,IAAI,CAACA,eAAe,EAAE;MA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,GAAAA,yBAAA","ignoreList":[]}
|
package/plugins/cms/utils.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { CmsEntry, CmsModel, HeadlessCms } from "@webiny/api-headless-cms/types";
|
2
|
-
import { AdvancedPublishingWorkflow, ApwWorkflow } from "../../types";
|
1
|
+
import type { CmsEntry, CmsModel, HeadlessCms } from "@webiny/api-headless-cms/types";
|
2
|
+
import type { AdvancedPublishingWorkflow, ApwWorkflow } from "../../types";
|
3
3
|
export declare const fetchModel: (cms: HeadlessCms, id: string, settings?: {
|
4
4
|
modelId?: string;
|
5
5
|
} | null) => Promise<CmsModel>;
|
@@ -20,8 +20,9 @@ export declare const updateEntryMeta: (params: UpdateEntryMetaParams) => Promise
|
|
20
20
|
interface AssignWorkflowToEntryParams {
|
21
21
|
apw: AdvancedPublishingWorkflow;
|
22
22
|
entry: CmsEntry;
|
23
|
+
model: CmsModel;
|
23
24
|
}
|
24
25
|
export declare const assignWorkflowToEntry: (params: AssignWorkflowToEntryParams) => Promise<void>;
|
25
|
-
export declare const hasEntries: (workflow: ApwWorkflow) =>
|
26
|
-
export declare const
|
26
|
+
export declare const hasEntries: (workflow: ApwWorkflow) => boolean;
|
27
|
+
export declare const isApwDisabledOnModel: (model: Pick<CmsModel, "modelId" | "isPrivate">) => boolean;
|
27
28
|
export {};
|
package/plugins/cms/utils.js
CHANGED
@@ -4,8 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.updateEntryMeta = exports.
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
7
|
+
exports.updateEntryMeta = exports.isApwDisabledOnModel = exports.hasEntries = exports.getLatestEntryRevision = exports.getEntryTitle = exports.fetchModel = exports.assignWorkflowToEntry = void 0;
|
9
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
10
9
|
var _types = require("../../types");
|
11
10
|
var _utils = require("../utils");
|
@@ -51,11 +50,11 @@ const getLatestEntryRevision = async params => {
|
|
51
50
|
model,
|
52
51
|
entryId
|
53
52
|
} = params;
|
54
|
-
const
|
55
|
-
const item = items.shift();
|
53
|
+
const [item] = await cms.getLatestEntriesByIds(model, [entryId]);
|
56
54
|
if (!item) {
|
57
55
|
throw new _error.default("There is no entry with given ID.", "ENTRY_NOT_FOUND", {
|
58
|
-
entryId
|
56
|
+
entryId,
|
57
|
+
model: model.modelId
|
59
58
|
});
|
60
59
|
}
|
61
60
|
return item;
|
@@ -85,12 +84,11 @@ const isWorkflowApplicable = (entry, workflow) => {
|
|
85
84
|
if (scopeType === _types.WorkflowScopeTypes.DEFAULT) {
|
86
85
|
return true;
|
87
86
|
} else if (scopeType === _types.WorkflowScopeTypes.CUSTOM) {
|
88
|
-
|
89
|
-
const models = (_workflow$scope$data = workflow.scope.data) === null || _workflow$scope$data === void 0 ? void 0 : _workflow$scope$data.models;
|
87
|
+
const models = workflow.scope.data?.models;
|
90
88
|
if (Array.isArray(models) && models.includes(entry.modelId)) {
|
91
89
|
return true;
|
92
90
|
}
|
93
|
-
const entries =
|
91
|
+
const entries = workflow.scope.data?.entries || [];
|
94
92
|
if (Array.isArray(entries) && entries.some(value => value.id === entry.entryId)) {
|
95
93
|
return true;
|
96
94
|
}
|
@@ -117,7 +115,6 @@ const assignWorkflowToEntry = async params => {
|
|
117
115
|
app: _types.ApwWorkflowApplications.CMS
|
118
116
|
}
|
119
117
|
});
|
120
|
-
console.log(`Found ${entries.length} workflows.`);
|
121
118
|
|
122
119
|
/*
|
123
120
|
* Re-order them based on workflow scope and pre-defined rule i.e.
|
@@ -135,12 +132,13 @@ const assignWorkflowToEntry = async params => {
|
|
135
132
|
console.log(`Not applying workflow ${workflow.id} to entry ${entry.id}.`);
|
136
133
|
continue;
|
137
134
|
}
|
138
|
-
entry.meta =
|
135
|
+
entry.meta = {
|
136
|
+
...(entry.meta || {}),
|
139
137
|
apw: {
|
140
138
|
workflowId: workflow.id,
|
141
139
|
contentReviewId: null
|
142
140
|
}
|
143
|
-
}
|
141
|
+
};
|
144
142
|
return;
|
145
143
|
}
|
146
144
|
} catch (ex) {
|
@@ -156,7 +154,15 @@ const hasEntries = workflow => {
|
|
156
154
|
return app === _types.ApwWorkflowApplications.CMS && scope.type === _types.WorkflowScopeTypes.CUSTOM && scope.data && Array.isArray(scope.data.entries);
|
157
155
|
};
|
158
156
|
exports.hasEntries = hasEntries;
|
159
|
-
const
|
157
|
+
const isApwDisabledOnModel = model => {
|
158
|
+
/**
|
159
|
+
* We should not run APW on private models as well.
|
160
|
+
*/
|
161
|
+
if (model.isPrivate) {
|
162
|
+
return true;
|
163
|
+
}
|
160
164
|
return [_changeRequest.CHANGE_REQUEST_MODEL_ID, _comment.COMMENT_MODEL_ID, _contentReview.CONTENT_REVIEW_MODEL_ID, _reviewer.REVIEWER_MODEL_ID, _workflow.WORKFLOW_MODEL_ID].includes(model.modelId);
|
161
165
|
};
|
162
|
-
exports.
|
166
|
+
exports.isApwDisabledOnModel = isApwDisabledOnModel;
|
167
|
+
|
168
|
+
//# sourceMappingURL=utils.js.map
|
package/plugins/cms/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["fetchModel","cms","id","settings","WebinyError","modelId","model","getModel","getEntryTitle","entry","titleFieldId","values","getLatestEntryRevision","params","entryId","items","getLatestEntriesByIds","item","shift","updateEntryMeta","meta","updateEntry","isWorkflowApplicable","workflow","application","app","ApwWorkflowApplications","CMS","scopeType","scope","type","WorkflowScopeTypes","DEFAULT","CUSTOM","models","data","Array","isArray","includes","entries","some","value","assignWorkflowToEntry","apw","list","where","console","log","length","sortedWorkflows","sort","workflowByPrecedenceDesc","workflowByCreatedOnDesc","workflowId","contentReviewId","ex","code","hasEntries","isAwpModel","CHANGE_REQUEST_MODEL_ID","COMMENT_MODEL_ID","CONTENT_REVIEW_MODEL_ID","REVIEWER_MODEL_ID","WORKFLOW_MODEL_ID"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntry, CmsModel, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport {\n AdvancedPublishingWorkflow,\n ApwWorkflow,\n ApwWorkflowApplications,\n WorkflowScopeTypes\n} from \"~/types\";\nimport { workflowByCreatedOnDesc, workflowByPrecedenceDesc } from \"~/plugins/utils\";\nimport { CHANGE_REQUEST_MODEL_ID } from \"~/storageOperations/models/changeRequest.model\";\nimport { COMMENT_MODEL_ID } from \"~/storageOperations/models/comment.model\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport { REVIEWER_MODEL_ID } from \"~/storageOperations/models/reviewer.model\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\nexport const fetchModel = async (\n cms: HeadlessCms,\n id: string,\n settings?: { modelId?: string } | null\n): Promise<CmsModel> => {\n if (!settings) {\n throw new WebinyError(\"Missing settings.\", \"SETTINGS_ERROR\", {\n id\n });\n }\n const modelId = settings.modelId;\n if (!modelId) {\n throw new WebinyError(\"Missing modelId in settings.\", \"MODEL_ID_ERROR\", {\n id,\n settings\n });\n }\n const model = await cms.getModel(modelId);\n if (model) {\n return model;\n }\n throw new WebinyError(\"There is no requested model in the system.\", \"MODEL_NOT_EXISTS\", {\n id,\n settings\n });\n};\n\nexport const getEntryTitle = (model: CmsModel, entry: CmsEntry): string => {\n const titleFieldId = model.titleFieldId;\n if (!titleFieldId || !entry.values[titleFieldId]) {\n return entry.id;\n }\n return entry.values[titleFieldId];\n};\n\ninterface GetLatestEntryRevisionParams {\n cms: HeadlessCms;\n model: CmsModel;\n entryId: string;\n}\nexport const getLatestEntryRevision = async (\n params: GetLatestEntryRevisionParams\n): Promise<CmsEntry> => {\n const { cms, model, entryId } = params;\n const items = await cms.getLatestEntriesByIds(model, [entryId]);\n\n const item = items.shift();\n if (!item) {\n throw new WebinyError(\"There is no entry with given ID.\", \"ENTRY_NOT_FOUND\", {\n entryId\n });\n }\n return item;\n};\n\ninterface UpdateEntryMetaParams {\n meta: Record<string, any>;\n entryId: string;\n cms: HeadlessCms;\n model: CmsModel;\n}\nexport const updateEntryMeta = async (params: UpdateEntryMetaParams): Promise<void> => {\n const { entryId, cms, model, meta } = params;\n\n const entry = await getLatestEntryRevision({\n cms,\n model,\n entryId\n });\n\n await cms.updateEntry(model, entry.id, {}, meta);\n};\n\nconst isWorkflowApplicable = (entry: CmsEntry, workflow: ApwWorkflow): boolean => {\n const application = workflow.app;\n if (application !== ApwWorkflowApplications.CMS) {\n return false;\n }\n\n const scopeType = workflow.scope.type;\n\n if (scopeType === WorkflowScopeTypes.DEFAULT) {\n return true;\n } else if (scopeType === WorkflowScopeTypes.CUSTOM) {\n const models = workflow.scope.data?.models;\n\n if (Array.isArray(models) && models.includes(entry.modelId)) {\n return true;\n }\n\n const entries = workflow.scope.data?.entries || [];\n if (Array.isArray(entries) && entries.some(value => value.id === entry.entryId)) {\n return true;\n }\n return false;\n }\n throw new WebinyError(`Unknown scope type \"${scopeType}\".`, \"UNKNOWN_SCOPE_TYPE\", {\n workflow\n });\n};\n\ninterface AssignWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n entry: CmsEntry;\n}\nexport const assignWorkflowToEntry = async (params: AssignWorkflowToEntryParams): Promise<void> => {\n const { apw, entry } = params;\n /**\n * Lookup and assign \"workflowId\".\n */\n try {\n /*\n * List all workflows for app cms\n */\n const [entries] = await apw.workflow.list({\n where: {\n app: ApwWorkflowApplications.CMS\n }\n });\n\n console.log(`Found ${entries.length} workflows.`);\n\n /*\n * Re-order them based on workflow scope and pre-defined rule i.e.\n * \"specific\" entry -> entry for a \"category\" -> \"default\".\n * There can be more than one workflow with same \"scope\" and \"app\".\n * Therefore, we are also sorting the workflows by `createdOn` to get the latest workflow.\n */\n const sortedWorkflows = entries\n .sort(workflowByPrecedenceDesc)\n .sort(workflowByCreatedOnDesc);\n\n /**\n * Assign the first applicable workflow to the page and exit.\n */\n for (const workflow of sortedWorkflows) {\n if (isWorkflowApplicable(entry, workflow) === false) {\n console.log(`Not applying workflow ${workflow.id} to entry ${entry.id}.`);\n continue;\n }\n entry.meta = {\n ...(entry.meta || {}),\n apw: {\n workflowId: workflow.id,\n contentReviewId: null\n }\n };\n return;\n }\n } catch (ex) {\n throw new WebinyError(\n `Failed to assign workflow to CMS entry \"${entry.id}\".`,\n ex.code,\n ex.data\n );\n }\n};\n\nexport const hasEntries = (workflow: ApwWorkflow): Boolean => {\n const { app, scope } = workflow;\n return (\n app === ApwWorkflowApplications.CMS &&\n scope.type === WorkflowScopeTypes.CUSTOM &&\n scope.data &&\n Array.isArray(scope.data.entries)\n );\n};\n\nexport const isAwpModel = (model: CmsModel): boolean => {\n return [\n CHANGE_REQUEST_MODEL_ID,\n COMMENT_MODEL_ID,\n CONTENT_REVIEW_MODEL_ID,\n REVIEWER_MODEL_ID,\n WORKFLOW_MODEL_ID\n ].includes(model.modelId);\n};\n"],"mappings":";;;;;;;;AAAA;AAEA;AAMA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAMA,UAAU,GAAG,OACtBC,GAAgB,EAChBC,EAAU,EACVC,QAAsC,KAClB;EACpB,IAAI,CAACA,QAAQ,EAAE;IACX,MAAM,IAAIC,cAAW,CAAC,mBAAmB,EAAE,gBAAgB,EAAE;MACzDF;IACJ,CAAC,CAAC;EACN;EACA,MAAMG,OAAO,GAAGF,QAAQ,CAACE,OAAO;EAChC,IAAI,CAACA,OAAO,EAAE;IACV,MAAM,IAAID,cAAW,CAAC,8BAA8B,EAAE,gBAAgB,EAAE;MACpEF,EAAE;MACFC;IACJ,CAAC,CAAC;EACN;EACA,MAAMG,KAAK,GAAG,MAAML,GAAG,CAACM,QAAQ,CAACF,OAAO,CAAC;EACzC,IAAIC,KAAK,EAAE;IACP,OAAOA,KAAK;EAChB;EACA,MAAM,IAAIF,cAAW,CAAC,4CAA4C,EAAE,kBAAkB,EAAE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iB,EACjBC,2BAAiB,CACpB,CAACzB,QAAQ,CAAChC,KAAK,CAACD,OAAO,CAAC;AAC7B,CAAC;AAAC"}
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","_changeRequest","_comment","_contentReview","_reviewer","_workflow","fetchModel","cms","id","settings","WebinyError","modelId","model","getModel","exports","getEntryTitle","entry","titleFieldId","values","getLatestEntryRevision","params","entryId","item","getLatestEntriesByIds","updateEntryMeta","meta","updateEntry","isWorkflowApplicable","workflow","application","app","ApwWorkflowApplications","CMS","scopeType","scope","type","WorkflowScopeTypes","DEFAULT","CUSTOM","models","data","Array","isArray","includes","entries","some","value","assignWorkflowToEntry","apw","list","where","sortedWorkflows","sort","workflowByPrecedenceDesc","workflowByCreatedOnDesc","console","log","workflowId","contentReviewId","ex","code","hasEntries","isApwDisabledOnModel","isPrivate","CHANGE_REQUEST_MODEL_ID","COMMENT_MODEL_ID","CONTENT_REVIEW_MODEL_ID","REVIEWER_MODEL_ID","WORKFLOW_MODEL_ID"],"sources":["utils.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntry, CmsModel, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { AdvancedPublishingWorkflow, ApwWorkflow } from \"~/types\";\nimport { ApwWorkflowApplications, WorkflowScopeTypes } from \"~/types\";\nimport { workflowByCreatedOnDesc, workflowByPrecedenceDesc } from \"~/plugins/utils\";\nimport { CHANGE_REQUEST_MODEL_ID } from \"~/storageOperations/models/changeRequest.model\";\nimport { COMMENT_MODEL_ID } from \"~/storageOperations/models/comment.model\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport { REVIEWER_MODEL_ID } from \"~/storageOperations/models/reviewer.model\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\nexport const fetchModel = async (\n cms: HeadlessCms,\n id: string,\n settings?: { modelId?: string } | null\n): Promise<CmsModel> => {\n if (!settings) {\n throw new WebinyError(\"Missing settings.\", \"SETTINGS_ERROR\", {\n id\n });\n }\n const modelId = settings.modelId;\n if (!modelId) {\n throw new WebinyError(\"Missing modelId in settings.\", \"MODEL_ID_ERROR\", {\n id,\n settings\n });\n }\n const model = await cms.getModel(modelId);\n if (model) {\n return model;\n }\n throw new WebinyError(\"There is no requested model in the system.\", \"MODEL_NOT_EXISTS\", {\n id,\n settings\n });\n};\n\nexport const getEntryTitle = (model: CmsModel, entry: CmsEntry): string => {\n const titleFieldId = model.titleFieldId;\n if (!titleFieldId || !entry.values[titleFieldId]) {\n return entry.id;\n }\n return entry.values[titleFieldId];\n};\n\ninterface GetLatestEntryRevisionParams {\n cms: HeadlessCms;\n model: CmsModel;\n entryId: string;\n}\n\nexport const getLatestEntryRevision = async (\n params: GetLatestEntryRevisionParams\n): Promise<CmsEntry> => {\n const { cms, model, entryId } = params;\n const [item] = await cms.getLatestEntriesByIds(model, [entryId]);\n\n if (!item) {\n throw new WebinyError(\"There is no entry with given ID.\", \"ENTRY_NOT_FOUND\", {\n entryId,\n model: model.modelId\n });\n }\n return item;\n};\n\ninterface UpdateEntryMetaParams {\n meta: Record<string, any>;\n entryId: string;\n cms: HeadlessCms;\n model: CmsModel;\n}\n\nexport const updateEntryMeta = async (params: UpdateEntryMetaParams): Promise<void> => {\n const { entryId, cms, model, meta } = params;\n\n const entry = await getLatestEntryRevision({\n cms,\n model,\n entryId\n });\n\n await cms.updateEntry(model, entry.id, {}, meta);\n};\n\nconst isWorkflowApplicable = (entry: CmsEntry, workflow: ApwWorkflow): boolean => {\n const application = workflow.app;\n if (application !== ApwWorkflowApplications.CMS) {\n return false;\n }\n\n const scopeType = workflow.scope.type;\n\n if (scopeType === WorkflowScopeTypes.DEFAULT) {\n return true;\n } else if (scopeType === WorkflowScopeTypes.CUSTOM) {\n const models = workflow.scope.data?.models;\n\n if (Array.isArray(models) && models.includes(entry.modelId)) {\n return true;\n }\n\n const entries = workflow.scope.data?.entries || [];\n if (Array.isArray(entries) && entries.some(value => value.id === entry.entryId)) {\n return true;\n }\n return false;\n }\n throw new WebinyError(`Unknown scope type \"${scopeType}\".`, \"UNKNOWN_SCOPE_TYPE\", {\n workflow\n });\n};\n\ninterface AssignWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n entry: CmsEntry;\n model: CmsModel;\n}\n\nexport const assignWorkflowToEntry = async (params: AssignWorkflowToEntryParams): Promise<void> => {\n const { apw, entry } = params;\n /**\n * Lookup and assign \"workflowId\".\n */\n try {\n /*\n * List all workflows for app cms\n */\n const [entries] = await apw.workflow.list({\n where: {\n app: ApwWorkflowApplications.CMS\n }\n });\n\n /*\n * Re-order them based on workflow scope and pre-defined rule i.e.\n * \"specific\" entry -> entry for a \"category\" -> \"default\".\n * There can be more than one workflow with same \"scope\" and \"app\".\n * Therefore, we are also sorting the workflows by `createdOn` to get the latest workflow.\n */\n const sortedWorkflows = entries\n .sort(workflowByPrecedenceDesc)\n .sort(workflowByCreatedOnDesc);\n\n /**\n * Assign the first applicable workflow to the page and exit.\n */\n for (const workflow of sortedWorkflows) {\n if (isWorkflowApplicable(entry, workflow) === false) {\n console.log(`Not applying workflow ${workflow.id} to entry ${entry.id}.`);\n continue;\n }\n entry.meta = {\n ...(entry.meta || {}),\n apw: {\n workflowId: workflow.id,\n contentReviewId: null\n }\n };\n return;\n }\n } catch (ex) {\n throw new WebinyError(\n `Failed to assign workflow to CMS entry \"${entry.id}\".`,\n ex.code,\n ex.data\n );\n }\n};\n\nexport const hasEntries = (workflow: ApwWorkflow): boolean => {\n const { app, scope } = workflow;\n return (\n app === ApwWorkflowApplications.CMS &&\n scope.type === WorkflowScopeTypes.CUSTOM &&\n scope.data &&\n Array.isArray(scope.data.entries)\n );\n};\n\nexport const isApwDisabledOnModel = (model: Pick<CmsModel, \"modelId\" | \"isPrivate\">): boolean => {\n /**\n * We should not run APW on private models as well.\n */\n if (model.isPrivate) {\n return true;\n }\n return [\n CHANGE_REQUEST_MODEL_ID,\n COMMENT_MOD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AAgD,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/plugins/context.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
2
|
-
import { ApwContext } from "../types";
|
3
|
-
import { CreateApwContextParams } from "../scheduler/types";
|
4
|
-
export declare const
|
2
|
+
import type { ApwContext } from "../types";
|
3
|
+
import type { CreateApwContextParams } from "../scheduler/types";
|
4
|
+
export declare const createApwContext: (params: CreateApwContextParams) => ContextPlugin<ApwContext>;
|
package/plugins/context.js
CHANGED
@@ -4,18 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.
|
7
|
+
exports.createApwContext = void 0;
|
8
8
|
var _hooks = require("./hooks");
|
9
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
10
10
|
var _api = require("@webiny/api");
|
11
11
|
var _crud = require("../crud");
|
12
|
-
var _pageBuilder = require("./pageBuilder");
|
13
12
|
var _storageOperations = require("../storageOperations");
|
14
13
|
var _scheduler = require("../scheduler");
|
15
14
|
var _security = require("../scheduler/handlers/executeAction/security");
|
16
15
|
var _utils = require("./utils");
|
17
|
-
var _extendPbPageSettingsSchema = require("./pageBuilder/extendPbPageSettingsSchema");
|
18
|
-
var _apwContentPagePlugins = require("./pageBuilder/apwContentPagePlugins");
|
19
16
|
var _cms = require("./cms");
|
20
17
|
const setupApwContext = params => new _api.ContextPlugin(async context => {
|
21
18
|
const {
|
@@ -72,17 +69,12 @@ const setupApwContext = params => new _api.ContextPlugin(async context => {
|
|
72
69
|
plugins: context.plugins
|
73
70
|
});
|
74
71
|
});
|
75
|
-
const setupApwPageBuilder = () => {
|
76
|
-
return new _api.ContextPlugin(async context => {
|
77
|
-
(0, _pageBuilder.apwPageBuilderHooks)(context);
|
78
|
-
});
|
79
|
-
};
|
80
72
|
const setupApwHeadlessCms = () => {
|
81
73
|
return new _api.ContextPlugin(async context => {
|
82
74
|
(0, _cms.apwCmsHooks)(context);
|
83
75
|
});
|
84
76
|
};
|
85
|
-
const
|
77
|
+
const createApwContext = params => {
|
86
78
|
return new _api.ContextPlugin(async context => {
|
87
79
|
if (!context.wcp.canUseFeature("advancedPublishingWorkflow")) {
|
88
80
|
return;
|
@@ -90,12 +82,11 @@ const createApwPageBuilderContext = params => {
|
|
90
82
|
return;
|
91
83
|
}
|
92
84
|
await setupApwContext(params).apply(context);
|
93
|
-
await setupApwPageBuilder().apply(context);
|
94
85
|
await setupApwHeadlessCms().apply(context);
|
95
|
-
await (0, _apwContentPagePlugins.apwContentPagePlugins)().apply(context);
|
96
86
|
await (0, _hooks.attachApwHooks)().apply(context);
|
97
87
|
await (0, _security.createCustomAuth)(params).apply(context);
|
98
|
-
context.plugins.register((0, _extendPbPageSettingsSchema.extendPbPageSettingsSchema)());
|
99
88
|
});
|
100
89
|
};
|
101
|
-
exports.
|
90
|
+
exports.createApwContext = createApwContext;
|
91
|
+
|
92
|
+
//# sourceMappingURL=context.js.map
|
package/plugins/context.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","
|
1
|
+
{"version":3,"names":["_hooks","require","_error","_interopRequireDefault","_api","_crud","_storageOperations","_scheduler","_security","_utils","_cms","setupApwContext","params","ContextPlugin","context","tenancy","security","i18n","handlerClient","isInstallationPending","getLocale","locale","getContentLocale","WebinyError","getTenant","getCurrentTenant","getPermission","name","getIdentity","scheduler","createScheduler","storageOperations","apw","createApw","createStorageOperations","cms","getCmsContext","plugins","setupApwHeadlessCms","apwCmsHooks","createApwContext","wcp","canUseFeature","apply","attachApwHooks","createCustomAuth","exports"],"sources":["context.ts"],"sourcesContent":["import { attachApwHooks } from \"./hooks\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport type { ApwContext } from \"~/types\";\nimport { createApw } from \"~/crud\";\nimport { createStorageOperations } from \"~/storageOperations\";\nimport type { SecurityPermission } from \"@webiny/api-security/types\";\nimport type { Tenant } from \"@webiny/api-tenancy/types\";\nimport type { CreateApwContextParams } from \"~/scheduler/types\";\nimport { createScheduler } from \"~/scheduler\";\nimport { createCustomAuth } from \"~/scheduler/handlers/executeAction/security\";\nimport { isInstallationPending } from \"./utils\";\nimport { apwCmsHooks } from \"~/plugins/cms\";\nimport type { I18NLocale } from \"@webiny/api-i18n/types\";\n\nconst setupApwContext = (params: CreateApwContextParams) =>\n new ContextPlugin<ApwContext>(async context => {\n const { tenancy, security, i18n, handlerClient } = context;\n\n if (isInstallationPending({ tenancy, i18n })) {\n return;\n }\n\n const getLocale = (): I18NLocale => {\n const locale = i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/plugins/context.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n return locale;\n };\n\n const getTenant = (): Tenant => {\n return tenancy.getCurrentTenant();\n };\n\n const getPermission = async (name: string): Promise<SecurityPermission | null> => {\n return security.getPermission(name);\n };\n const getIdentity = () => security.getIdentity();\n\n const scheduler = createScheduler({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: params.storageOperations\n });\n\n context.apw = createApw({\n getLocale,\n getIdentity,\n getTenant,\n getPermission,\n storageOperations: createStorageOperations({\n /**\n * TODO: We need to figure out a way to pass \"cms\" from outside (e.g. apps/api/graphql)\n */\n cms: context.cms,\n /**\n * TODO: This is required for \"entryFieldFromStorageTransform\" which access plugins from context.\n */\n getCmsContext: () => context,\n security\n }),\n scheduler,\n handlerClient,\n plugins: context.plugins\n });\n });\n\nconst setupApwHeadlessCms = () => {\n return new ContextPlugin<ApwContext>(async context => {\n apwCmsHooks(context);\n });\n};\n\nexport const createApwContext = (params: CreateApwContextParams) => {\n return new ContextPlugin<ApwContext>(async context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n } else if (isInstallationPending(context)) {\n return;\n }\n\n await setupApwContext(params).apply(context);\n await setupApwHeadlessCms().apply(context);\n await attachApwHooks().apply(context);\n await createCustomAuth(params).apply(context);\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAIA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AAGA,MAAMU,eAAe,GAAIC,MAA8B,IACnD,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,IAAI;IAAEC;EAAc,CAAC,GAAGJ,OAAO;EAE1D,IAAI,IAAAK,4BAAqB,EAAC;IAAEJ,OAAO;IAAEE;EAAK,CAAC,CAAC,EAAE;IAC1C;EACJ;EAEA,MAAMG,SAAS,GAAGA,CAAA,KAAkB;IAChC,MAAMC,MAAM,GAAGJ,IAAI,CAACK,gBAAgB,CAAC,CAAC;IACtC,IAAI,CAACD,MAAM,EAAE;MACT,MAAM,IAAIE,cAAW,CACjB,sDAAsD,EACtD,cACJ,CAAC;IACL;IAEA,OAAOF,MAAM;EACjB,CAAC;EAED,MAAMG,SAAS,GAAGA,CAAA,KAAc;IAC5B,OAAOT,OAAO,CAACU,gBAAgB,CAAC,CAAC;EACrC,CAAC;EAED,MAAMC,aAAa,GAAG,MAAOC,IAAY,IAAyC;IAC9E,OAAOX,QAAQ,CAACU,aAAa,CAACC,IAAI,CAA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KAAK,CAAC7B,OAAO,CAAC;IACrC,MAAM,IAAA+B,0BAAgB,EAACjC,MAAM,CAAC,CAAC+B,KAAK,CAAC7B,OAAO,CAAC;EACjD,CAAC,CAAC;AACN,CAAC;AAACgC,OAAA,CAAAN,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -8,14 +8,16 @@ exports.default = void 0;
|
|
8
8
|
var _plugins = require("@webiny/handler-graphql/plugins");
|
9
9
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
10
10
|
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
11
|
+
var _utils = require("./utils");
|
11
12
|
const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
12
|
-
|
13
|
+
// Had to remove /* GraphQL */ because prettier would not format the code correctly.
|
14
|
+
typeDefs: `
|
13
15
|
type ApwChangeRequestListItem {
|
14
16
|
# System generated fields
|
15
17
|
id: ID
|
16
|
-
|
17
|
-
|
18
|
-
|
18
|
+
|
19
|
+
${_utils.onByFields}
|
20
|
+
|
19
21
|
# ChangeRequest specific fields
|
20
22
|
step: String!
|
21
23
|
title: String!
|
@@ -33,9 +35,9 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
33
35
|
type ApwChangeRequest {
|
34
36
|
# System generated fields
|
35
37
|
id: ID
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
|
39
|
+
${_utils.onByFields}
|
40
|
+
|
39
41
|
# ChangeRequest specific fields
|
40
42
|
step: String!
|
41
43
|
title: String!
|
@@ -57,12 +59,12 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
57
59
|
enum ApwListChangeRequestSort {
|
58
60
|
id_ASC
|
59
61
|
id_DESC
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
createdOn_DESC
|
62
|
+
|
63
|
+
${_utils.dateTimeFieldsSorters}
|
64
|
+
|
64
65
|
publishedOn_ASC
|
65
66
|
publishedOn_DESC
|
67
|
+
|
66
68
|
title_ASC
|
67
69
|
title_DESC
|
68
70
|
}
|
@@ -144,5 +146,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
144
146
|
}
|
145
147
|
}
|
146
148
|
});
|
147
|
-
var _default = workflowSchema;
|
148
|
-
|
149
|
+
var _default = exports.default = workflowSchema;
|
150
|
+
|
151
|
+
//# sourceMappingURL=changeRequest.gql.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n
|
1
|
+
{"version":3,"names":["_plugins","require","_handlerGraphql","_resolve","_interopRequireDefault","_utils","workflowSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwQuery","getChangeRequest","_","args","context","resolve","apw","changeRequest","get","id","listChangeRequests","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createChangeRequest","create","data","updateChangeRequest","update","deleteChangeRequest","delete","_default","exports","default"],"sources":["changeRequest.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport type { ApwChangeRequestListParams, ApwContext } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\nimport { onByFields, dateTimeFieldsSorters } from \"./utils\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type ApwChangeRequestListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwListChangeRequestsResponse {\n data: [ApwChangeRequestListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwChangeRequest {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ChangeRequest specific fields\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n type ApwChangeRequestResponse {\n data: ApwChangeRequest\n error: ApwError\n }\n\n type ApwDeleteChangeRequestResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListChangeRequestSort {\n id_ASC\n id_DESC\n \n ${dateTimeFieldsSorters}\n \n publishedOn_ASC\n publishedOn_DESC\n \n title_ASC\n title_DESC\n }\n\n input ApwCreateChangeRequestInput {\n step: String!\n title: String!\n body: JSON!\n resolved: Boolean\n media: JSON\n }\n\n input ApwUpdateChangeRequestInput {\n title: String\n body: JSON\n resolved: Boolean\n media: JSON\n }\n\n input ApwListChangeRequestWhereInput {\n id: ID\n step: String\n }\n\n input ApwListChangeRequestSearchInput {\n query: String\n }\n\n extend type ApwQuery {\n getChangeRequest(id: ID!): ApwChangeRequestResponse\n\n listChangeRequests(\n where: ApwListChangeRequestWhereInput\n limit: Int\n after: String\n sort: [ApwListChangeRequestSort!]\n search: ApwListChangeRequestSearchInput\n ): ApwListChangeRequestsResponse\n }\n\n extend type ApwMutation {\n createChangeRequest(data: ApwCreateChangeRequestInput!): ApwChangeRequestResponse\n\n updateChangeRequest(\n id: ID!\n data: ApwUpdateChangeRequestInput!\n ): ApwChangeRequestResponse\n\n deleteChangeRequest(id: ID!): ApwDeleteChangeRequestResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.get(args.id));\n },\n listChangeRequests: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwChangeRequestListParams.\n */\n const [entries, meta] = await context.apw.changeRequest.list(\n args as unknown as ApwChangeRequestListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.create(args.data));\n },\n updateChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.update(args.id, args.data));\n },\n deleteChangeRequest: async (_, args: any, context) => {\n return resolve(() => context.apw.changeRequest.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvD;EACAC,QAAQ,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcA,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAqB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,QAAQ,EAAE;MACNC,gBAAgB,EAAE,MAAAA,CAAOC,CA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,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYjC,cAAc","ignoreList":[]}
|
@@ -8,14 +8,37 @@ exports.default = void 0;
|
|
8
8
|
var _plugins = require("@webiny/handler-graphql/plugins");
|
9
9
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
10
10
|
var _resolve = _interopRequireDefault(require("../../utils/resolve"));
|
11
|
+
var _utils = require("./utils");
|
11
12
|
const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
12
|
-
|
13
|
+
// Had to remove /* GraphQL */ because prettier would not format the code correctly.
|
14
|
+
typeDefs: () => {
|
15
|
+
const metaFieldsBaseNames = ["created", "modified", "saved"];
|
16
|
+
const dateTimeWhereFields = metaFieldsBaseNames.map(name => {
|
17
|
+
return `
|
18
|
+
${name}On: DateTime
|
19
|
+
${name}On_gt: DateTime
|
20
|
+
${name}On_gte: DateTime
|
21
|
+
${name}On_lt: DateTime
|
22
|
+
${name}On_lte: DateTime
|
23
|
+
${name}On_between: [DateTime!]
|
24
|
+
${name}On_not_between: [DateTime!]
|
25
|
+
`;
|
26
|
+
}).join("\n");
|
27
|
+
const identityWhereFields = metaFieldsBaseNames.map(name => {
|
28
|
+
return `
|
29
|
+
${name}By: ID
|
30
|
+
${name}By_not: ID
|
31
|
+
${name}By_in: [ID!]
|
32
|
+
${name}By_not_in: [ID!]
|
33
|
+
`;
|
34
|
+
}).join("\n");
|
35
|
+
return [`
|
13
36
|
type ApwCommentListItem {
|
14
37
|
# System generated fields
|
15
38
|
id: ID
|
16
|
-
|
17
|
-
|
18
|
-
|
39
|
+
|
40
|
+
${_utils.onByFields}
|
41
|
+
|
19
42
|
# Comment specific fields
|
20
43
|
body: JSON
|
21
44
|
changeRequest: ID
|
@@ -32,9 +55,9 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
32
55
|
type ApwComment {
|
33
56
|
# System generated fields
|
34
57
|
id: ID
|
35
|
-
|
36
|
-
|
37
|
-
|
58
|
+
|
59
|
+
${_utils.onByFields}
|
60
|
+
|
38
61
|
# Comment specific fields
|
39
62
|
body: JSON
|
40
63
|
changeRequest: ID
|
@@ -54,10 +77,8 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
54
77
|
enum ApwListCommentsSort {
|
55
78
|
id_ASC
|
56
79
|
id_DESC
|
57
|
-
|
58
|
-
|
59
|
-
createdOn_ASC
|
60
|
-
createdOn_DESC
|
80
|
+
|
81
|
+
${_utils.dateTimeFieldsSorters}
|
61
82
|
}
|
62
83
|
|
63
84
|
input ApwCreateCommentInput {
|
@@ -75,28 +96,10 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
75
96
|
id_not: ID
|
76
97
|
id_in: [ID!]
|
77
98
|
id_not_in: [ID!]
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
createdOn_lte: DateTime
|
83
|
-
createdOn_between: [DateTime!]
|
84
|
-
createdOn_not_between: [DateTime!]
|
85
|
-
savedOn: DateTime
|
86
|
-
savedOn_gt: DateTime
|
87
|
-
savedOn_gte: DateTime
|
88
|
-
savedOn_lt: DateTime
|
89
|
-
savedOn_lte: DateTime
|
90
|
-
savedOn_between: [DateTime!]
|
91
|
-
savedOn_not_between: [DateTime!]
|
92
|
-
createdBy: String
|
93
|
-
createdBy_not: String
|
94
|
-
createdBy_in: [String!]
|
95
|
-
createdBy_not_in: [String!]
|
96
|
-
ownedBy: String
|
97
|
-
ownedBy_not: String
|
98
|
-
ownedBy_in: [String!]
|
99
|
-
ownedBy_not_in: [String!]
|
99
|
+
|
100
|
+
${dateTimeWhereFields}
|
101
|
+
${identityWhereFields}
|
102
|
+
|
100
103
|
changeRequest: ApwRefFieldWhereInput
|
101
104
|
}
|
102
105
|
|
@@ -118,7 +121,8 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
118
121
|
|
119
122
|
deleteComment(id: ID!): ApwDeleteCommentResponse
|
120
123
|
}
|
121
|
-
|
124
|
+
`];
|
125
|
+
},
|
122
126
|
resolvers: {
|
123
127
|
ApwQuery: {
|
124
128
|
getComment: async (_, args, context) => {
|
@@ -149,5 +153,6 @@ const workflowSchema = new _plugins.GraphQLSchemaPlugin({
|
|
149
153
|
}
|
150
154
|
}
|
151
155
|
});
|
152
|
-
var _default = workflowSchema;
|
153
|
-
|
156
|
+
var _default = exports.default = workflowSchema;
|
157
|
+
|
158
|
+
//# sourceMappingURL=comment.gql.js.map
|