@webiny/api-apw 0.0.0-unstable.df6d94b531 → 0.0.0-unstable.e53eceafb5
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 +4 -3
- 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 +2 -2
- package/plugins/context.js +3 -1
- 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 +23 -14
- 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 +3 -1
- 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/pageBuilder/PageApwSettingsGetterPlugin.d.ts +2 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +5 -5
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +3 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +3 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.d.ts +4 -4
- package/plugins/pageBuilder/index.js +3 -1
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +2 -2
- package/plugins/pageBuilder/linkContentReviewToPage.js +16 -12
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +2 -2
- package/plugins/pageBuilder/linkWorkflowToPage.js +13 -12
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +3 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +3 -1
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +3 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +3 -1
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
- package/plugins/pageBuilder/triggerContentReview.d.ts +2 -2
- package/plugins/pageBuilder/triggerContentReview.js +5 -4
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +3 -3
- package/plugins/pageBuilder/updateContentReviewStatus.js +13 -10
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.d.ts +4 -4
- package/plugins/pageBuilder/utils.js +7 -6
- package/plugins/pageBuilder/utils.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 +5 -5
- 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 +15 -14
- 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 +17 -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 +19 -17
- package/scheduler/types.js +11 -12
- 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 +51 -52
- 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.d.ts +1 -1
- 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/storageOperations/models/contentModelPluginFactory.d.ts +0 -11
- package/storageOperations/models/contentModelPluginFactory.js +0 -19
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -5,18 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.createContentReviewStorageOperations = void 0;
|
8
|
-
var
|
9
|
-
var _index = require("./index");
|
8
|
+
var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
|
10
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
10
|
var _contentReview = require("./models/contentReview.model");
|
12
11
|
const createContentReviewStorageOperations = ({
|
13
|
-
cms
|
14
|
-
security
|
12
|
+
cms
|
15
13
|
}) => {
|
16
14
|
const getContentReviewModel = async () => {
|
17
|
-
security.disableAuthorization();
|
18
15
|
const model = await cms.getModel(_contentReview.CONTENT_REVIEW_MODEL_ID);
|
19
|
-
security.enableAuthorization();
|
20
16
|
if (!model) {
|
21
17
|
throw new _error.default(`Could not find "${_contentReview.CONTENT_REVIEW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
|
22
18
|
}
|
@@ -26,29 +22,26 @@ const createContentReviewStorageOperations = ({
|
|
26
22
|
id
|
27
23
|
}) => {
|
28
24
|
const model = await getContentReviewModel();
|
29
|
-
security.disableAuthorization();
|
30
25
|
const entry = await cms.getEntryById(model, id);
|
31
|
-
|
32
|
-
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
26
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
33
27
|
};
|
34
28
|
return {
|
35
29
|
getContentReviewModel,
|
36
30
|
getContentReview,
|
37
31
|
async listContentReviews(params) {
|
38
32
|
const model = await getContentReviewModel();
|
39
|
-
|
40
|
-
|
41
|
-
where:
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
const [entries, meta] = await cms.listLatestEntries(model, {
|
34
|
+
...params,
|
35
|
+
where: {
|
36
|
+
...params.where
|
37
|
+
}
|
38
|
+
});
|
39
|
+
return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
|
45
40
|
},
|
46
41
|
async createContentReview(params) {
|
47
42
|
const model = await getContentReviewModel();
|
48
|
-
security.disableAuthorization();
|
49
43
|
const entry = await cms.createEntry(model, params.data);
|
50
|
-
|
51
|
-
return (0, _index.getFieldValues)(entry, _index.baseFields);
|
44
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
52
45
|
},
|
53
46
|
async updateContentReview(params) {
|
54
47
|
const model = await getContentReviewModel();
|
@@ -59,18 +52,20 @@ const createContentReviewStorageOperations = ({
|
|
59
52
|
const existingEntry = await getContentReview({
|
60
53
|
id: params.id
|
61
54
|
});
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
const entry = await cms.updateEntry(model, params.id, {
|
56
|
+
...existingEntry,
|
57
|
+
...params.data,
|
58
|
+
savedOn: new Date()
|
59
|
+
});
|
60
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
66
61
|
},
|
67
62
|
async deleteContentReview(params) {
|
68
63
|
const model = await getContentReviewModel();
|
69
|
-
security.disableAuthorization();
|
70
64
|
await cms.deleteEntry(model, params.id);
|
71
|
-
security.enableAuthorization();
|
72
65
|
return true;
|
73
66
|
}
|
74
67
|
};
|
75
68
|
};
|
76
|
-
exports.createContentReviewStorageOperations = createContentReviewStorageOperations;
|
69
|
+
exports.createContentReviewStorageOperations = createContentReviewStorageOperations;
|
70
|
+
|
71
|
+
//# sourceMappingURL=contentReviewStorageOperations.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_contentReview","createContentReviewStorageOperations","cms","getContentReviewModel","model","getModel","CONTENT_REVIEW_MODEL_ID","WebinyError","getContentReview","id","entry","getEntryById","pickEntryFieldValues","listContentReviews","params","entries","meta","listLatestEntries","where","map","createContentReview","createEntry","data","updateContentReview","existingEntry","updateEntry","savedOn","Date","deleteContentReview","deleteEntry","exports"],"sources":["contentReviewStorageOperations.ts"],"sourcesContent":["import type { ApwContentReviewStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport type { ApwContentReview } from \"~/types\";\n\nexport const createContentReviewStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwContentReviewStorageOperations => {\n const getContentReviewModel = async () => {\n const model = await cms.getModel(CONTENT_REVIEW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${CONTENT_REVIEW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getContentReview: ApwContentReviewStorageOperations[\"getContentReview\"] = async ({\n id\n }) => {\n const model = await getContentReviewModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getContentReviewModel,\n getContentReview,\n async listContentReviews(params) {\n const model = await getContentReviewModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n\n return [entries.map(pickEntryFieldValues<ApwContentReview>), meta];\n },\n async createContentReview(params) {\n const model = await getContentReviewModel();\n\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateContentReview(params) {\n const model = await getContentReviewModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getContentReview({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteContentReview(params) {\n const model = await getContentReviewModel();\n await cms.deleteEntry(model, params.id);\n\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAGO,MAAMI,oCAAoC,GAAGA,CAAC;EACjDC;AAC8B,CAAC,KAAwC;EACvE,MAAMC,qBAAqB,GAAG,MAAAA,CAAA,KAAY;IACtC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAACC,sCAAuB,CAAC;IACzD,IAAI,CAACF,KAAK,EAAE;MACR,MAAM,IAAIG,cAAW,CACjB,mBAAmBD,sCAAuB,UAAU,EACpD,uBACJ,CAAC;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMI,gBAAuE,GAAG,MAAAA,CAAO;IACnFC;EACJ,CAAC,KAAK;IACF,MAAML,KAAK,GAAG,MAAMD,qBAAqB,CAAC,CAAC;IAC3C,MAAMO,KAAK,GAAG,MAAMR,GAAG,CAACS,YAAY,CAACP,KAAK,EAAEK,EAAE,CAA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E;MAC9B,MAAMV,KAAK,GAAG,MAAMD,qBAAqB,CAAC,CAAC;MAC3C,MAAMD,GAAG,CAAC2B,WAAW,CAACzB,KAAK,EAAEU,MAAM,CAACL,EAAE,CAAC;MAEvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA7B,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
@@ -1,15 +1,9 @@
|
|
1
|
-
import { CmsContext,
|
2
|
-
import { ApwStorageOperations } from "../types";
|
3
|
-
import { Security } from "@webiny/api-security/types";
|
1
|
+
import type { CmsContext, HeadlessCms } from "@webiny/api-headless-cms/types";
|
2
|
+
import type { ApwStorageOperations } from "../types";
|
3
|
+
import type { Security } from "@webiny/api-security/types";
|
4
4
|
export interface CreateApwStorageOperationsParams {
|
5
5
|
cms: HeadlessCms;
|
6
6
|
security: Security;
|
7
7
|
getCmsContext: () => CmsContext;
|
8
8
|
}
|
9
|
-
/**
|
10
|
-
* Using any because value can be a lot of types.
|
11
|
-
* TODO @ts-refactor figure out correct types.
|
12
|
-
*/
|
13
|
-
export declare function getFieldValues(entry: CmsEntry, fields: string[]): any;
|
14
|
-
export declare const baseFields: string[];
|
15
9
|
export declare const createStorageOperations: (params: CreateApwStorageOperationsParams) => ApwStorageOperations;
|
@@ -1,34 +1,29 @@
|
|
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
|
-
exports.createStorageOperations =
|
8
|
-
exports.getFieldValues = getFieldValues;
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
10
|
-
var _pick = _interopRequireDefault(require("lodash/pick"));
|
6
|
+
exports.createStorageOperations = void 0;
|
11
7
|
var _reviewerStorageOperations = require("./reviewerStorageOperations");
|
12
8
|
var _workflowStorageOperations = require("./workflowStorageOperations");
|
13
9
|
var _contentReviewStorageOperations = require("./contentReviewStorageOperations");
|
14
10
|
var _changeRequestStorageOperations = require("./changeRequestStorageOperations");
|
15
11
|
var _commentStorageOperations = require("./commentStorageOperations");
|
16
12
|
var _models = require("./models");
|
17
|
-
/**
|
18
|
-
* Using any because value can be a lot of types.
|
19
|
-
* TODO @ts-refactor figure out correct types.
|
20
|
-
*/
|
21
|
-
function getFieldValues(entry, fields) {
|
22
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
|
23
|
-
}
|
24
|
-
const baseFields = ["id", "entryId", "createdBy", "createdOn", "savedOn"];
|
25
|
-
exports.baseFields = baseFields;
|
26
13
|
const createStorageOperations = params => {
|
27
14
|
const context = params.getCmsContext();
|
28
15
|
/**
|
29
16
|
* Register Apw models.
|
30
17
|
*/
|
31
18
|
(0, _models.createApwModels)(context);
|
32
|
-
return
|
19
|
+
return {
|
20
|
+
...(0, _reviewerStorageOperations.createReviewerStorageOperations)(params),
|
21
|
+
...(0, _workflowStorageOperations.createWorkflowStorageOperations)(params),
|
22
|
+
...(0, _contentReviewStorageOperations.createContentReviewStorageOperations)(params),
|
23
|
+
...(0, _changeRequestStorageOperations.createChangeRequestStorageOperations)(params),
|
24
|
+
...(0, _commentStorageOperations.createCommentStorageOperations)(params)
|
25
|
+
};
|
33
26
|
};
|
34
|
-
exports.createStorageOperations = createStorageOperations;
|
27
|
+
exports.createStorageOperations = createStorageOperations;
|
28
|
+
|
29
|
+
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_reviewerStorageOperations","require","_workflowStorageOperations","_contentReviewStorageOperations","_changeRequestStorageOperations","_commentStorageOperations","_models","createStorageOperations","params","context","getCmsContext","createApwModels","createReviewerStorageOperations","createWorkflowStorageOperations","createContentReviewStorageOperations","createChangeRequestStorageOperations","createCommentStorageOperations","exports"],"sources":["index.ts"],"sourcesContent":["import type { CmsContext, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { ApwStorageOperations } from \"~/types\";\nimport { createReviewerStorageOperations } from \"./reviewerStorageOperations\";\nimport { createWorkflowStorageOperations } from \"./workflowStorageOperations\";\nimport { createContentReviewStorageOperations } from \"./contentReviewStorageOperations\";\nimport { createChangeRequestStorageOperations } from \"./changeRequestStorageOperations\";\nimport { createCommentStorageOperations } from \"~/storageOperations/commentStorageOperations\";\nimport { createApwModels } from \"./models\";\nimport type { Security } from \"@webiny/api-security/types\";\n\nexport interface CreateApwStorageOperationsParams {\n cms: HeadlessCms;\n security: Security;\n getCmsContext: () => CmsContext;\n}\n\nexport const createStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwStorageOperations => {\n const context = params.getCmsContext();\n /**\n * Register Apw models.\n */\n createApwModels(context);\n\n return {\n ...createReviewerStorageOperations(params),\n ...createWorkflowStorageOperations(params),\n ...createContentReviewStorageOperations(params),\n ...createChangeRequestStorageOperations(params),\n ...createCommentStorageOperations(params)\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AACA,IAAAG,+BAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AASO,MAAMM,uBAAuB,GAChCC,MAAwC,IACjB;EACvB,MAAMC,OAAO,GAAGD,MAAM,CAACE,aAAa,CAAC,CAAC;EACtC;AACJ;AACA;EACI,IAAAC,uBAAe,EAACF,OAAO,CAAC;EAExB,OAAO;IACH,GAAG,IAAAG,0DAA+B,EAACJ,MAAM,CAAC;IAC1C,GAAG,IAAAK,0DAA+B,EAACL,MAAM,CAAC;IAC1C,GAAG,IAAAM,oEAAoC,EAACN,MAAM,CAAC;IAC/C,GAAG,IAAAO,oEAAoC,EAACP,MAAM,CAAC;IAC/C,GAAG,IAAAQ,wDAA8B,EAACR,MAAM;EAC5C,CAAC;AACL,CAAC;AAACS,OAAA,CAAAV,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -1,3 +1,2 @@
|
|
1
|
-
import { WorkflowModelDefinition } from "../../types";
|
2
1
|
export declare const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
3
|
-
export declare const
|
2
|
+
export declare const createChangeRequestModel: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
@@ -3,7 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createChangeRequestModel = exports.CHANGE_REQUEST_MODEL_ID = void 0;
|
7
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
7
8
|
var _utils = require("./utils");
|
8
9
|
const bodyField = () => (0, _utils.createModelField)({
|
9
10
|
label: "Body",
|
@@ -34,17 +35,15 @@ const stepField = () => (0, _utils.createModelField)({
|
|
34
35
|
name: "required"
|
35
36
|
}]
|
36
37
|
});
|
37
|
-
const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
38
|
-
|
39
|
-
|
40
|
-
return {
|
38
|
+
const CHANGE_REQUEST_MODEL_ID = exports.CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
39
|
+
const createChangeRequestModel = () => {
|
40
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
41
41
|
name: "APW - Change Request",
|
42
42
|
modelId: CHANGE_REQUEST_MODEL_ID,
|
43
43
|
titleFieldId: "title",
|
44
|
-
|
45
|
-
|
46
|
-
description: "",
|
47
|
-
isPrivate: true
|
48
|
-
};
|
44
|
+
fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]
|
45
|
+
});
|
49
46
|
};
|
50
|
-
exports.
|
47
|
+
exports.createChangeRequestModel = createChangeRequestModel;
|
48
|
+
|
49
|
+
//# sourceMappingURL=changeRequest.model.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","
|
1
|
+
{"version":3,"names":["_apiHeadlessCms","require","_utils","bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","exports","createChangeRequestModel","createPrivateModel","modelId","titleFieldId","fields"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst bodyField = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"changeRequest\"\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"changeRequest\"\n });\n\nconst resolvedField = () =>\n createModelField({\n label: \"Resolved\",\n type: \"boolean\",\n parent: \"changeRequest\"\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"changeRequest\"\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"changeRequest\",\n validation: [\n {\n message: \"`step` field value is required in changeRequest.\",\n name: \"required\"\n }\n ]\n });\n\nexport const CHANGE_REQUEST_MODEL_ID = \"apwChangeRequestModelDefinition\";\n\nexport const createChangeRequestModel = () => {\n return createPrivateModel({\n name: \"APW - Change Request\",\n modelId: CHANGE_REQUEST_MODEL_ID,\n titleFieldId: \"title\",\n fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAJ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAME,aAAa,GAAGA,CAAA,KAClB,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAN,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMI,SAAS,GAAGA,CAAA,KACd,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,eAAe;EACvBK,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,kDAAkD;IAC3DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,iCAAiC;AAEjE,MAAME,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO,IAAAC,kCAAkB,EAAC;IACtBJ,IAAI,EAAE,sBAAsB;IAC5BK,OAAO,EAAEJ,uBAAuB;IAChCK,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE,CAAClB,SAAS,CAAC,CAAC,EAAEK,UAAU,CAAC,CAAC,EAAEC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC;EAClF,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { WorkflowModelDefinition } from "../../types";
|
2
1
|
interface CreateCommentModelDefinitionParams {
|
3
2
|
modelId: string;
|
4
3
|
}
|
5
4
|
export declare const COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
6
|
-
export declare const
|
5
|
+
export declare const createCommentModel: ({ modelId }: CreateCommentModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
7
6
|
export {};
|
@@ -3,7 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createCommentModel = exports.COMMENT_MODEL_ID = void 0;
|
7
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
7
8
|
var _utils = require("./utils");
|
8
9
|
const commentBody = () => (0, _utils.createModelField)({
|
9
10
|
label: "Body",
|
@@ -34,19 +35,17 @@ const mediaField = () => (0, _utils.createModelField)({
|
|
34
35
|
type: "file",
|
35
36
|
parent: "comment"
|
36
37
|
});
|
37
|
-
const COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
38
|
-
|
39
|
-
const createCommentModelDefinition = ({
|
38
|
+
const COMMENT_MODEL_ID = exports.COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
39
|
+
const createCommentModel = ({
|
40
40
|
modelId
|
41
41
|
}) => {
|
42
|
-
return {
|
42
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
43
43
|
name: "APW - Comment",
|
44
44
|
modelId: COMMENT_MODEL_ID,
|
45
45
|
titleFieldId: "step",
|
46
|
-
|
47
|
-
|
48
|
-
description: "",
|
49
|
-
isPrivate: true
|
50
|
-
};
|
46
|
+
fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]
|
47
|
+
});
|
51
48
|
};
|
52
|
-
exports.
|
49
|
+
exports.createCommentModel = createCommentModel;
|
50
|
+
|
51
|
+
//# sourceMappingURL=comment.model.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","
|
1
|
+
{"version":3,"names":["_apiHeadlessCms","require","_utils","commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","exports","createCommentModel","createPrivateModel","titleFieldId","fields"],"sources":["comment.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst commentBody = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"comment\"\n });\n\nconst changeRequestRef = (modelId: string) =>\n createModelField({\n label: \"Change Request\",\n type: \"ref\",\n parent: \"comment\",\n settings: {\n models: [\n {\n modelId\n }\n ]\n }\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"comment\",\n validation: [\n {\n message: \"`step` field value is required in comment.\",\n name: \"required\"\n }\n ]\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"comment\"\n });\n\ninterface CreateCommentModelDefinitionParams {\n modelId: string;\n}\n\nexport const COMMENT_MODEL_ID = \"apwCommentModelDefinition\";\n\nexport const createCommentModel = ({ modelId }: CreateCommentModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Comment\",\n modelId: COMMENT_MODEL_ID,\n titleFieldId: \"step\",\n fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,WAAW,GAAGA,CAAA,KAChB,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,gBAAgB,GAAIC,OAAe,IACrC,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,gBAAgB;EACvBC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,SAAS;EACjBG,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ;MACIF;IACJ,CAAC;EAET;AACJ,CAAC,CAAC;AAEN,MAAMG,SAAS,GAAGA,CAAA,KACd,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,SAAS;EACjBM,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,4CAA4C;IACrDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAZ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAMC,MAAMU,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,2BAA2B;AAEpD,MAAME,kBAAkB,GAAGA,CAAC;EAAEV;AAA4C,CAAC,KAAK;EACnF,OAAO,IAAAW,kCAAkB,EAAC;IACtBL,IAAI,EAAE,eAAe;IACrBN,OAAO,EAAEQ,gBAAgB;IACzBI,YAAY,EAAE,MAAM;IACpBC,MAAM,EAAE,CAACnB,WAAW,CAAC,CAAC,EAAEK,gBAAgB,CAACC,OAAO,CAAC,EAAEG,SAAS,CAAC,CAAC,EAAEI,UAAU,CAAC,CAAC;EAChF,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { WorkflowModelDefinition } from "../../types";
|
2
1
|
interface CreateContentReviewModelDefinitionParams {
|
3
2
|
reviewerModelId: string;
|
4
3
|
}
|
5
4
|
export declare const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
6
|
-
export declare const
|
5
|
+
export declare const createContentReviewModel: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
7
6
|
export {};
|
@@ -3,7 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createContentReviewModel = exports.CONTENT_REVIEW_MODEL_ID = void 0;
|
7
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
7
8
|
var _utils = require("./utils");
|
8
9
|
var _workflow = require("./workflow.model");
|
9
10
|
const contentField = fields => (0, _utils.createModelField)({
|
@@ -79,7 +80,7 @@ const contentTypeField = () => (0, _utils.createModelField)({
|
|
79
80
|
label: "Page",
|
80
81
|
value: "page"
|
81
82
|
}, {
|
82
|
-
value: "
|
83
|
+
value: "cms_entry",
|
83
84
|
label: "CMS Entry"
|
84
85
|
}]
|
85
86
|
},
|
@@ -216,17 +217,17 @@ const stepsField = fields => ({
|
|
216
217
|
enabled: false
|
217
218
|
}
|
218
219
|
});
|
219
|
-
const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
220
|
-
|
221
|
-
const createContentReviewModelDefinition = ({
|
220
|
+
const CONTENT_REVIEW_MODEL_ID = exports.CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
221
|
+
const createContentReviewModel = ({
|
222
222
|
reviewerModelId
|
223
|
-
}) =>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
223
|
+
}) => {
|
224
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
225
|
+
name: "APW - Content Review",
|
226
|
+
modelId: CONTENT_REVIEW_MODEL_ID,
|
227
|
+
titleFieldId: "content",
|
228
|
+
fields: [titleField(), contentField([contentIdField(), contentTypeField(), contentSettingsField([contentSettingsModelIdField()]), contentScheduledOnField(), contentScheduledByField(), scheduledActionIdField(), contentPublishedByField()]), contentStatus(), stepsField([(0, _workflow.stepTitleField)(), (0, _workflow.stepTypeField)(), (0, _workflow.stepIdField)(), (0, _workflow.stepReviewersField)(reviewerModelId), stepStatusField(), stepPendingChangeRequests(), stepTotalComments(), stepSignOffProvidedOn(), stepSignOffProvidedBy([stepSignOffProvidedById(), stepSignOffProvidedByDisplayName()])]), latestCommentId(), workflowIdField()]
|
229
|
+
});
|
230
|
+
};
|
231
|
+
exports.createContentReviewModel = createContentReviewModel;
|
232
|
+
|
233
|
+
//# sourceMappingURL=contentReview.model.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","createContentReviewModelDefinition","reviewerModelId","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField","description","isPrivate"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { WorkflowModelDefinition } from \"~/types\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms-entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModelDefinition = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams): WorkflowModelDefinition => ({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n layout: [\n [\"contentReview_title\"],\n [\"contentReview_content\"],\n [\"contentReview_reviewStatus\"],\n [\"contentReview_reviewRequestedBy\"],\n [\"contentReview_steps\"],\n [\"contentReview_changeRequested\"],\n [\"contentReview_latestCommentId\"],\n [\"contentReview_workflowId\"]\n ],\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([stepSignOffProvidedById(), stepSignOffProvidedByDisplayName()])\n ]),\n latestCommentId(),\n workflowIdField()\n ],\n description: \"\",\n isPrivate: true\n});\n"],"mappings":";;;;;;AAAA;AACA;AAIA,MAAMA,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAG,MAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,c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tEnC,IAAI,EAAE,sBAAsB;EAC5BoC,OAAO,EAAEH,uBAAuB;EAChCI,YAAY,EAAE,SAAS;EACvBP,MAAM,EAAE,CACJ,CAAC,qBAAqB,CAAC,EACvB,CAAC,uBAAuB,CAAC,EACzB,CAAC,4BAA4B,CAAC,EAC9B,CAAC,iCAAiC,CAAC,EACnC,CAAC,qBAAqB,CAAC,EACvB,CAAC,+BAA+B,CAAC,EACjC,CAAC,+BAA+B,CAAC,EACjC,CAAC,0BAA0B,CAAC,CAC/B;EACDvC,MAAM,EAAE,CACJgB,UAAU,EAAE,EACZjB,YAAY,CAAC,CACTkB,cAAc,EAAE,EAChBE,gBAAgB,EAAE,EAClBC,oBAAoB,CAAC,CAACC,2BAA2B,EAAE,CAAC,CAAC,EACrDE,uBAAuB,EAAE,EACzBC,uBAAuB,EAAE,EACzBF,sBAAsB,EAAE,EACxBG,uBAAuB,EAAE,CAC5B,CAAC,EACFf,aAAa,EAAE,EACf4B,UAAU,CAAC,CACP,IAAAS,wBAAc,GAAE,EAChB,IAAAC,uBAAa,GAAE,EACf,IAAAC,qBAAW,GAAE,EACb,IAAAC,4BAAkB,EAACN,eAAe,CAAC,EACnClB,eAAe,EAAE,EACjBK,yBAAyB,EAAE,EAC3BC,iBAAiB,EAAE,EACnBE,qBAAqB,EAAE,EACvBC,qBAAqB,CAAC,CAACC,uBAAuB,EAAE,EAAEC,gCAAgC,EAAE,CAAC,CAAC,CACzF,CAAC,EACFJ,eAAe,EAAE,EACjBf,eAAe,EAAE,CACpB;EACDiC,WAAW,EAAE,EAAE;EACfC,SAAS,EAAE;AACf,CAAC,CAAC;AAAC"}
|
1
|
+
{"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,cAAc;EACvBR,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,MAAM;EACZQ,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;MACIZ,KAAK,EAAE,cAAc;MACrBa,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,uBAAuB;MAC9Ba,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,WAAW;MAClBa,KAAK,EAAE;IACX,CAAC;EAET,CAAC;EACDR,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMO,UAAU,GAAGA,CAAA,KACf,IAAAf,uBAAgB,EAAC;EACbC,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CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { CmsContext } from "@webiny/api-headless-cms/types";
|
1
|
+
import type { CmsContext } from "@webiny/api-headless-cms/types";
|
2
2
|
export declare const createApwModels: (context: CmsContext) => void;
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.createApwModels = void 0;
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
9
9
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
10
|
-
var _contentModelPluginFactory = require("./contentModelPluginFactory");
|
11
10
|
var _workflow = require("./workflow.model");
|
12
11
|
var _contentReview = require("./contentReview.model");
|
13
12
|
var _reviewer = require("./reviewer.model");
|
@@ -29,51 +28,31 @@ const createApwModels = context => {
|
|
29
28
|
})) {
|
30
29
|
return;
|
31
30
|
}
|
32
|
-
context.security.disableAuthorization();
|
33
31
|
const locale = context.i18n.getContentLocale();
|
34
32
|
if (!locale) {
|
35
33
|
throw new _error.default("Missing content locale in api-apw/storageOperations/index.ts", "LOCALE_ERROR");
|
36
34
|
}
|
37
|
-
/**
|
38
|
-
* TODO:@ashutosh
|
39
|
-
* We need to move these plugin in an installation plugin
|
40
|
-
*/
|
41
|
-
const groupId = "contentModelGroup_apw";
|
42
|
-
/**
|
43
|
-
* Create a CmsGroup.
|
44
|
-
*/
|
45
|
-
const cmsGroupPlugin = new _apiHeadlessCms.CmsGroupPlugin({
|
46
|
-
id: groupId,
|
47
|
-
slug: "apw",
|
48
|
-
name: "APW",
|
49
|
-
description: "Group for Advanced Publishing Workflow",
|
50
|
-
icon: "fas/star",
|
51
|
-
isPrivate: true
|
52
|
-
});
|
53
35
|
|
54
36
|
/**
|
55
37
|
* Create CmsModel plugins.
|
56
38
|
*/
|
57
|
-
const changeRequestModelDefinition = (0, _changeRequest.
|
58
|
-
const reviewerModelDefinition = (0, _reviewer.
|
59
|
-
const workflowModelDefinition = (0, _workflow.
|
39
|
+
const changeRequestModelDefinition = (0, _changeRequest.createChangeRequestModel)();
|
40
|
+
const reviewerModelDefinition = (0, _reviewer.createReviewerModel)();
|
41
|
+
const workflowModelDefinition = (0, _workflow.createWorkflowModel)({
|
60
42
|
reviewerModelId: reviewerModelDefinition.modelId
|
61
43
|
});
|
62
|
-
const commentModelDefinition = (0, _comment.
|
44
|
+
const commentModelDefinition = (0, _comment.createCommentModel)({
|
63
45
|
modelId: changeRequestModelDefinition.modelId
|
64
46
|
});
|
65
|
-
const contentReviewModelDefinition = (0, _contentReview.
|
47
|
+
const contentReviewModelDefinition = (0, _contentReview.createContentReviewModel)({
|
66
48
|
reviewerModelId: reviewerModelDefinition.modelId
|
67
49
|
});
|
68
50
|
const modelDefinitions = [workflowModelDefinition, contentReviewModelDefinition, reviewerModelDefinition, changeRequestModelDefinition, commentModelDefinition];
|
69
51
|
const cmsModelPlugins = [];
|
70
52
|
for (const modelDefinition of modelDefinitions) {
|
71
|
-
const cmsModelPlugin = (0,
|
72
|
-
group: cmsGroupPlugin.contentModelGroup,
|
73
|
-
modelDefinition
|
74
|
-
});
|
53
|
+
const cmsModelPlugin = (0, _apiHeadlessCms.createCmsModel)(modelDefinition);
|
75
54
|
/**
|
76
|
-
* We want "title" field as the
|
55
|
+
* We want "title" field as the title field for "ContentReview" model.
|
77
56
|
* so that we can later search entries by title.
|
78
57
|
*/
|
79
58
|
if (cmsModelPlugin.contentModel.modelId === "apwContentReviewModelDefinition") {
|
@@ -85,7 +64,8 @@ const createApwModels = context => {
|
|
85
64
|
/**
|
86
65
|
* Register them so that they are accessible in cms context
|
87
66
|
*/
|
88
|
-
context.plugins.register(
|
89
|
-
context.security.enableAuthorization();
|
67
|
+
context.plugins.register(...cmsModelPlugins);
|
90
68
|
};
|
91
|
-
exports.createApwModels = createApwModels;
|
69
|
+
exports.createApwModels = createApwModels;
|
70
|
+
|
71
|
+
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_workflow","_contentReview","_reviewer","_comment","_changeRequest","_utils","createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","changeRequestModelDefinition","createChangeRequestModel","reviewerModelDefinition","createReviewerModel","workflowModelDefinition","createWorkflowModel","reviewerModelId","modelId","commentModelDefinition","createCommentModel","contentReviewModelDefinition","createContentReviewModel","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","createCmsModel","contentModel","titleFieldId","push","plugins","register","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsModelPlugin } from \"@webiny/api-headless-cms\";\nimport { createCmsModel } from \"@webiny/api-headless-cms\";\nimport { createWorkflowModel } from \"./workflow.model\";\nimport { createContentReviewModel } from \"./contentReview.model\";\nimport { createReviewerModel } from \"./reviewer.model\";\nimport { createCommentModel } from \"./comment.model\";\nimport { createChangeRequestModel } from \"./changeRequest.model\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModel();\n const reviewerModelDefinition = createReviewerModel();\n const workflowModelDefinition = createWorkflowModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModel({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = createCmsModel(modelDefinition);\n /**\n * We want \"title\" field as the title field for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register(...cmsModelPlugins);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GA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