@webiny/api-apw 5.34.8 → 5.35.0-beta.0
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.js +0 -10
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.js +0 -10
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.js +0 -10
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.js +0 -10
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.js +0 -5
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.js +4 -11
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +4 -12
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +20 -84
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +4 -12
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js +4 -17
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +0 -25
- package/crud/index.js.map +1 -1
- package/crud/utils.js +0 -28
- package/crud/utils.js.map +1 -1
- package/index.d.ts +1 -2
- package/index.js +1 -15
- package/index.js.map +1 -1
- package/package.json +34 -34
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +0 -15
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +0 -8
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +0 -13
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +0 -17
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +2 -31
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js +0 -4
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js +0 -4
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js +0 -4
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js +1 -8
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.js +0 -14
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +0 -18
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js +2 -47
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +0 -1
- package/plugins/context.js +2 -47
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +3 -10
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +3 -10
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +6 -25
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +3 -10
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +3 -10
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +3 -18
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +2 -11
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -9
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -8
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +0 -14
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +2 -18
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.js +0 -5
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.js +0 -12
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.js +0 -4
- package/plugins/hooks/notifications/appUrl.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +3 -36
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestUrl.js +0 -4
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +3 -38
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentUrl.js +0 -4
- package/plugins/hooks/notifications/commentUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +4 -32
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewUrl.js +0 -4
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.js +0 -5
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +0 -4
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +0 -4
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +0 -4
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.js +15 -21
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +0 -11
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js +0 -11
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js +0 -11
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +0 -8
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +0 -9
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +0 -16
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +1 -12
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +0 -6
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -15
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -4
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +1 -6
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +0 -11
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +0 -16
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +1 -31
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -4
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +0 -4
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -4
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +1 -7
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
- package/plugins/pageBuilder/triggerContentReview.js +0 -11
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +0 -12
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js +1 -35
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.js +0 -43
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +1 -20
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +9 -40
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +0 -7
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -23
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -28
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +0 -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 +5 -25
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +2 -23
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +1 -2
- package/scheduler/handlers/utils.js +3 -41
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +0 -3
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +2 -20
- package/scheduler/types.js +0 -11
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +20 -39
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +23 -44
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +20 -37
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js +0 -14
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.js +0 -9
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.js +0 -8
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +3 -10
- package/storageOperations/models/contentModelPluginFactory.js +3 -11
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +0 -26
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +2 -28
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +0 -8
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +0 -4
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.js +0 -23
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +23 -45
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +20 -39
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +6 -5
- package/types.js +0 -14
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +0 -6
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +0 -17
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +2 -12
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.d.ts +1 -1
- package/utils/resolve.js +0 -3
- package/utils/resolve.js.map +1 -1
@@ -1,20 +1,14 @@
|
|
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.validateChangeRequest = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
-
|
14
10
|
var _utils = require("../utils");
|
15
|
-
|
16
11
|
var _utils2 = require("@webiny/utils");
|
17
|
-
|
18
12
|
const validateChangeRequest = ({
|
19
13
|
apw
|
20
14
|
}) => {
|
@@ -27,7 +21,6 @@ const validateChangeRequest = ({
|
|
27
21
|
/**
|
28
22
|
* We need step to be in a particular format i.e. "contentReviewId#version#stepId"
|
29
23
|
*/
|
30
|
-
|
31
24
|
const {
|
32
25
|
id: revisionId,
|
33
26
|
stepId
|
@@ -36,7 +29,6 @@ const validateChangeRequest = ({
|
|
36
29
|
id: entryId,
|
37
30
|
version
|
38
31
|
} = (0, _utils2.parseIdentifier)(revisionId);
|
39
|
-
|
40
32
|
if (!entryId || !version || !stepId) {
|
41
33
|
throw new _error.default(`The step property in input is not properly formatted.`, "MALFORMED_CHANGE_REQUEST_STEP", {
|
42
34
|
step
|
@@ -45,10 +37,7 @@ const validateChangeRequest = ({
|
|
45
37
|
/**
|
46
38
|
* Check whether a contentReview entry exists with provided id.
|
47
39
|
*/
|
48
|
-
|
49
|
-
|
50
40
|
let contentReview = undefined;
|
51
|
-
|
52
41
|
try {
|
53
42
|
contentReview = await apw.contentReview.get(revisionId);
|
54
43
|
} catch (ex) {
|
@@ -63,20 +52,16 @@ const validateChangeRequest = ({
|
|
63
52
|
});
|
64
53
|
}
|
65
54
|
}
|
66
|
-
|
67
55
|
if (!contentReview) {
|
68
56
|
throw new _handlerGraphql.NotFoundError(`Unable to found "ContentReview" with given id "${revisionId}"`);
|
69
57
|
}
|
70
58
|
/**
|
71
59
|
* Don't allow "change request" creation once the sign-off has been provided.
|
72
60
|
*/
|
73
|
-
|
74
|
-
|
75
61
|
const {
|
76
62
|
steps
|
77
63
|
} = contentReview;
|
78
64
|
const currentStep = steps.find(step => step.id === stepId);
|
79
|
-
|
80
65
|
if (currentStep && currentStep.signOffProvidedOn) {
|
81
66
|
throw new _error.default(`Please retract the sign-off before opening a new change request.`, "SIGN_OFF_PROVIDED", {
|
82
67
|
step: currentStep,
|
@@ -85,5 +70,4 @@ const validateChangeRequest = ({
|
|
85
70
|
}
|
86
71
|
});
|
87
72
|
};
|
88
|
-
|
89
73
|
exports.validateChangeRequest = validateChangeRequest;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["validateChangeRequest","apw","changeRequest","onChangeRequestBeforeCreate","subscribe","input","step","id","revisionId","stepId","extractContentReviewIdAndStep","entryId","version","parseIdentifier","WebinyError","contentReview","undefined","get","ex","process","env","NODE_ENV","console","log","message","code","data","NotFoundError","steps","currentStep","find","signOffProvidedOn"],"sources":["validateChangeRequest.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ApwContentReview, LifeCycleHookCallbackParams } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const validateChangeRequest = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({ input }) => {\n const { step } = input;\n /**\n * We need step to be in a particular format i.e. \"contentReviewId#version#stepId\"\n */\n const { id: revisionId, stepId } = extractContentReviewIdAndStep(step);\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n if (!entryId || !version || !stepId) {\n throw new WebinyError(\n `The step property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_STEP\",\n {\n step\n }\n );\n }\n /**\n * Check whether a contentReview entry exists with provided id.\n */\n let contentReview: ApwContentReview | undefined = undefined;\n try {\n contentReview = await apw.contentReview.get(revisionId);\n } catch (ex) {\n /**\n * There is no need to output the log if this is the test environment.\n */\n if (process.env.NODE_ENV !== \"test\") {\n console.log({\n message: ex.message,\n code: ex.data,\n data: ex.data\n });\n }\n }\n if (!contentReview) {\n throw new NotFoundError(\n `Unable to found \"ContentReview\" with given id \"${revisionId}\"`\n );\n }\n /**\n * Don't allow \"change request\" creation once the sign-off has been provided.\n */\n const { steps } = contentReview;\n const currentStep = steps.find(step => step.id === stepId);\n\n if (currentStep && currentStep.signOffProvidedOn) {\n throw new WebinyError(\n `Please retract the sign-off before opening a new change request.`,\n \"SIGN_OFF_PROVIDED\",\n {\n step: currentStep,\n stepId: stepId\n }\n );\n }\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["validateChangeRequest","apw","changeRequest","onChangeRequestBeforeCreate","subscribe","input","step","id","revisionId","stepId","extractContentReviewIdAndStep","entryId","version","parseIdentifier","WebinyError","contentReview","undefined","get","ex","process","env","NODE_ENV","console","log","message","code","data","NotFoundError","steps","currentStep","find","signOffProvidedOn"],"sources":["validateChangeRequest.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ApwContentReview, LifeCycleHookCallbackParams } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const validateChangeRequest = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({ input }) => {\n const { step } = input;\n /**\n * We need step to be in a particular format i.e. \"contentReviewId#version#stepId\"\n */\n const { id: revisionId, stepId } = extractContentReviewIdAndStep(step);\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n if (!entryId || !version || !stepId) {\n throw new WebinyError(\n `The step property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_STEP\",\n {\n step\n }\n );\n }\n /**\n * Check whether a contentReview entry exists with provided id.\n */\n let contentReview: ApwContentReview | undefined = undefined;\n try {\n contentReview = await apw.contentReview.get(revisionId);\n } catch (ex) {\n /**\n * There is no need to output the log if this is the test environment.\n */\n if (process.env.NODE_ENV !== \"test\") {\n console.log({\n message: ex.message,\n code: ex.data,\n data: ex.data\n });\n }\n }\n if (!contentReview) {\n throw new NotFoundError(\n `Unable to found \"ContentReview\" with given id \"${revisionId}\"`\n );\n }\n /**\n * Don't allow \"change request\" creation once the sign-off has been provided.\n */\n const { steps } = contentReview;\n const currentStep = steps.find(step => step.id === stepId);\n\n if (currentStep && currentStep.signOffProvidedOn) {\n throw new WebinyError(\n `Please retract the sign-off before opening a new change request.`,\n \"SIGN_OFF_PROVIDED\",\n {\n step: currentStep,\n stepId: stepId\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AAEO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK;IACtB;AACR;AACA;IACQ,MAAM;MAAEE,EAAE,EAAEC,UAAU;MAAEC;IAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;IAEtE,MAAM;MAAEC,EAAE,EAAEI,OAAO;MAAEC;IAAQ,CAAC,GAAG,IAAAC,uBAAe,EAACL,UAAU,CAAC;IAC5D,IAAI,CAACG,OAAO,IAAI,CAACC,OAAO,IAAI,CAACH,MAAM,EAAE;MACjC,MAAM,IAAIK,cAAW,CAChB,uDAAsD,EACvD,+BAA+B,EAC/B;QACIR;MACJ,CAAC,CACJ;IACL;IACA;AACR;AACA;IACQ,IAAIS,aAA2C,GAAGC,SAAS;IAC3D,IAAI;MACAD,aAAa,GAAG,MAAMd,GAAG,CAACc,aAAa,CAACE,GAAG,CAACT,UAAU,CAAC;IAC3D,CAAC,CAAC,OAAOU,EAAE,EAAE;MACT;AACZ;AACA;MACY,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;QACjCC,OAAO,CAACC,GAAG,CAAC;UACRC,OAAO,EAAEN,EAAE,CAACM,OAAO;UACnBC,IAAI,EAAEP,EAAE,CAACQ,IAAI;UACbA,IAAI,EAAER,EAAE,CAACQ;QACb,CAAC,CAAC;MACN;IACJ;IACA,IAAI,CAACX,aAAa,EAAE;MAChB,MAAM,IAAIY,6BAAa,CAClB,kDAAiDnB,UAAW,GAAE,CAClE;IACL;IACA;AACR;AACA;IACQ,MAAM;MAAEoB;IAAM,CAAC,GAAGb,aAAa;IAC/B,MAAMc,WAAW,GAAGD,KAAK,CAACE,IAAI,CAACxB,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAKE,MAAM,CAAC;IAE1D,IAAIoB,WAAW,IAAIA,WAAW,CAACE,iBAAiB,EAAE;MAC9C,MAAM,IAAIjB,cAAW,CAChB,kEAAiE,EAClE,mBAAmB,EACnB;QACIR,IAAI,EAAEuB,WAAW;QACjBpB,MAAM,EAAEA;MACZ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,16 +1,12 @@
|
|
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.validateComment = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
var _utils = require("@webiny/utils");
|
13
|
-
|
14
10
|
const validateComment = ({
|
15
11
|
apw
|
16
12
|
}) => {
|
@@ -23,12 +19,9 @@ const validateComment = ({
|
|
23
19
|
/**
|
24
20
|
* We need changeRequest to be in a particular format i.e. "contentReviewUniqueId#version"
|
25
21
|
*/
|
26
|
-
|
27
22
|
let result;
|
28
|
-
|
29
23
|
try {
|
30
24
|
result = (0, _utils.parseIdentifier)(changeRequestId);
|
31
|
-
|
32
25
|
if (!result) {
|
33
26
|
throw new _error.default("Could not parse changeRequestId.", "MALFORMED_CHANGE_REQUEST_ID", {
|
34
27
|
changeRequestId
|
@@ -39,19 +32,15 @@ const validateComment = ({
|
|
39
32
|
input
|
40
33
|
});
|
41
34
|
}
|
35
|
+
|
42
36
|
/**
|
43
37
|
* Assign value for "step" field from "changeRequest".
|
44
38
|
*/
|
45
|
-
|
46
|
-
|
47
39
|
const changeRequest = await apw.changeRequest.get(changeRequestId);
|
48
|
-
|
49
40
|
if (!changeRequest) {
|
50
41
|
return;
|
51
42
|
}
|
52
|
-
|
53
43
|
input.step = changeRequest.step;
|
54
44
|
});
|
55
45
|
};
|
56
|
-
|
57
46
|
exports.validateComment = validateComment;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["validateComment","apw","comment","onCommentBeforeCreate","subscribe","input","changeRequest","changeRequestId","result","parseIdentifier","WebinyError","ex","get","step"],"sources":["validateComment.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\nimport { parseIdentifier, ParseIdentifierResult } from \"@webiny/utils\";\n\nexport const validateComment = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentBeforeCreate.subscribe(async ({ input }) => {\n const { changeRequest: changeRequestId } = input;\n /**\n * We need changeRequest to be in a particular format i.e. \"contentReviewUniqueId#version\"\n */\n let result: ParseIdentifierResult;\n try {\n result = parseIdentifier(changeRequestId);\n if (!result) {\n throw new WebinyError(\n \"Could not parse changeRequestId.\",\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n changeRequestId\n }\n );\n }\n } catch (ex) {\n throw new WebinyError(\n `The\"changeRequest\" property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n input\n }\n );\n }\n\n /**\n * Assign value for \"step\" field from \"changeRequest\".\n */\n const changeRequest = await apw.changeRequest.get(changeRequestId);\n if (!changeRequest) {\n return;\n }\n input.step = changeRequest.step;\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["validateComment","apw","comment","onCommentBeforeCreate","subscribe","input","changeRequest","changeRequestId","result","parseIdentifier","WebinyError","ex","get","step"],"sources":["validateComment.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\nimport { parseIdentifier, ParseIdentifierResult } from \"@webiny/utils\";\n\nexport const validateComment = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentBeforeCreate.subscribe(async ({ input }) => {\n const { changeRequest: changeRequestId } = input;\n /**\n * We need changeRequest to be in a particular format i.e. \"contentReviewUniqueId#version\"\n */\n let result: ParseIdentifierResult;\n try {\n result = parseIdentifier(changeRequestId);\n if (!result) {\n throw new WebinyError(\n \"Could not parse changeRequestId.\",\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n changeRequestId\n }\n );\n }\n } catch (ex) {\n throw new WebinyError(\n `The\"changeRequest\" property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n input\n }\n );\n }\n\n /**\n * Assign value for \"step\" field from \"changeRequest\".\n */\n const changeRequest = await apw.changeRequest.get(changeRequestId);\n if (!changeRequest) {\n return;\n }\n input.step = changeRequest.step;\n });\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAEO,MAAMA,eAAe,GAAG,CAAC;EAAEC;AAA8C,CAAC,KAAK;EAClFA,GAAG,CAACC,OAAO,CAACC,qBAAqB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IAC7D,MAAM;MAAEC,aAAa,EAAEC;IAAgB,CAAC,GAAGF,KAAK;IAChD;AACR;AACA;IACQ,IAAIG,MAA6B;IACjC,IAAI;MACAA,MAAM,GAAG,IAAAC,sBAAe,EAACF,eAAe,CAAC;MACzC,IAAI,CAACC,MAAM,EAAE;QACT,MAAM,IAAIE,cAAW,CACjB,kCAAkC,EAClC,6BAA6B,EAC7B;UACIH;QACJ,CAAC,CACJ;MACL;IACJ,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAID,cAAW,CAChB,iEAAgE,EACjE,6BAA6B,EAC7B;QACIL;MACJ,CAAC,CACJ;IACL;;IAEA;AACR;AACA;IACQ,MAAMC,aAAa,GAAG,MAAML,GAAG,CAACK,aAAa,CAACM,GAAG,CAACL,eAAe,CAAC;IAClE,IAAI,CAACD,aAAa,EAAE;MAChB;IACJ;IACAD,KAAK,CAACQ,IAAI,GAAGP,aAAa,CAACO,IAAI;EACnC,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,14 +1,11 @@
|
|
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.validateContentReview = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
const validateContentReview = ({
|
13
10
|
apw
|
14
11
|
}) => {
|
@@ -21,11 +18,9 @@ const validateContentReview = ({
|
|
21
18
|
/**
|
22
19
|
* Check whether a contentReview already exists for provided content.
|
23
20
|
*/
|
24
|
-
|
25
21
|
const {
|
26
22
|
contentReviewId
|
27
23
|
} = await apw.contentReview.isReviewRequired(content);
|
28
|
-
|
29
24
|
if (contentReviewId) {
|
30
25
|
throw new _error.default(`A peer review for this content has been already requested.`, "REVIEW_ALREADY_EXIST", {
|
31
26
|
contentReviewId,
|
@@ -34,5 +29,4 @@ const validateContentReview = ({
|
|
34
29
|
}
|
35
30
|
});
|
36
31
|
};
|
37
|
-
|
38
32
|
exports.validateContentReview = validateContentReview;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAGO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAQ,CAAC,GAAGD,KAAK;IACzB;AACR;AACA;IACQ,MAAM;MAAEE;IAAgB,CAAC,GAAG,MAAMN,GAAG,CAACC,aAAa,CAACM,gBAAgB,CAACF,OAAO,CAAC;IAC7E,IAAIC,eAAe,EAAE;MACjB,MAAM,IAAIE,cAAW,CAChB,4DAA2D,EAC5D,sBAAsB,EACtB;QACIF,eAAe;QACfD;MACJ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,51 +1,36 @@
|
|
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.PageApwSettingsGetterPlugin = void 0;
|
9
|
-
|
10
8
|
var _ContentApwSettingsPlugin = require("../../ContentApwSettingsPlugin");
|
11
|
-
|
12
9
|
var _types = require("../../types");
|
13
|
-
|
14
10
|
var _set = _interopRequireDefault(require("lodash/set"));
|
15
|
-
|
16
11
|
class PageApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSettingsPlugin {
|
17
12
|
canUse(type) {
|
18
13
|
return type === _types.ApwContentTypes.PAGE;
|
19
14
|
}
|
20
|
-
|
21
15
|
setWorkflowId(page, id) {
|
22
16
|
page.settings = (0, _set.default)(page.settings || {}, "apw.workflowId", id);
|
23
17
|
}
|
24
|
-
|
25
18
|
getWorkflowId(page) {
|
26
19
|
var _page$settings$apw;
|
27
|
-
|
28
20
|
if (!page.settings) {
|
29
21
|
return null;
|
30
22
|
}
|
31
|
-
|
32
23
|
return ((_page$settings$apw = page.settings.apw) === null || _page$settings$apw === void 0 ? void 0 : _page$settings$apw.workflowId) || null;
|
33
24
|
}
|
34
|
-
|
35
25
|
setContentReviewId(page, id) {
|
36
26
|
page.settings = (0, _set.default)(page.settings || {}, "apw.contentReviewId", id);
|
37
27
|
}
|
38
|
-
|
39
28
|
getContentReviewId(page) {
|
40
29
|
var _page$settings$apw2;
|
41
|
-
|
42
30
|
if (!page.settings) {
|
43
31
|
return null;
|
44
32
|
}
|
45
|
-
|
46
33
|
return (_page$settings$apw2 = page.settings.apw) === null || _page$settings$apw2 === void 0 ? void 0 : _page$settings$apw2.contentReviewId;
|
47
34
|
}
|
48
|
-
|
49
35
|
}
|
50
|
-
|
51
36
|
exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":"
|
1
|
+
{"version":3,"names":["PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEO,MAAMA,2BAA2B,SAASC,kDAAwB,CAAC;EACtDC,MAAM,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,IAAI;EACxC;EAEgBC,aAAa,CAACC,IAAsB,EAAEC,EAAiB,EAAE;IACrED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAClE;EAEgBG,aAAa,CAACJ,IAAsB,EAAiB;IAAA;IACjE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,OAAO,uBAAAF,IAAI,CAACE,QAAQ,CAACG,GAAG,uDAAjB,mBAAmBC,UAAU,KAAI,IAAI;EAChD;EAEgBC,kBAAkB,CAACP,IAAsB,EAAEC,EAAiB,EAAE;IAC1ED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACvE;EAEgBO,kBAAkB,CAACR,IAAsB,EAAiB;IAAA;IACtE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,8BAAOF,IAAI,CAACE,QAAQ,CAACG,GAAG,wDAAjB,oBAAmBI,eAAe;EAC7C;AACJ;AAAC"}
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.apwContentPagePlugins = void 0;
|
7
|
-
|
8
7
|
var _api = require("@webiny/api");
|
9
|
-
|
10
8
|
var _types = require("../../types");
|
11
|
-
|
12
9
|
const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
|
13
10
|
const {
|
14
11
|
apw,
|
@@ -26,5 +23,4 @@ const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
|
|
26
23
|
return true;
|
27
24
|
});
|
28
25
|
});
|
29
|
-
|
30
26
|
exports.apwContentPagePlugins = apwContentPagePlugins;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":"
|
1
|
+
{"version":3,"names":["apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,qBAAqB,GAAG,MACjC,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,OAAO;EAEpCC,GAAG,CAACE,gBAAgB,CAACC,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACnD,OAAOJ,WAAW,CAACK,OAAO,CAAmBD,EAAE,CAAC;EACpD,CAAC,CAAC;EAEFL,GAAG,CAACO,mBAAmB,CAACJ,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACtD,MAAMJ,WAAW,CAACO,WAAW,CAAmBH,EAAE,CAAC;IACnD,OAAO,IAAI;EACf,CAAC,CAAC;EAEFL,GAAG,CAACS,qBAAqB,CAACN,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACxD,MAAMJ,WAAW,CAACS,aAAa,CAAmBL,EAAE,CAAC;IACrD,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC,CAAC;AAAC"}
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.extendPbPageSettingsSchema = void 0;
|
7
|
-
|
8
7
|
var _plugins = require("@webiny/handler-graphql/plugins");
|
9
|
-
|
10
8
|
const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
|
11
|
-
typeDefs:
|
12
|
-
/* GraphQL */
|
13
|
-
`
|
9
|
+
typeDefs: /* GraphQL */`
|
14
10
|
type PbApwPageSettings {
|
15
11
|
workflowId: ID
|
16
12
|
contentReviewId: ID
|
@@ -21,5 +17,4 @@ const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
|
|
21
17
|
}
|
22
18
|
`
|
23
19
|
});
|
24
|
-
|
25
20
|
exports.extendPbPageSettingsSchema = extendPbPageSettingsSchema;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":"
|
1
|
+
{"version":3,"names":["extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":";;;;;;AAAA;AAGO,MAAMA,0BAA0B,GAAG,MACtC,IAAIC,4BAAmB,CAAa;EAChCC,QAAQ,EAAE,aAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,CAAC,CAAC;AAAC"}
|
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.apwPageBuilderHooks = void 0;
|
7
|
-
|
8
7
|
var _triggerContentReview = require("./triggerContentReview");
|
9
|
-
|
10
8
|
var _linkContentReviewToPage = require("./linkContentReviewToPage");
|
11
|
-
|
12
9
|
var _updateContentReviewStatus = require("./updateContentReviewStatus");
|
13
|
-
|
14
10
|
var _linkWorkflowToPage = require("./linkWorkflowToPage");
|
15
|
-
|
16
11
|
var _PageApwSettingsGetterPlugin = require("./PageApwSettingsGetterPlugin");
|
17
|
-
|
18
12
|
var _commentNotification = require("./notifications/commentNotification");
|
19
|
-
|
20
13
|
var _contentUrl = require("./notifications/contentUrl");
|
21
|
-
|
22
14
|
var _changeRequestNotification = require("./notifications/changeRequestNotification");
|
23
|
-
|
24
15
|
var _contentReviewNotification = require("./notifications/contentReviewNotification");
|
25
|
-
|
26
16
|
const apwPageBuilderHooks = params => {
|
27
17
|
const {
|
28
18
|
pageBuilder,
|
@@ -49,5 +39,4 @@ const apwPageBuilderHooks = params => {
|
|
49
39
|
pageBuilder
|
50
40
|
});
|
51
41
|
};
|
52
|
-
|
53
42
|
exports.apwPageBuilderHooks = apwPageBuilderHooks;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register([\n new PageApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register([\n new PageApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AASO,MAAMA,mBAAmB,GAAIC,MAAmC,IAAK;EACxE,MAAM;IAAEC,WAAW;IAAEC,GAAG;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAEtDI,OAAO,CAACC,QAAQ,CAAC,CACb,IAAIC,wDAA2B,EAAE,EACjC,IAAAC,8CAAyB,GAAE,EAC3B,IAAAC,0DAA+B,GAAE,EACjC,IAAAC,kCAAsB,GAAE,EACxB,IAAAC,0DAA+B,GAAE,CACpC,CAAC;EAEF,IAAAC,0CAAoB,EAAC;IACjBT,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAW,gDAAuB,EAAC;IACpBV,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAY,oDAAyB,EAAC;IACtBX,GAAG;IACHD,WAAW;IACXE;EACJ,CAAC,CAAC;EACF,IAAAW,sCAAkB,EAAC;IACfZ,GAAG;IACHD;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,20 +1,14 @@
|
|
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.linkContentReviewToPage = void 0;
|
9
|
-
|
10
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
|
12
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
13
|
-
|
14
10
|
var _types = require("../../types");
|
15
|
-
|
16
11
|
var _utils = require("./utils");
|
17
|
-
|
18
12
|
const linkContentReviewToPage = params => {
|
19
13
|
const {
|
20
14
|
apw,
|
@@ -26,11 +20,9 @@ const linkContentReviewToPage = params => {
|
|
26
20
|
const {
|
27
21
|
content
|
28
22
|
} = contentReview;
|
29
|
-
|
30
23
|
if (content.type !== _types.ApwContentTypes.PAGE) {
|
31
24
|
return;
|
32
25
|
}
|
33
|
-
|
34
26
|
await (0, _utils.updatePageSettings)({
|
35
27
|
getPage: pageBuilder.getPage,
|
36
28
|
updatePage: pageBuilder.updatePage,
|
@@ -50,11 +42,9 @@ const linkContentReviewToPage = params => {
|
|
50
42
|
const {
|
51
43
|
content
|
52
44
|
} = contentReview;
|
53
|
-
|
54
45
|
if (content.type !== _types.ApwContentTypes.PAGE) {
|
55
46
|
return;
|
56
47
|
}
|
57
|
-
|
58
48
|
await (0, _utils.updatePageSettings)({
|
59
49
|
getPage: pageBuilder.getPage,
|
60
50
|
updatePage: pageBuilder.updatePage,
|
@@ -72,15 +62,11 @@ const linkContentReviewToPage = params => {
|
|
72
62
|
page
|
73
63
|
}) => {
|
74
64
|
var _page$settings, _page$settings$apw;
|
75
|
-
|
76
65
|
const contentReviewId = (_page$settings = page.settings) === null || _page$settings === void 0 ? void 0 : (_page$settings$apw = _page$settings.apw) === null || _page$settings$apw === void 0 ? void 0 : _page$settings$apw.contentReviewId;
|
77
|
-
|
78
66
|
if (!contentReviewId) {
|
79
67
|
return;
|
80
68
|
}
|
81
|
-
|
82
69
|
let contentReview;
|
83
|
-
|
84
70
|
try {
|
85
71
|
contentReview = await apw.contentReview.get(contentReviewId);
|
86
72
|
} catch (ex) {
|
@@ -92,7 +78,6 @@ const linkContentReviewToPage = params => {
|
|
92
78
|
throw ex;
|
93
79
|
}
|
94
80
|
}
|
95
|
-
|
96
81
|
if (contentReview) {
|
97
82
|
throw new _error.default(`Cannot delete the page because a peer review has been requested. Please delete the review first.`, "CANNOT_DELETE_REVIEW_EXIST", {
|
98
83
|
contentReviewId,
|
@@ -101,5 +86,4 @@ const linkContentReviewToPage = params => {
|
|
101
86
|
}
|
102
87
|
});
|
103
88
|
};
|
104
|
-
|
105
89
|
exports.linkContentReviewToPage = linkContentReviewToPage;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["linkContentReviewToPage","params","apw","pageBuilder","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","PAGE","updatePageSettings","getPage","updatePage","uniquePageId","id","getNewSettings","settings","contentReviewId","onContentReviewAfterDelete","onPageBeforeDelete","page","get","ex","code","Error"],"sources":["linkContentReviewToPage.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { updatePageSettings } from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkContentReviewToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkContentReviewToPage = (params: LinkContentReviewToPageParams) => {\n const { apw, pageBuilder } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: contentReview.id\n }\n };\n }\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: null\n }\n };\n }\n });\n });\n\n pageBuilder.onPageBeforeDelete.subscribe(async ({ page }) => {\n const contentReviewId = page.settings?.apw?.contentReviewId;\n if (!contentReviewId) {\n return;\n }\n\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (contentReview) {\n throw new Error(\n `Cannot delete the page because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n page\n }\n );\n }\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["linkContentReviewToPage","params","apw","pageBuilder","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","PAGE","updatePageSettings","getPage","updatePage","uniquePageId","id","getNewSettings","settings","contentReviewId","onContentReviewAfterDelete","onPageBeforeDelete","page","get","ex","code","Error"],"sources":["linkContentReviewToPage.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { updatePageSettings } from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkContentReviewToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkContentReviewToPage = (params: LinkContentReviewToPageParams) => {\n const { apw, pageBuilder } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: contentReview.id\n }\n };\n }\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: null\n }\n };\n }\n });\n });\n\n pageBuilder.onPageBeforeDelete.subscribe(async ({ page }) => {\n const contentReviewId = page.settings?.apw?.contentReviewId;\n if (!contentReviewId) {\n return;\n }\n\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (contentReview) {\n throw new Error(\n `Cannot delete the page because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n page\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAQO,MAAMA,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAEnCC,GAAG,CAACE,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF,MAAM;MAAEG;IAAQ,CAAC,GAAGH,aAAa;IAEjC,IAAIG,OAAO,CAACC,IAAI,KAAKC,sBAAe,CAACC,IAAI,EAAE;MACvC;IACJ;IACA,MAAM,IAAAC,yBAAkB,EAAC;MACrBC,OAAO,EAAET,WAAW,CAACS,OAAO;MAC5BC,UAAU,EAAEV,WAAW,CAACU,UAAU;MAClCC,YAAY,EAAEP,OAAO,CAACQ,EAAE;MACxBC,cAAc,EAAEC,QAAQ,IAAI;QACxB,mEACOA,QAAQ;UACXf,GAAG,8DACKe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC;YACtBgB,eAAe,EAAEd,aAAa,CAACW;UAAE;QACpC;MAET;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFb,GAAG,CAACE,aAAa,CAACe,0BAA0B,CAACb,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF,MAAM;MAAEG;IAAQ,CAAC,GAAGH,aAAa;IAEjC,IAAIG,OAAO,CAACC,IAAI,KAAKC,sBAAe,CAACC,IAAI,EAAE;MACvC;IACJ;IACA,MAAM,IAAAC,yBAAkB,EAAC;MACrBC,OAAO,EAAET,WAAW,CAACS,OAAO;MAC5BC,UAAU,EAAEV,WAAW,CAACU,UAAU;MAClCC,YAAY,EAAEP,OAAO,CAACQ,EAAE;MACxBC,cAAc,EAAEC,QAAQ,IAAI;QACxB,mEACOA,QAAQ;UACXf,GAAG,8DACKe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC;YACtBgB,eAAe,EAAE;UAAI;QACxB;MAET;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFf,WAAW,CAACiB,kBAAkB,CAACd,SAAS,CAAC,OAAO;IAAEe;EAAK,CAAC,KAAK;IAAA;IACzD,MAAMH,eAAe,qBAAGG,IAAI,CAACJ,QAAQ,yEAAb,eAAef,GAAG,uDAAlB,mBAAoBgB,eAAe;IAC3D,IAAI,CAACA,eAAe,EAAE;MAClB;IACJ;IAEA,IAAId,aAAa;IACjB,IAAI;MACAA,aAAa,GAAG,MAAMF,GAAG,CAACE,aAAa,CAACkB,GAAG,CAACJ,eAAe,CAAC;IAChE,CAAC,CAAC,OAAOK,EAAE,EAAE;MACT;AACZ;AACA;AACA;MACY,IAAIA,EAAE,CAACC,IAAI,KAAK,WAAW,EAAE;QACzB,MAAMD,EAAE;MACZ;IACJ;IAEA,IAAInB,aAAa,EAAE;MACf,MAAM,IAAIqB,cAAK,CACV,kGAAiG,EAClG,4BAA4B,EAC5B;QACIP,eAAe;QACfG;MACJ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|