@webiny/api-apw 0.0.0-unstable.de38392959 → 0.0.0-unstable.e0bfc55d5a
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.map +1 -1
- package/ApwCommentNotification.d.ts +1 -1
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.d.ts +1 -1
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.d.ts +1 -1
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.d.ts +1 -1
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.d.ts +1 -1
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.d.ts +1 -1
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.d.ts +2 -2
- package/crud/createContentReviewMethods.js +1 -2
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.d.ts +1 -1
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.d.ts +1 -1
- package/crud/index.js.map +1 -1
- package/crud/utils.d.ts +2 -2
- package/crud/utils.js +1 -2
- package/crud/utils.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +4 -5
- package/index.js.map +1 -1
- package/package.json +32 -43
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.d.ts +2 -2
- package/plugins/cms/apwEntryPlugins.js +10 -1
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.d.ts +4 -4
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
- package/plugins/cms/linkWorkflowToEntry.js +1 -1
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.d.ts +2 -2
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +2 -2
- package/plugins/cms/utils.js +1 -3
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +3 -3
- package/plugins/context.js +3 -14
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.d.ts +1 -1
- package/plugins/graphql/changeRequest.gql.js +1 -2
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.d.ts +1 -1
- package/plugins/graphql/comment.gql.js +1 -2
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.d.ts +1 -1
- package/plugins/graphql/contentReview.gql.js +1 -2
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.d.ts +1 -1
- package/plugins/graphql/reviewer.gql.js +1 -2
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.js +2 -4
- package/plugins/graphql/utils.js.map +1 -1
- package/plugins/graphql/workflow.gql.d.ts +1 -1
- package/plugins/graphql/workflow.gql.js +1 -2
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.d.ts +1 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.d.ts +1 -1
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +1 -1
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.d.ts +3 -3
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +2 -2
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -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 +2 -2
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -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 +2 -2
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -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.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.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +1 -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.map +1 -1
- package/plugins/hooks/notifications/reviewers.d.ts +1 -1
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +1 -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.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.d.ts +1 -1
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.d.ts +1 -1
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.d.ts +1 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.d.ts +1 -1
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/utils.d.ts +6 -5
- package/plugins/utils.js +6 -5
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.d.ts +1 -1
- package/scheduler/createScheduleActionMethods.js +63 -38
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +2 -2
- package/scheduler/handlers/executeAction/index.js +0 -1
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- 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.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +3 -2
- 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.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +2 -2
- package/scheduler/handlers/scheduleAction/index.js +1 -3
- 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.map +1 -1
- package/scheduler/handlers/utils.d.ts +1 -1
- package/scheduler/handlers/utils.js +15 -7
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.d.ts +1 -1
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +11 -11
- package/scheduler/types.js +3 -6
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
- package/storageOperations/changeRequestStorageOperations.js +13 -25
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.d.ts +3 -3
- package/storageOperations/commentStorageOperations.js +15 -28
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
- package/storageOperations/contentReviewStorageOperations.js +14 -27
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +3 -3
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -1
- package/storageOperations/models/changeRequest.model.js +5 -6
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -1
- package/storageOperations/models/comment.model.js +5 -6
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -1
- package/storageOperations/models/contentReview.model.js +5 -6
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.d.ts +1 -1
- package/storageOperations/models/index.js +5 -5
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -1
- package/storageOperations/models/reviewer.model.js +5 -6
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.d.ts +2 -2
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +2 -2
- package/storageOperations/models/workflow.model.js +5 -6
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +3 -3
- package/storageOperations/reviewerStorageOperations.js +14 -27
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.d.ts +2 -2
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.d.ts +2 -2
- package/storageOperations/workflowStorageOperations.js +11 -24
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +31 -48
- package/types.js +6 -12
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.d.ts +2 -2
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.d.ts +2 -2
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +1 -1
- package/utils/pickEntryFieldValues.js +1 -2
- package/utils/pickEntryFieldValues.js.map +1 -1
- package/utils/resolve.d.ts +1 -1
- package/utils/resolve.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +0 -2
- package/plugins/hooks/notifications/appUrl.js +0 -20
- package/plugins/hooks/notifications/appUrl.js.map +0 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -36
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -28
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -22
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
- package/plugins/pageBuilder/index.d.ts +0 -11
- package/plugins/pageBuilder/index.js +0 -44
- package/plugins/pageBuilder/index.js.map +0 -1
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkContentReviewToPage.js +0 -93
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkWorkflowToPage.js +0 -166
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -33
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +0 -33
- package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -33
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +0 -49
- package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
- package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
- package/plugins/pageBuilder/triggerContentReview.js +0 -41
- package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
- package/plugins/pageBuilder/updateContentReviewStatus.js +0 -72
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
- package/plugins/pageBuilder/utils.d.ts +0 -22
- package/plugins/pageBuilder/utils.js +0 -152
- package/plugins/pageBuilder/utils.js.map +0 -1
@@ -19,13 +19,10 @@ const pickIdFromChangeRequest = obj => {
|
|
19
19
|
};
|
20
20
|
const createCommentStorageOperations = ({
|
21
21
|
cms,
|
22
|
-
getCmsContext
|
23
|
-
security
|
22
|
+
getCmsContext
|
24
23
|
}) => {
|
25
24
|
const getCommentModel = async () => {
|
26
|
-
const model = await
|
27
|
-
return cms.getModel(_comment.COMMENT_MODEL_ID);
|
28
|
-
});
|
25
|
+
const model = await cms.getModel(_comment.COMMENT_MODEL_ID);
|
29
26
|
if (!model) {
|
30
27
|
throw new _error.default(`Could not find "${_comment.COMMENT_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
|
31
28
|
}
|
@@ -35,9 +32,7 @@ const createCommentStorageOperations = ({
|
|
35
32
|
id
|
36
33
|
}) => {
|
37
34
|
const model = await getCommentModel();
|
38
|
-
const entry = await
|
39
|
-
return cms.getEntryById(model, id);
|
40
|
-
});
|
35
|
+
const entry = await cms.getEntryById(model, id);
|
41
36
|
return (0, _fieldResolver.getFieldValues)({
|
42
37
|
entry,
|
43
38
|
fields: _pickEntryFieldValues.baseFields,
|
@@ -53,9 +48,7 @@ const createCommentStorageOperations = ({
|
|
53
48
|
},
|
54
49
|
async listComments(params) {
|
55
50
|
const model = await getCommentModel();
|
56
|
-
const [entries, meta] = await
|
57
|
-
return cms.listLatestEntries(model, params);
|
58
|
-
});
|
51
|
+
const [entries, meta] = await cms.listLatestEntries(model, params);
|
59
52
|
const values = await Promise.all(entries.map(entry => (0, _fieldResolver.getFieldValues)({
|
60
53
|
entry,
|
61
54
|
fields: _pickEntryFieldValues.baseFields,
|
@@ -68,14 +61,12 @@ const createCommentStorageOperations = ({
|
|
68
61
|
async createComment(params) {
|
69
62
|
const model = await getCommentModel();
|
70
63
|
const refModel = await this.getChangeRequestModel();
|
71
|
-
const entry = await
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
78
|
-
});
|
64
|
+
const entry = await cms.createEntry(model, {
|
65
|
+
...params.data,
|
66
|
+
changeRequest: {
|
67
|
+
id: params.data.changeRequest,
|
68
|
+
modelId: refModel.modelId
|
69
|
+
}
|
79
70
|
});
|
80
71
|
const values = await (0, _fieldResolver.getFieldValues)({
|
81
72
|
entry,
|
@@ -94,12 +85,10 @@ const createCommentStorageOperations = ({
|
|
94
85
|
const existingEntry = await getComment({
|
95
86
|
id: params.id
|
96
87
|
});
|
97
|
-
const entry = await
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
savedOn: new Date()
|
102
|
-
});
|
88
|
+
const entry = await cms.updateEntry(model, params.id, {
|
89
|
+
...existingEntry,
|
90
|
+
...params.data,
|
91
|
+
savedOn: new Date()
|
103
92
|
});
|
104
93
|
const values = await (0, _fieldResolver.getFieldValues)({
|
105
94
|
entry,
|
@@ -111,9 +100,7 @@ const createCommentStorageOperations = ({
|
|
111
100
|
},
|
112
101
|
async deleteComment(params) {
|
113
102
|
const model = await getCommentModel();
|
114
|
-
await
|
115
|
-
return cms.deleteEntry(model, params.id);
|
116
|
-
});
|
103
|
+
await cms.deleteEntry(model, params.id);
|
117
104
|
return true;
|
118
105
|
}
|
119
106
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_fieldResolver","require","_pickEntryFieldValues","_error","_interopRequireDefault","_comment","pickIdFromChangeRequest","obj","rawValue","id","createCommentStorageOperations","cms","getCmsContext","
|
1
|
+
{"version":3,"names":["_fieldResolver","require","_pickEntryFieldValues","_error","_interopRequireDefault","_comment","pickIdFromChangeRequest","obj","rawValue","id","createCommentStorageOperations","cms","getCmsContext","getCommentModel","model","getModel","COMMENT_MODEL_ID","WebinyError","getComment","entry","getEntryById","getFieldValues","fields","baseFields","context","transformers","getTransformer","params","values","listComments","entries","meta","listLatestEntries","Promise","all","map","value","createComment","refModel","getChangeRequestModel","createEntry","data","changeRequest","modelId","updateComment","existingEntry","updateEntry","savedOn","Date","deleteComment","deleteEntry","exports"],"sources":["commentStorageOperations.ts"],"sourcesContent":["import type { ApwStorageOperations } from \"./types\";\nimport type { ApwCommentStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations/index\";\nimport { getFieldValues, getTransformer } from \"~/utils/fieldResolver\";\nimport { baseFields } from \"~/utils/pickEntryFieldValues\";\n\nimport WebinyError from \"@webiny/error\";\nimport type { ApwComment } from \"~/types\";\nimport type { CmsEntryListParams } from \"@webiny/api-headless-cms/types\";\nimport { COMMENT_MODEL_ID } from \"~/storageOperations/models/comment.model\";\n\nconst pickIdFromChangeRequest = (obj: Record<string, any>): ApwComment => {\n const rawValue = obj[\"changeRequest\"];\n if (!rawValue) {\n return obj as unknown as ApwComment;\n }\n obj[\"changeRequest\"] = rawValue.id;\n return obj as unknown as ApwComment;\n};\n\nexport const createCommentStorageOperations = ({\n cms,\n getCmsContext\n}: CreateApwStorageOperationsParams): ApwCommentStorageOperations => {\n const getCommentModel = async () => {\n const model = await cms.getModel(COMMENT_MODEL_ID);\n\n if (!model) {\n throw new WebinyError(\n `Could not find \"${COMMENT_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getComment: ApwCommentStorageOperations[\"getComment\"] = async ({ id }) => {\n const model = await getCommentModel();\n const entry = await cms.getEntryById(model, id);\n\n return getFieldValues({\n entry,\n fields: baseFields,\n context: getCmsContext(),\n transformers: [getTransformer(model, \"body\")]\n });\n };\n return {\n getCommentModel,\n getComment: async params => {\n const values = await getComment(params);\n return pickIdFromChangeRequest(values);\n },\n async listComments(params) {\n const model = await getCommentModel();\n const [entries, meta] = await cms.listLatestEntries(\n model,\n params as CmsEntryListParams\n );\n const values = await Promise.all(\n entries.map(entry =>\n getFieldValues<ApwComment>({\n entry,\n fields: baseFields,\n context: getCmsContext(),\n transformers: [getTransformer(model, \"body\")]\n })\n )\n );\n const all = values.map(value => pickIdFromChangeRequest(value));\n return [all, meta];\n },\n async createComment(this: ApwStorageOperations, params) {\n const model = await getCommentModel();\n const refModel = await this.getChangeRequestModel();\n\n const entry = await cms.createEntry(model, {\n ...params.data,\n changeRequest: {\n id: params.data.changeRequest,\n modelId: refModel.modelId\n }\n });\n\n const values = await getFieldValues({\n entry,\n fields: baseFields,\n context: getCmsContext(),\n transformers: [getTransformer(model, \"body\")]\n });\n return pickIdFromChangeRequest(values);\n },\n async updateComment(params) {\n const model = await getCommentModel();\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 getComment({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n\n const values = await getFieldValues({\n entry,\n fields: baseFields,\n context: getCmsContext(),\n transformers: [getTransformer(model, \"body\")]\n });\n return pickIdFromChangeRequest(values);\n },\n async deleteComment(params) {\n const model = await getCommentModel();\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAGA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,MAAMK,uBAAuB,GAAIC,GAAwB,IAAiB;EACtE,MAAMC,QAAQ,GAAGD,GAAG,CAAC,eAAe,CAAC;EACrC,IAAI,CAACC,QAAQ,EAAE;IACX,OAAOD,GAAG;EACd;EACAA,GAAG,CAAC,eAAe,CAAC,GAAGC,QAAQ,CAACC,EAAE;EAClC,OAAOF,GAAG;AACd,CAAC;AAEM,MAAMG,8BAA8B,GAAGA,CAAC;EAC3CC,GAAG;EACHC;AAC8B,CAAC,KAAkC;EACjE,MAAMC,eAAe,GAAG,MAAAA,CAAA,KAAY;IAChC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AI;QACdM,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MAEF,MAAMpB,MAAM,GAAG,MAAM,IAAAP,6BAAc,EAAC;QAChCF,KAAK;QACLG,MAAM,EAAEC,gCAAU;QAClBC,OAAO,EAAEZ,aAAa,CAAC,CAAC;QACxBa,YAAY,EAAE,CAAC,IAAAC,6BAAc,EAACZ,KAAK,EAAE,MAAM,CAAC;MAChD,CAAC,CAAC;MACF,OAAOR,uBAAuB,CAACsB,MAAM,CAAC;IAC1C,CAAC;IACD,MAAMqB,aAAaA,CAACtB,MAAM,EAAE;MACxB,MAAMb,KAAK,GAAG,MAAMD,eAAe,CAAC,CAAC;MACrC,MAAMF,GAAG,CAACuC,WAAW,CAACpC,KAAK,EAAEa,MAAM,CAAClB,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC0C,OAAA,CAAAzC,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { ApwContentReviewStorageOperations } from "./types";
|
2
|
-
import { CreateApwStorageOperationsParams } from "
|
3
|
-
export declare const createContentReviewStorageOperations: ({ cms
|
1
|
+
import type { ApwContentReviewStorageOperations } from "./types";
|
2
|
+
import type { CreateApwStorageOperationsParams } from "./";
|
3
|
+
export declare const createContentReviewStorageOperations: ({ cms }: CreateApwStorageOperationsParams) => ApwContentReviewStorageOperations;
|
@@ -9,13 +9,10 @@ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
|
|
9
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
10
10
|
var _contentReview = require("./models/contentReview.model");
|
11
11
|
const createContentReviewStorageOperations = ({
|
12
|
-
cms
|
13
|
-
security
|
12
|
+
cms
|
14
13
|
}) => {
|
15
14
|
const getContentReviewModel = async () => {
|
16
|
-
const model = await
|
17
|
-
return cms.getModel(_contentReview.CONTENT_REVIEW_MODEL_ID);
|
18
|
-
});
|
15
|
+
const model = await cms.getModel(_contentReview.CONTENT_REVIEW_MODEL_ID);
|
19
16
|
if (!model) {
|
20
17
|
throw new _error.default(`Could not find "${_contentReview.CONTENT_REVIEW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
|
21
18
|
}
|
@@ -25,9 +22,7 @@ const createContentReviewStorageOperations = ({
|
|
25
22
|
id
|
26
23
|
}) => {
|
27
24
|
const model = await getContentReviewModel();
|
28
|
-
const entry = await
|
29
|
-
return cms.getEntryById(model, id);
|
30
|
-
});
|
25
|
+
const entry = await cms.getEntryById(model, id);
|
31
26
|
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
32
27
|
};
|
33
28
|
return {
|
@@ -35,21 +30,17 @@ const createContentReviewStorageOperations = ({
|
|
35
30
|
getContentReview,
|
36
31
|
async listContentReviews(params) {
|
37
32
|
const model = await getContentReviewModel();
|
38
|
-
const [entries, meta] = await
|
39
|
-
|
40
|
-
|
41
|
-
where
|
42
|
-
|
43
|
-
}
|
44
|
-
});
|
33
|
+
const [entries, meta] = await cms.listLatestEntries(model, {
|
34
|
+
...params,
|
35
|
+
where: {
|
36
|
+
...params.where
|
37
|
+
}
|
45
38
|
});
|
46
39
|
return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
|
47
40
|
},
|
48
41
|
async createContentReview(params) {
|
49
42
|
const model = await getContentReviewModel();
|
50
|
-
const entry = await
|
51
|
-
return cms.createEntry(model, params.data);
|
52
|
-
});
|
43
|
+
const entry = await cms.createEntry(model, params.data);
|
53
44
|
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
54
45
|
},
|
55
46
|
async updateContentReview(params) {
|
@@ -61,20 +52,16 @@ const createContentReviewStorageOperations = ({
|
|
61
52
|
const existingEntry = await getContentReview({
|
62
53
|
id: params.id
|
63
54
|
});
|
64
|
-
const entry = await
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
savedOn: new Date()
|
69
|
-
});
|
55
|
+
const entry = await cms.updateEntry(model, params.id, {
|
56
|
+
...existingEntry,
|
57
|
+
...params.data,
|
58
|
+
savedOn: new Date()
|
70
59
|
});
|
71
60
|
return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
|
72
61
|
},
|
73
62
|
async deleteContentReview(params) {
|
74
63
|
const model = await getContentReviewModel();
|
75
|
-
await
|
76
|
-
return cms.deleteEntry(model, params.id);
|
77
|
-
});
|
64
|
+
await cms.deleteEntry(model, params.id);
|
78
65
|
return true;
|
79
66
|
}
|
80
67
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_contentReview","createContentReviewStorageOperations","cms","
|
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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D,MAAMkB,mBAAmBA,CAACd,MAAM,EAAE;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,6 +1,6 @@
|
|
1
|
-
import { CmsContext, HeadlessCms } from "@webiny/api-headless-cms/types";
|
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;
|
@@ -1 +1 @@
|
|
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
|
+
{"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,2 +1,2 @@
|
|
1
1
|
export declare const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
2
|
-
export declare const
|
2
|
+
export declare const createChangeRequestModel: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
@@ -3,7 +3,7 @@
|
|
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
7
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
8
8
|
var _utils = require("./utils");
|
9
9
|
const bodyField = () => (0, _utils.createModelField)({
|
@@ -35,16 +35,15 @@ const stepField = () => (0, _utils.createModelField)({
|
|
35
35
|
name: "required"
|
36
36
|
}]
|
37
37
|
});
|
38
|
-
const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
39
|
-
|
40
|
-
|
41
|
-
return (0, _apiHeadlessCms.createPrivateModelDefinition)({
|
38
|
+
const CHANGE_REQUEST_MODEL_ID = exports.CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
|
39
|
+
const createChangeRequestModel = () => {
|
40
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
42
41
|
name: "APW - Change Request",
|
43
42
|
modelId: CHANGE_REQUEST_MODEL_ID,
|
44
43
|
titleFieldId: "title",
|
45
44
|
fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]
|
46
45
|
});
|
47
46
|
};
|
48
|
-
exports.
|
47
|
+
exports.createChangeRequestModel = createChangeRequestModel;
|
49
48
|
|
50
49
|
//# sourceMappingURL=changeRequest.model.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_apiHeadlessCms","require","_utils","bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","exports","
|
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":[]}
|
@@ -2,5 +2,5 @@ interface CreateCommentModelDefinitionParams {
|
|
2
2
|
modelId: string;
|
3
3
|
}
|
4
4
|
export declare const COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
5
|
-
export declare const
|
5
|
+
export declare const createCommentModel: ({ modelId }: CreateCommentModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
6
6
|
export {};
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.createCommentModel = exports.COMMENT_MODEL_ID = void 0;
|
7
7
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
8
8
|
var _utils = require("./utils");
|
9
9
|
const commentBody = () => (0, _utils.createModelField)({
|
@@ -35,18 +35,17 @@ const mediaField = () => (0, _utils.createModelField)({
|
|
35
35
|
type: "file",
|
36
36
|
parent: "comment"
|
37
37
|
});
|
38
|
-
const COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
39
|
-
|
40
|
-
const createCommentModelDefinition = ({
|
38
|
+
const COMMENT_MODEL_ID = exports.COMMENT_MODEL_ID = "apwCommentModelDefinition";
|
39
|
+
const createCommentModel = ({
|
41
40
|
modelId
|
42
41
|
}) => {
|
43
|
-
return (0, _apiHeadlessCms.
|
42
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
44
43
|
name: "APW - Comment",
|
45
44
|
modelId: COMMENT_MODEL_ID,
|
46
45
|
titleFieldId: "step",
|
47
46
|
fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]
|
48
47
|
});
|
49
48
|
};
|
50
|
-
exports.
|
49
|
+
exports.createCommentModel = createCommentModel;
|
51
50
|
|
52
51
|
//# sourceMappingURL=comment.model.js.map
|
@@ -1 +1 @@
|
|
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","
|
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":[]}
|
@@ -2,5 +2,5 @@ interface CreateContentReviewModelDefinitionParams {
|
|
2
2
|
reviewerModelId: string;
|
3
3
|
}
|
4
4
|
export declare const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
5
|
-
export declare const
|
5
|
+
export declare const createContentReviewModel: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|
6
6
|
export {};
|
@@ -3,7 +3,7 @@
|
|
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
7
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
8
8
|
var _utils = require("./utils");
|
9
9
|
var _workflow = require("./workflow.model");
|
@@ -217,18 +217,17 @@ const stepsField = fields => ({
|
|
217
217
|
enabled: false
|
218
218
|
}
|
219
219
|
});
|
220
|
-
const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
221
|
-
|
222
|
-
const createContentReviewModelDefinition = ({
|
220
|
+
const CONTENT_REVIEW_MODEL_ID = exports.CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
|
221
|
+
const createContentReviewModel = ({
|
223
222
|
reviewerModelId
|
224
223
|
}) => {
|
225
|
-
return (0, _apiHeadlessCms.
|
224
|
+
return (0, _apiHeadlessCms.createPrivateModel)({
|
226
225
|
name: "APW - Content Review",
|
227
226
|
modelId: CONTENT_REVIEW_MODEL_ID,
|
228
227
|
titleFieldId: "content",
|
229
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()]
|
230
229
|
});
|
231
230
|
};
|
232
|
-
exports.
|
231
|
+
exports.createContentReviewModel = createContentReviewModel;
|
233
232
|
|
234
233
|
//# sourceMappingURL=contentReview.model.js.map
|
@@ -1 +1 @@
|
|
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","createContentReviewModelDefinition","reviewerModelId","createPrivateModelDefinition","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModelDefinition } from \"@webiny/api-headless-cms\";\nimport { 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 createContentReviewModelDefinition = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModelDefinition({\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,KAAK,EAAE,OAAO;EACdE,IAAI,EAAE,MAAM;EACZD,MAAM,EAAE,eAAe;EACvBI,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,mDA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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,kCAAA,GAAAA,kCAAA"}
|
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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AEzB,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;
|
@@ -36,15 +36,15 @@ const createApwModels = context => {
|
|
36
36
|
/**
|
37
37
|
* Create CmsModel plugins.
|
38
38
|
*/
|
39
|
-
const changeRequestModelDefinition = (0, _changeRequest.
|
40
|
-
const reviewerModelDefinition = (0, _reviewer.
|
41
|
-
const workflowModelDefinition = (0, _workflow.
|
39
|
+
const changeRequestModelDefinition = (0, _changeRequest.createChangeRequestModel)();
|
40
|
+
const reviewerModelDefinition = (0, _reviewer.createReviewerModel)();
|
41
|
+
const workflowModelDefinition = (0, _workflow.createWorkflowModel)({
|
42
42
|
reviewerModelId: reviewerModelDefinition.modelId
|
43
43
|
});
|
44
|
-
const commentModelDefinition = (0, _comment.
|
44
|
+
const commentModelDefinition = (0, _comment.createCommentModel)({
|
45
45
|
modelId: changeRequestModelDefinition.modelId
|
46
46
|
});
|
47
|
-
const contentReviewModelDefinition = (0, _contentReview.
|
47
|
+
const contentReviewModelDefinition = (0, _contentReview.createContentReviewModel)({
|
48
48
|
reviewerModelId: reviewerModelDefinition.modelId
|
49
49
|
});
|
50
50
|
const modelDefinitions = [workflowModelDefinition, contentReviewModelDefinition, reviewerModelDefinition, changeRequestModelDefinition, commentModelDefinition];
|
@@ -1 +1 @@
|
|
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","
|
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,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAEO,MAAMQ,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,iCAAiC,CAAC;IAC/C;EACJ;EAEA,IAAI,IAAAC,4BAAqB,EAAC;IAAEC,OAAO,EAAEL,OAAO,CAACK,OAAO;IAAEC,IAAI,EAAEN,OAAO,CAACM;EAAK,CAAC,CAAC,EAAE;IACzE;EACJ;EAEA,MAAMC,MAAM,GAAGP,OAAO,CAACM,IAAI,CAACE,gBAAgB,CAAC,CAAC;EAC9C,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CACjB,8DAA8D,EAC9D,cACJ,CAAC;EACL;;EAEA;AACJ;AACA;EACI,MAAMC,4BAA4B,GAAG,IAAAC,uCAAwB,EAAC,CAAC;EAC/D,MAAMC,uBAAuB,GAAG,IAAAC,6BAAmB,EAAC,CAAC;EACrD,MAAMC,uBAAuB,GAAG,IAAAC,6BAAmB,EAAC;IAChDC,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EACF,MAAMC,sBAAsB,GAAG,IAAAC,2BAAkB,EAAC;IAC9CF,OAAO,EAAEP,4BAA4B,CAACO;EAC1C,CAAC,CAAC;EACF,MAAMG,4BAA4B,GAAG,IAAAC,uCAAwB,EAAC;IAC1DL,eAAe,EAAEJ,uBAAuB,CAACK;EAC7C,CAAC,CAAC;EAEF,MAAMK,gBAAgB,GAAG,CACrBR,uBAAuB,EACvBM,4BAA4B,EAC5BR,uBAAuB,EACvBF,4BAA4B,EAC5BQ,sBAAsB,CACzB;EAED,MAAMK,eAAiC,GAAG,EAAE;EAC5C,KAAK,MAAMC,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,cAAc,GAAG,IAAAC,8BAAc,EAACF,eAAe,CAAC;IACtD;AACR;AACA;AACA;IACQ,IAAIC,cAAc,CAACE,YAAY,CAACV,OAAO,KAAK,iCAAiC,EAAE;MAC3EQ,cAAc,CAACE,YAAY,CAACC,YAAY,GAAG,OAAO;IACtD;IACAL,eAAe,CAACM,IAAI,CAACJ,cAAc,CAAC;EACxC;;EAEA;AACJ;AACA;EACIzB,OAAO,CAAC8B,OAAO,CAACC,QAAQ,CAAC,GAAGR,eAAe,CAAC;AAChD,CAAC;AAACS,OAAA,CAAAjC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const REVIEWER_MODEL_ID = "apwReviewerModelDefinition";
|
2
|
-
export declare const
|
2
|
+
export declare const createReviewerModel: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
|