@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.2696f9d9e8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApwChangeRequestNotification.d.ts +27 -0
- package/ApwChangeRequestNotification.js +28 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +28 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +28 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +28 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/ContentApwSettingsPlugin.js +5 -9
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/README.md +3 -3
- package/crud/createChangeRequestMethods.js +7 -12
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +7 -13
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +83 -111
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +7 -13
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js +7 -18
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +5 -29
- package/crud/index.js.map +1 -1
- package/crud/utils.js +6 -33
- package/crud/utils.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +6 -16
- package/index.js.map +1 -1
- package/package.json +40 -47
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +4 -19
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +8 -13
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +7 -10
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +4 -20
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +17 -45
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +33 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/cms/notifications/commentNotification.d.ts +1 -0
- package/plugins/cms/notifications/commentNotification.js +33 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -0
- package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/cms/notifications/contentReviewNotification.js +33 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/cms/notifications/contentUrl.d.ts +8 -0
- package/plugins/cms/notifications/contentUrl.js +55 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/cms/triggerContentReview.js +5 -18
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +14 -30
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +3 -2
- package/plugins/cms/utils.js +23 -60
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +0 -1
- package/plugins/context.js +2 -45
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +16 -19
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +41 -42
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +25 -34
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +17 -19
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.d.ts +2 -0
- package/plugins/graphql/utils.js +12 -0
- package/plugins/graphql/utils.js.map +1 -0
- package/plugins/graphql/workflow.gql.js +15 -19
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +5 -18
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +28 -15
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -9
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -8
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +4 -13
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +15 -20
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +17 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +1 -1
- package/plugins/hooks/listContentReviews.js +11 -33
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +2 -0
- package/plugins/hooks/notifications/appUrl.js +20 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +113 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
- package/plugins/hooks/notifications/changeRequestUrl.js +29 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/commentAfterCreate.js +124 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
- package/plugins/hooks/notifications/commentUrl.js +29 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +96 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentReviewUrl.js +28 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentUrl.js +26 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/reviewers.d.ts +15 -0
- package/plugins/hooks/notifications/reviewers.js +47 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +43 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendCommentNotification.js +43 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js +43 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/updatePendingChangeRequests.js +7 -13
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +21 -23
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +27 -16
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +13 -12
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +2 -6
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +4 -19
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +2 -4
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +3 -6
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +7 -8
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +15 -27
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +3 -31
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +33 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.js +33 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +33 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.js +49 -0
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
- package/plugins/pageBuilder/triggerContentReview.js +2 -11
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +10 -17
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.d.ts +2 -2
- package/plugins/pageBuilder/utils.js +3 -35
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +1 -2
- package/plugins/utils.js +6 -52
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +45 -50
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +47 -40
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +19 -9
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +11 -28
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +10 -92
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +2 -11
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js +24 -37
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +20 -36
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +2 -4
- package/scheduler/handlers/utils.js +8 -47
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +2 -3
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +12 -28
- package/scheduler/types.js +13 -22
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +59 -45
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +35 -50
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +1 -1
- package/storageOperations/contentReviewStorageOperations.js +34 -43
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +1 -7
- package/storageOperations/index.js +10 -29
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -2
- package/storageOperations/models/changeRequest.model.js +6 -15
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -2
- package/storageOperations/models/comment.model.js +6 -14
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -2
- package/storageOperations/models/contentReview.model.js +13 -37
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +6 -50
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -2
- package/storageOperations/models/reviewer.model.js +22 -14
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +2 -4
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +1 -2
- package/storageOperations/models/workflow.model.js +19 -42
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +1 -1
- package/storageOperations/reviewerStorageOperations.js +34 -40
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.js +3 -1
- package/storageOperations/workflowStorageOperations.js +40 -47
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +39 -25
- package/types.js +126 -42
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +2 -6
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +2 -17
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +8 -18
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +3 -0
- package/utils/pickEntryFieldValues.js +31 -0
- package/utils/pickEntryFieldValues.js.map +1 -0
- package/utils/resolve.d.ts +1 -1
- package/utils/resolve.js +2 -3
- package/utils/resolve.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +0 -15
- package/storageOperations/models/contentModelPluginFactory.js +0 -28
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -1,93 +1,84 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.createContentReviewStorageOperations = void 0;
|
9
|
-
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
|
12
|
-
var _index = require("./index");
|
13
|
-
|
8
|
+
var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
|
14
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
15
|
-
|
16
10
|
var _contentReview = require("./models/contentReview.model");
|
17
|
-
|
18
11
|
const createContentReviewStorageOperations = ({
|
19
12
|
cms,
|
20
13
|
security
|
21
14
|
}) => {
|
22
15
|
const getContentReviewModel = async () => {
|
23
|
-
security.
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
const model = await security.withoutAuthorization(async () => {
|
17
|
+
return cms.getModel(_contentReview.CONTENT_REVIEW_MODEL_ID);
|
18
|
+
});
|
27
19
|
if (!model) {
|
28
20
|
throw new _error.default(`Could not find "${_contentReview.CONTENT_REVIEW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
|
29
21
|
}
|
30
|
-
|
31
22
|
return model;
|
32
23
|
};
|
33
|
-
|
34
24
|
const getContentReview = async ({
|
35
25
|
id
|
36
26
|
}) => {
|
37
27
|
const model = await getContentReviewModel();
|
38
|
-
security.
|
39
|
-
|
40
|
-
|
41
|
-
return (0,
|
28
|
+
const entry = await security.withoutAuthorization(async () => {
|
29
|
+
return cms.getEntryById(model, id);
|
30
|
+
});
|
31
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
42
32
|
};
|
43
|
-
|
44
33
|
return {
|
45
34
|
getContentReviewModel,
|
46
35
|
getContentReview,
|
47
|
-
|
48
36
|
async listContentReviews(params) {
|
49
37
|
const model = await getContentReviewModel();
|
50
|
-
security.
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
38
|
+
const [entries, meta] = await security.withoutAuthorization(async () => {
|
39
|
+
return cms.listLatestEntries(model, {
|
40
|
+
...params,
|
41
|
+
where: {
|
42
|
+
...params.where
|
43
|
+
}
|
44
|
+
});
|
45
|
+
});
|
46
|
+
return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
|
56
47
|
},
|
57
|
-
|
58
48
|
async createContentReview(params) {
|
59
49
|
const model = await getContentReviewModel();
|
60
|
-
security.
|
61
|
-
|
62
|
-
|
63
|
-
return (0,
|
50
|
+
const entry = await security.withoutAuthorization(async () => {
|
51
|
+
return cms.createEntry(model, params.data);
|
52
|
+
});
|
53
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
64
54
|
},
|
65
|
-
|
66
55
|
async updateContentReview(params) {
|
67
56
|
const model = await getContentReviewModel();
|
68
57
|
/**
|
69
58
|
* We're fetching the existing entry here because we're not accepting "app" field as input,
|
70
59
|
* but, we still need to retain its value after the "update" operation.
|
71
60
|
*/
|
72
|
-
|
73
61
|
const existingEntry = await getContentReview({
|
74
62
|
id: params.id
|
75
63
|
});
|
76
|
-
security.
|
77
|
-
|
78
|
-
|
79
|
-
|
64
|
+
const entry = await security.withoutAuthorization(async () => {
|
65
|
+
return cms.updateEntry(model, params.id, {
|
66
|
+
...existingEntry,
|
67
|
+
...params.data,
|
68
|
+
savedOn: new Date()
|
69
|
+
});
|
70
|
+
});
|
71
|
+
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
80
72
|
},
|
81
|
-
|
82
73
|
async deleteContentReview(params) {
|
83
74
|
const model = await getContentReviewModel();
|
84
|
-
security.
|
85
|
-
|
86
|
-
|
75
|
+
await security.withoutAuthorization(async () => {
|
76
|
+
return cms.deleteEntry(model, params.id);
|
77
|
+
});
|
87
78
|
return true;
|
88
79
|
}
|
89
|
-
|
90
80
|
};
|
91
81
|
};
|
82
|
+
exports.createContentReviewStorageOperations = createContentReviewStorageOperations;
|
92
83
|
|
93
|
-
|
84
|
+
//# sourceMappingURL=contentReviewStorageOperations.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createContentReviewStorageOperations","cms","security","getContentReviewModel","
|
1
|
+
{"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_contentReview","createContentReviewStorageOperations","cms","security","getContentReviewModel","model","withoutAuthorization","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 { ApwContentReviewStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport { ApwContentReview } from \"~/types\";\n\nexport const createContentReviewStorageOperations = ({\n cms,\n security\n}: CreateApwStorageOperationsParams): ApwContentReviewStorageOperations => {\n const getContentReviewModel = async () => {\n const model = await security.withoutAuthorization(async () => {\n return cms.getModel(CONTENT_REVIEW_MODEL_ID);\n });\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 security.withoutAuthorization(async () => {\n return cms.getEntryById(model, id);\n });\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 security.withoutAuthorization(async () => {\n return cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\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 security.withoutAuthorization(async () => {\n return cms.createEntry(model, params.data);\n });\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 security.withoutAuthorization(async () => {\n return cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n });\n return pickEntryFieldValues(entry);\n },\n async deleteContentReview(params) {\n const model = await getContentReviewModel();\n\n await security.withoutAuthorization(async () => {\n return cms.deleteEntry(model, params.id);\n });\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,GAAG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2
|
import { ApwStorageOperations } from "../types";
|
3
3
|
import { Security } from "@webiny/api-security/types";
|
4
4
|
export interface CreateApwStorageOperationsParams {
|
@@ -6,10 +6,4 @@ export interface CreateApwStorageOperationsParams {
|
|
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,48 +1,29 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
6
4
|
value: true
|
7
5
|
});
|
8
|
-
exports.createStorageOperations =
|
9
|
-
exports.getFieldValues = getFieldValues;
|
10
|
-
|
11
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
12
|
-
|
13
|
-
var _pick = _interopRequireDefault(require("lodash/pick"));
|
14
|
-
|
6
|
+
exports.createStorageOperations = void 0;
|
15
7
|
var _reviewerStorageOperations = require("./reviewerStorageOperations");
|
16
|
-
|
17
8
|
var _workflowStorageOperations = require("./workflowStorageOperations");
|
18
|
-
|
19
9
|
var _contentReviewStorageOperations = require("./contentReviewStorageOperations");
|
20
|
-
|
21
10
|
var _changeRequestStorageOperations = require("./changeRequestStorageOperations");
|
22
|
-
|
23
11
|
var _commentStorageOperations = require("./commentStorageOperations");
|
24
|
-
|
25
12
|
var _models = require("./models");
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Using any because value can be a lot of types.
|
29
|
-
* TODO @ts-refactor figure out correct types.
|
30
|
-
*/
|
31
|
-
function getFieldValues(entry, fields) {
|
32
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
|
33
|
-
}
|
34
|
-
|
35
|
-
const baseFields = ["id", "entryId", "createdBy", "createdOn", "savedOn"];
|
36
|
-
exports.baseFields = baseFields;
|
37
|
-
|
38
13
|
const createStorageOperations = params => {
|
39
14
|
const context = params.getCmsContext();
|
40
15
|
/**
|
41
16
|
* Register Apw models.
|
42
17
|
*/
|
43
|
-
|
44
18
|
(0, _models.createApwModels)(context);
|
45
|
-
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
|
+
};
|
46
26
|
};
|
27
|
+
exports.createStorageOperations = createStorageOperations;
|
47
28
|
|
48
|
-
|
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 { CmsContext, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { 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 { 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"}
|
@@ -1,3 +1,2 @@
|
|
1
|
-
import { WorkflowModelDefinition } from "../../types";
|
2
1
|
export declare const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
3
|
-
export declare const createChangeRequestModelDefinition: () =>
|
2
|
+
export declare const createChangeRequestModelDefinition: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
@@ -4,33 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createChangeRequestModelDefinition = exports.CHANGE_REQUEST_MODEL_ID = void 0;
|
7
|
-
|
7
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
8
8
|
var _utils = require("./utils");
|
9
|
-
|
10
9
|
const bodyField = () => (0, _utils.createModelField)({
|
11
10
|
label: "Body",
|
12
11
|
type: "rich-text",
|
13
12
|
parent: "changeRequest"
|
14
13
|
});
|
15
|
-
|
16
14
|
const titleField = () => (0, _utils.createModelField)({
|
17
15
|
label: "Title",
|
18
16
|
type: "text",
|
19
17
|
parent: "changeRequest"
|
20
18
|
});
|
21
|
-
|
22
19
|
const resolvedField = () => (0, _utils.createModelField)({
|
23
20
|
label: "Resolved",
|
24
21
|
type: "boolean",
|
25
22
|
parent: "changeRequest"
|
26
23
|
});
|
27
|
-
|
28
24
|
const mediaField = () => (0, _utils.createModelField)({
|
29
25
|
label: "Media",
|
30
26
|
type: "file",
|
31
27
|
parent: "changeRequest"
|
32
28
|
});
|
33
|
-
|
34
29
|
const stepField = () => (0, _utils.createModelField)({
|
35
30
|
label: "Step",
|
36
31
|
type: "text",
|
@@ -40,20 +35,16 @@ const stepField = () => (0, _utils.createModelField)({
|
|
40
35
|
name: "required"
|
41
36
|
}]
|
42
37
|
});
|
43
|
-
|
44
38
|
const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
45
39
|
exports.CHANGE_REQUEST_MODEL_ID = CHANGE_REQUEST_MODEL_ID;
|
46
|
-
|
47
40
|
const createChangeRequestModelDefinition = () => {
|
48
|
-
return {
|
41
|
+
return (0, _apiHeadlessCms.createPrivateModelDefinition)({
|
49
42
|
name: "APW - Change Request",
|
50
43
|
modelId: CHANGE_REQUEST_MODEL_ID,
|
51
44
|
titleFieldId: "title",
|
52
|
-
|
53
|
-
|
54
|
-
description: "",
|
55
|
-
isPrivate: true
|
56
|
-
};
|
45
|
+
fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]
|
46
|
+
});
|
57
47
|
};
|
48
|
+
exports.createChangeRequestModelDefinition = createChangeRequestModelDefinition;
|
58
49
|
|
59
|
-
|
50
|
+
//# 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","createChangeRequestModelDefinition","createPrivateModelDefinition","modelId","titleFieldId","fields"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createPrivateModelDefinition } 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 createChangeRequestModelDefinition = () => {\n return createPrivateModelDefinition({\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,I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AAC,CAAC;EAClF,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAC,kCAAA,GAAAA,kCAAA"}
|
@@ -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 createCommentModelDefinition: ({ modelId }: CreateCommentModelDefinitionParams) =>
|
5
|
+
export declare const createCommentModelDefinition: ({ modelId }: CreateCommentModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
7
6
|
export {};
|
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createCommentModelDefinition = exports.COMMENT_MODEL_ID = void 0;
|
7
|
-
|
7
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
8
8
|
var _utils = require("./utils");
|
9
|
-
|
10
9
|
const commentBody = () => (0, _utils.createModelField)({
|
11
10
|
label: "Body",
|
12
11
|
type: "rich-text",
|
13
12
|
parent: "comment"
|
14
13
|
});
|
15
|
-
|
16
14
|
const changeRequestRef = modelId => (0, _utils.createModelField)({
|
17
15
|
label: "Change Request",
|
18
16
|
type: "ref",
|
@@ -23,7 +21,6 @@ const changeRequestRef = modelId => (0, _utils.createModelField)({
|
|
23
21
|
}]
|
24
22
|
}
|
25
23
|
});
|
26
|
-
|
27
24
|
const stepField = () => (0, _utils.createModelField)({
|
28
25
|
label: "Step",
|
29
26
|
type: "text",
|
@@ -33,28 +30,23 @@ const stepField = () => (0, _utils.createModelField)({
|
|
33
30
|
name: "required"
|
34
31
|
}]
|
35
32
|
});
|
36
|
-
|
37
33
|
const mediaField = () => (0, _utils.createModelField)({
|
38
34
|
label: "Media",
|
39
35
|
type: "file",
|
40
36
|
parent: "comment"
|
41
37
|
});
|
42
|
-
|
43
38
|
const COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
44
39
|
exports.COMMENT_MODEL_ID = COMMENT_MODEL_ID;
|
45
|
-
|
46
40
|
const createCommentModelDefinition = ({
|
47
41
|
modelId
|
48
42
|
}) => {
|
49
|
-
return {
|
43
|
+
return (0, _apiHeadlessCms.createPrivateModelDefinition)({
|
50
44
|
name: "APW - Comment",
|
51
45
|
modelId: COMMENT_MODEL_ID,
|
52
46
|
titleFieldId: "step",
|
53
|
-
|
54
|
-
|
55
|
-
description: "",
|
56
|
-
isPrivate: true
|
57
|
-
};
|
47
|
+
fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]
|
48
|
+
});
|
58
49
|
};
|
50
|
+
exports.createCommentModelDefinition = createCommentModelDefinition;
|
59
51
|
|
60
|
-
|
52
|
+
//# 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","createCommentModelDefinition","createPrivateModelDefinition","titleFieldId","fields"],"sources":["comment.model.ts"],"sourcesContent":["import { createPrivateModelDefinition } 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 createCommentModelDefinition = ({ modelId }: CreateCommentModelDefinitionParams) => {\n return createPrivateModelDefinition({\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,GAAG,2BAA2B;AAACC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AAErD,MAAME,4BAA4B,GAAGA,CAAC;EAAEV;AAA4C,CAAC,KAAK;EAC7F,OAAO,IAAAW,4CAA4B,EAAC;IAChCL,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,4BAAA,GAAAA,4BAAA"}
|
@@ -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 createContentReviewModelDefinition: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) =>
|
5
|
+
export declare const createContentReviewModelDefinition: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
7
6
|
export {};
|