@webiny/api-apw 5.39.0-beta.0 → 5.39.0-beta.2
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 +1 -5
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.js +1 -5
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.js +1 -5
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.js +1 -5
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.js +3 -4
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createContentReviewMethods.js +37 -28
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/index.js +3 -4
- package/crud/index.js.map +1 -1
- package/crud/utils.js +4 -5
- package/crud/utils.js.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +27 -27
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +2 -4
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +6 -5
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +1 -2
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +6 -9
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/triggerContentReview.js +2 -3
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +10 -10
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +1 -1
- package/plugins/cms/utils.js +5 -6
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +13 -11
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +38 -34
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +20 -12
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +12 -11
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.d.ts +2 -0
- package/plugins/graphql/utils.js +12 -0
- package/plugins/graphql/utils.js.map +1 -0
- package/plugins/graphql/workflow.gql.js +12 -11
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +3 -3
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/listContentReviews.js +1 -1
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +5 -5
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +19 -14
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +2 -4
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +13 -11
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +8 -5
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.d.ts +2 -2
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +1 -1
- package/plugins/utils.js +3 -2
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +39 -22
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +2 -3
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +3 -4
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +3 -6
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +1 -6
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js +9 -8
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +14 -13
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +2 -3
- package/scheduler/handlers/utils.js +3 -6
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/types.d.ts +8 -5
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +15 -11
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +12 -10
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +1 -1
- package/storageOperations/contentReviewStorageOperations.js +15 -11
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +1 -7
- package/storageOperations/index.js +8 -15
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -2
- package/storageOperations/models/changeRequest.model.js +4 -6
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -2
- package/storageOperations/models/comment.model.js +4 -6
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -2
- package/storageOperations/models/contentReview.model.js +9 -9
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +3 -23
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -2
- package/storageOperations/models/reviewer.model.js +5 -7
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +1 -2
- package/storageOperations/models/workflow.model.js +12 -12
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +1 -1
- package/storageOperations/reviewerStorageOperations.js +15 -11
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +20 -14
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +15 -14
- package/types.js.map +1 -1
- package/utils/fieldResolver.js +4 -6
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +3 -0
- package/utils/pickEntryFieldValues.js +31 -0
- package/utils/pickEntryFieldValues.js.map +1 -0
- package/utils/resolve.d.ts +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +0 -8
- package/storageOperations/models/contentModelPluginFactory.js +0 -22
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_plugins","require","_handlerGraphql","_resolve","_interopRequireDefault","workflowSchema","GraphQLSchemaPlugin","typeDefs","resolvers","ApwWorkflowStep","reviewers","parent","map","id","ApwQuery","getWorkflow","_","args","context","resolve","apw","workflow","get","listWorkflows","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createWorkflow","create","data","updateWorkflow","update","deleteWorkflow","delete","_default","exports","default"],"sources":["workflow.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewer, ListWorkflowsParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n
|
1
|
+
{"version":3,"names":["_plugins","require","_handlerGraphql","_resolve","_interopRequireDefault","_utils","workflowSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwWorkflowStep","reviewers","parent","map","id","ApwQuery","getWorkflow","_","args","context","resolve","apw","workflow","get","listWorkflows","entries","meta","list","ListResponse","e","ErrorResponse","ApwMutation","createWorkflow","create","data","updateWorkflow","update","deleteWorkflow","delete","_default","exports","default"],"sources":["workflow.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewer, ListWorkflowsParams } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\nimport { onByFields, dateTimeFieldsSorters } from \"./utils\";\n\nconst workflowSchema = new GraphQLSchemaPlugin<ApwContext>({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type ApwWorkflowListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Workflow specific fields\n app: ApwWorkflowApplication\n title: String\n steps: [ApwWorkflowStep]\n scope: ApwWorkflowScope\n }\n\n type ApwListWorkflowsResponse {\n data: [ApwWorkflowListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwWorkflowStep {\n title: String!\n id: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]\n }\n\n type ApwWorkflowScope {\n type: String\n data: JSON\n }\n\n type ApwWorkflow {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Workflow specific fields\n app: ApwWorkflowApplication\n title: String\n steps: [ApwWorkflowStep]\n scope: ApwWorkflowScope\n }\n\n type ApwWorkflowResponse {\n data: ApwWorkflow\n error: ApwError\n }\n\n type ApwDeleteWorkflowResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwWorkflowApplication {\n pageBuilder\n cms\n formBuilder\n }\n\n enum ApwWorkflowStepTypes {\n mandatoryBlocking\n mandatoryNonBlocking\n notMandatory\n }\n\n enum ApwListWorkflowsSort {\n id_ASC\n id_DESC\n \n ${dateTimeFieldsSorters}\n publishedOn_ASC\n publishedOn_DESC\n \n title_ASC\n title_DESC\n }\n\n input ApwWorkflowReviewerInput {\n id: ID\n }\n\n input ApwCreateWorkflowStepInput {\n id: String!\n title: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]!\n }\n\n input ApwUpdateWorkflowStepInput {\n id: String!\n title: String!\n type: ApwWorkflowStepTypes!\n reviewers: [ID!]\n }\n\n input ApwWorkflowScopeInput {\n type: String!\n data: JSON\n }\n\n input ApwCreateWorkflowInput {\n title: String!\n steps: [ApwCreateWorkflowStepInput!]!\n scope: ApwWorkflowScopeInput!\n app: ApwWorkflowApplication!\n }\n\n input ApwUpdateWorkflowInput {\n title: String\n steps: [ApwUpdateWorkflowStepInput!]\n scope: ApwWorkflowScopeInput\n }\n\n input ApwListWorkflowsWhereInput {\n app: ApwWorkflowApplication\n }\n\n input ApwListWorkflowsSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n type ApwQuery {\n getWorkflow(id: ID!): ApwWorkflowResponse\n\n listWorkflows(\n where: ApwListWorkflowsWhereInput\n limit: Int\n after: String\n sort: [ApwListWorkflowsSort!]\n search: ApwListWorkflowsSearchInput\n ): ApwListWorkflowsResponse\n }\n\n type ApwMutation {\n createWorkflow(data: ApwCreateWorkflowInput!): ApwWorkflowResponse\n\n # Update workflow by given ID.\n updateWorkflow(id: ID!, data: ApwUpdateWorkflowInput!): ApwWorkflowResponse\n\n # Delete workflow\n deleteWorkflow(id: ID!): ApwDeleteWorkflowResponse\n }\n `,\n resolvers: {\n ApwWorkflowStep: {\n reviewers: parent => {\n const reviewers: ApwReviewer[] = parent.reviewers;\n return reviewers.map(({ id }) => id);\n }\n },\n ApwQuery: {\n getWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.get(args.id));\n },\n listWorkflows: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ListWorkflowsParams.\n */\n const [entries, meta] = await context.apw.workflow.list(\n args as unknown as ListWorkflowsParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n ApwMutation: {\n createWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.create(args.data));\n },\n updateWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.update(args.id, args.data));\n },\n deleteWorkflow: async (_, args: any, context) => {\n return resolve(() => context.apw.workflow.delete(args.id));\n }\n }\n }\n});\n\nexport default workflowSchema;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,MAAMK,cAAc,GAAG,IAAIC,4BAAmB,CAAa;EACvD;EACAC,QAAQ,EAAG;AACf;AACA;AACA;AACA;AACA,cAAcC,iBAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcA,iBAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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C7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACc,MAAM,CAAClB,IAAI,CAACJ,EAAE,EAAEI,IAAI,CAACgB,IAAI,CAAC,CAAC;MACzE,CAAC;MACDG,cAAc,EAAE,MAAAA,CAAOpB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACgB,MAAM,CAACpB,IAAI,CAACJ,EAAE,CAAC,CAAC;MAC9D;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAyB,QAAA,GAEYnC,cAAc;AAAAoC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createReviewerFromIdentity","security","apw","onAfterLogin","subscribe","identity","reviewer","list","where","identityId","id","limit","e","message","email","create","displayName","type","ex","console","log","JSON","stringify","update","exports"],"sources":["createReviewerFromIdentity.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const createReviewerFromIdentity = ({ security, apw }: LifeCycleHookCallbackParams) => {\n /**\n * Replicate identity in \"AdvancedPublishingWorkflow\" system after login.\n */\n security.onAfterLogin.subscribe(async ({ identity }) => {\n let reviewer;\n try {\n [[reviewer]] = await apw.reviewer.list({\n where: { identityId: identity.id },\n limit: 1\n });\n } catch (e) {\n if (e.message === \"index_not_found_exception\") {\n // Do nothing\n } else {\n throw e;\n }\n }\n const email =
|
1
|
+
{"version":3,"names":["createReviewerFromIdentity","security","apw","onAfterLogin","subscribe","identity","reviewer","list","where","identityId","id","limit","e","message","email","create","displayName","type","ex","console","log","JSON","stringify","update","exports"],"sources":["createReviewerFromIdentity.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const createReviewerFromIdentity = ({ security, apw }: LifeCycleHookCallbackParams) => {\n /**\n * Replicate identity in \"AdvancedPublishingWorkflow\" system after login.\n */\n security.onAfterLogin.subscribe(async ({ identity }) => {\n let reviewer;\n try {\n [[reviewer]] = await apw.reviewer.list({\n where: { identityId: identity.id },\n limit: 1\n });\n } catch (e) {\n if (e.message === \"index_not_found_exception\") {\n // Do nothing\n } else {\n throw e;\n }\n }\n const email = identity?.email || null;\n /**\n * Create a reviewer if it doesn't exist already.\n */\n if (!reviewer) {\n try {\n await apw.reviewer.create({\n identityId: identity.id,\n displayName: identity.displayName,\n type: identity.type,\n email\n });\n } catch (ex) {\n console.log(\n `There was an error while creating reviewer with identity: ${identity.id}`\n );\n console.log(JSON.stringify(ex));\n throw ex;\n }\n return;\n }\n /**\n * If \"displayName\" doesn't match it means it has been updated in the identity,\n * therefore, we need to update it on reviewer as well keep them in sync.\n */\n const update = reviewer.displayName !== identity.displayName || reviewer.email !== email;\n if (!update) {\n return;\n }\n try {\n await apw.reviewer.update(reviewer.id, {\n identityId: reviewer.identityId,\n type: reviewer.type,\n displayName: identity.displayName,\n email\n });\n } catch (ex) {\n console.log(`There was an error while updating reviewer: ${reviewer.id}`);\n console.log(JSON.stringify(ex));\n throw ex;\n }\n });\n};\n"],"mappings":";;;;;;AAEO,MAAMA,0BAA0B,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAiC,CAAC,KAAK;EAC1F;AACJ;AACA;EACID,QAAQ,CAACE,YAAY,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAS,CAAC,KAAK;IACpD,IAAIC,QAAQ;IACZ,IAAI;MACA,CAAC,CAACA,QAAQ,CAAC,CAAC,GAAG,MAAMJ,GAAG,CAACI,QAAQ,CAACC,IAAI,CAAC;QACnCC,KAAK,EAAE;UAAEC,UAAU,EAAEJ,QAAQ,CAACK;QAAG,CAAC;QAClCC,KAAK,EAAE;MACX,CAAC,CAAC;IACN,CAAC,CAAC,OAAOC,CAAC,EAAE;MACR,IAAIA,CAAC,CAACC,OAAO,KAAK,2BAA2B,EAAE;QAC3C;MAAA,CACH,MAAM;Q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AAAA,0BAAA"}
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.initializeContentReviewSteps = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
8
|
var _set = _interopRequireDefault(require("lodash/set"));
|
10
9
|
var _types = require("../../types");
|
11
10
|
var _utils = require("../utils");
|
@@ -58,11 +57,12 @@ const initializeContentReviewSteps = ({
|
|
58
57
|
const updatedSteps = workflow.steps.map((step, index) => {
|
59
58
|
const status = (0, _utils.getContentReviewStepInitialStatus)(workflowSteps, index, previousStepStatus);
|
60
59
|
previousStepStatus = status;
|
61
|
-
return
|
60
|
+
return {
|
61
|
+
...step,
|
62
62
|
status,
|
63
63
|
pendingChangeRequests: 0,
|
64
64
|
totalComments: 0
|
65
|
-
}
|
65
|
+
};
|
66
66
|
});
|
67
67
|
/**
|
68
68
|
* If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_set","_interopRequireDefault","require","_types","_utils","_handlerGraphql","_contentApwSettingsPlugin","initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","
|
1
|
+
{"version":3,"names":["_set","_interopRequireDefault","require","_types","_utils","_handlerGraphql","_contentApwSettingsPlugin","initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments","isNonMandatory","every","ApwWorkflowStepTypes","NON_MANDATORY","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED","exports"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport {\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwContext,\n ApwWorkflowStepTypes\n} from \"~/types\";\nimport { getContentReviewStepInitialStatus } from \"~/plugins/utils\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\n\nexport const initializeContentReviewSteps = ({ apw, plugins }: ApwContext) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { type, id, settings } = input.content;\n /*\n * Let's set \"title\" field value.\n */\n const getContent = apw.getContentGetter(type);\n const content = await getContent(id, settings);\n if (!content) {\n throw new NotFoundError(`Content \"${type}\" with id ${id} not found.`);\n }\n\n const { title } = content;\n input = lodashSet(input, \"title\", title);\n\n /**\n * We need to find a plugin which can get a workflow ID for the given type of content.\n */\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type\n });\n\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n\n /**\n * Let's initialize the \"ContentReview\" steps.\n */\n if (!workflowId) {\n throw new NotFoundError(`Unable to initiate a \"Content review\". No workflow found!`);\n }\n\n input.workflowId = workflowId;\n\n const workflow = await apw.workflow.get(workflowId);\n const workflowSteps = workflow.steps;\n\n let previousStepStatus: ApwContentReviewStepStatus | undefined = undefined;\n const updatedSteps = workflow.steps.map((step, index) => {\n const status = getContentReviewStepInitialStatus(\n workflowSteps,\n index,\n previousStepStatus\n );\n previousStepStatus = status;\n return {\n ...step,\n status,\n pendingChangeRequests: 0,\n totalComments: 0\n };\n });\n /**\n * If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.\n */\n const isNonMandatory = updatedSteps.every(step => {\n return step.type === ApwWorkflowStepTypes.NON_MANDATORY;\n });\n if (isNonMandatory) {\n input.reviewStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n input = lodashSet(input, \"steps\", updatedSteps);\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AAEO,MAAMK,4BAA4B,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAAoB,CAAC,KAAK;EAC1ED,GAAG,CAACE,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC,IAAI;MAAEC,EAAE;MAAEC;IAAS,CAAC,GAAGH,KAAK,CAACI,OAAO;IAC5C;AACR;AACA;IACQ,MAAMC,UAAU,GAAGV,GAAG,CAACW,gBAAgB,CAACL,IAAI,CAAC;IAC7C,MAAMG,OAAO,GAAG,MAAMC,UAAU,CAACH,EAAE,EAAEC,QAAQ,CAAC;IAC9C,IAAI,CAACC,OAAO,EAAE;MACV,MAAM,IAAIG,6BAAa,CAAE,YAAWN,IAAK,aAAYC,EAAG,aAAY,CAAC;IACzE;IAEA,MAAM;MAAEM;IAAM,CAAC,GAAGJ,OAAO;IACzBJ,KAAK,GAAG,IAAAS,YAAS,EAACT,KAAK,EAAE,OAAO,EAAEQ,KAAK,CAAC;;IAExC;AACR;AACA;IACQ,MAAME,wBAAwB,GAAG,IAAAC,qDAA2B,EAAC;MACzDf,OAAO;MACPK;IACJ,CAAC,CAAC;IAEF,MAAMW,UAAU,GAAGF,wBAAwB,CAACG,aAAa,CAACT,OAAO,CAAC;;IAElE;AACR;AACA;IACQ,IAAI,CAACQ,UAAU,EAAE;MACb,MAAM,IAAIL,6BAAa,CAAE,2DAA0D,CAAC;IACxF;IAEAP,KAAK,CAACY,UAAU,GAAGA,UAAU;IAE7B,MAAME,QAAQ,GAAG,MAAMnB,GAAG,CAACmB,QAAQ,CAACC,GAAG,CAACH,UAAU,CAAC;IACnD,MAAMI,aAAa,GAAGF,QAAQ,CAACG,KAAK;IAEpC,IAAIC,kBAA0D,GAAGC,SAAS;IAC1E,MAAMC,YAAY,GAAGN,QAAQ,CAACG,KAAK,CAACI,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MACrD,MAAMC,MAAM,GAAG,IAAAC,wCAAiC,EAC5CT,aAAa,EACbO,KAAK,EACLL,kBACJ,CAAC;MACDA,kBAAkB,GAAGM,MAAM;MAC3B,OAAO;QACH,GAAGF,IAAI;QACPE,MAAM;QACNE,qBAAqB,EAAE,CAAC;QACxBC,aAAa,EAAE;MACnB,CAAC;IACL,CAAC,CAAC;IACF;AACR;AACA;IACQ,MAAMC,cAAc,GAAGR,YAAY,CAACS,KAAK,CAACP,IAAI,IAAI;MAC9C,OAAOA,IAAI,CAACrB,IAAI,KAAK6B,2BAAoB,CAACC,aAAa;IAC3D,CAAC,CAAC;IACF,IAAIH,cAAc,EAAE;MAChB5B,KAAK,CAACgC,YAAY,GAAGC,6BAAsB,CAACC,qBAAqB;IACrE;IAEAlC,KAAK,GAAG,IAAAS,YAAS,EAACT,KAAK,EAAE,OAAO,EAAEoB,YAAY,CAAC;EACnD,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAzC,4BAAA,GAAAA,4BAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["listContentReviews","apw","security","contentReview","onContentReviewBeforeList","subscribe","where","workflowId_in","identity","getIdentity","id","workflows","workflow","list","length","userWorkflows","filter","steps","some","step","reviewers","reviewer","identityId","map","exports"],"sources":["listContentReviews.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\ninterface ListWorkflowsParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\nexport const listContentReviews = ({ apw, security }: ListWorkflowsParams) => {\n /**\n * We need to hook into listing the content review entries.\n * When listing content review entries, we need to check which ones current user can actually see.\n */\n apw.contentReview.onContentReviewBeforeList.subscribe(async ({ where }) => {\n /**\n * If there is workflowId_in attached on where, we will not change it.\n */\n if (where.workflowId_in) {\n return;\n }\n const identity = security.getIdentity();\n if (!identity?.id) {\n return;\n }\n /**\n * Find all available workflows.\n */\n const [workflows] = await apw.workflow.list();\n if (workflows.length === 0) {\n return;\n }\n /**\n * Find all workflows which user has access to.\n * User access is buried quite deep in the workflow data, so we need to do some traversing.\n */\n const userWorkflows = workflows.filter(workflow => {\n return workflow.steps.some(step => {\n return step.reviewers.some(reviewer => {\n return identity.id === reviewer.identityId;\n });\n });\n });\n if (userWorkflows.length === 0) {\n return;\n }\n /**\n * In the end, we need to attach the workflow filter by the entryId.\n * Just in case we add versioning at some point...\n */\n where.workflowId_in = userWorkflows.map(workflow => workflow.id);\n });\n};\n"],"mappings":";;;;;;AASO,MAAMA,kBAAkB,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAA8B,CAAC,KAAK;EAC1E;AACJ;AACA;AACA;EACID,GAAG,CAACE,aAAa,CAACC,yBAAyB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACvE;AACR;AACA;IACQ,IAAIA,KAAK,CAACC,aAAa,EAAE;MACrB;IACJ;IACA,MAAMC,QAAQ,GAAGN,QAAQ,CAACO,WAAW,CAAC,CAAC;IACvC,IAAI,
|
1
|
+
{"version":3,"names":["listContentReviews","apw","security","contentReview","onContentReviewBeforeList","subscribe","where","workflowId_in","identity","getIdentity","id","workflows","workflow","list","length","userWorkflows","filter","steps","some","step","reviewers","reviewer","identityId","map","exports"],"sources":["listContentReviews.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\ninterface ListWorkflowsParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\nexport const listContentReviews = ({ apw, security }: ListWorkflowsParams) => {\n /**\n * We need to hook into listing the content review entries.\n * When listing content review entries, we need to check which ones current user can actually see.\n */\n apw.contentReview.onContentReviewBeforeList.subscribe(async ({ where }) => {\n /**\n * If there is workflowId_in attached on where, we will not change it.\n */\n if (where.workflowId_in) {\n return;\n }\n const identity = security.getIdentity();\n if (!identity?.id) {\n return;\n }\n /**\n * Find all available workflows.\n */\n const [workflows] = await apw.workflow.list();\n if (workflows.length === 0) {\n return;\n }\n /**\n * Find all workflows which user has access to.\n * User access is buried quite deep in the workflow data, so we need to do some traversing.\n */\n const userWorkflows = workflows.filter(workflow => {\n return workflow.steps.some(step => {\n return step.reviewers.some(reviewer => {\n return identity.id === reviewer.identityId;\n });\n });\n });\n if (userWorkflows.length === 0) {\n return;\n }\n /**\n * In the end, we need to attach the workflow filter by the entryId.\n * Just in case we add versioning at some point...\n */\n where.workflowId_in = userWorkflows.map(workflow => workflow.id);\n });\n};\n"],"mappings":";;;;;;AASO,MAAMA,kBAAkB,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAA8B,CAAC,KAAK;EAC1E;AACJ;AACA;AACA;EACID,GAAG,CAACE,aAAa,CAACC,yBAAyB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACvE;AACR;AACA;IACQ,IAAIA,KAAK,CAACC,aAAa,EAAE;MACrB;IACJ;IACA,MAAMC,QAAQ,GAAGN,QAAQ,CAACO,WAAW,CAAC,CAAC;IACvC,IAAI,CAACD,QAAQ,EAAEE,EAAE,EAAE;MACf;IACJ;IACA;AACR;AACA;IACQ,MAAM,CAACC,SAAS,CAAC,GAAG,MAAMV,GAAG,CAACW,QAAQ,CAACC,IAAI,CAAC,CAAC;IAC7C,IAAIF,SAAS,CAACG,MAAM,KAAK,CAAC,EAAE;MACxB;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMC,aAAa,GAAGJ,SAAS,CAACK,MAAM,CAACJ,QAAQ,IAAI;MAC/C,OAAOA,QAAQ,CAACK,KAAK,CAACC,IAAI,CAACC,IAAI,IAAI;QAC/B,OAAOA,IAAI,CAACC,SAAS,CAACF,IAAI,CAACG,QAAQ,IAAI;UACnC,OAAOb,QAAQ,CAACE,EAAE,KAAKW,QAAQ,CAACC,UAAU;QAC9C,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC,CAAC;IACF,IAAIP,aAAa,CAACD,MAAM,KAAK,CAAC,EAAE;MAC5B;IACJ;IACA;AACR;AACA;AACA;IACQR,KAAK,CAACC,aAAa,GAAGQ,aAAa,CAACQ,GAAG,CAACX,QAAQ,IAAIA,QAAQ,CAACF,EAAE,CAAC;EACpE,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAxB,kBAAA,GAAAA,kBAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_appUrl","_contentReviewUrl","_contentUrl","_reviewers","_sendContentReviewNotification","attachContentReviewAfterCreate","context","apw","contentReview","onContentReviewAfterCreate","subscribe","execute","steps","length","step","id","settings","getAppUrl","contentReviewUrl","createContentReviewUrl","baseUrl","appUrl","contentReviewId","stepId","workflow","get","workflowId","WebinyError","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","sendContentReviewNotification","ex","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["contentReviewAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { getAppUrl } from \"./appUrl\";\nimport { createContentReviewUrl } from \"./contentReviewUrl\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendContentReviewNotification } from \"./sendContentReviewNotification\";\n\nexport const attachContentReviewAfterCreate = (context: ApwContext): void => {\n context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const execute = async () => {\n if (contentReview.steps.length === 0) {\n return;\n }\n const [step] = contentReview.steps;\n if (!step?.id) {\n return;\n }\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n\n const contentReviewUrl = createContentReviewUrl({\n baseUrl: settings.appUrl,\n contentReviewId: contentReview.id,\n stepId: step.id\n });\n if (!contentReviewUrl) {\n return;\n }\n\n /**\n * We go and check the workflow.\n */\n const workflow = await context.apw.workflow.get(contentReview.workflowId);\n if (!workflow) {\n throw new WebinyError(\n `There is no workflow with Id \"${contentReview.workflowId}\".`,\n \"WORKFLOW_NOT_FOUND\",\n {\n workflowId: contentReview.workflowId\n }\n );\n }\n\n const contentUrl = createContentUrl({\n plugins: context.plugins,\n baseUrl: settings.appUrl,\n contentReview,\n workflow\n });\n if (!contentUrl) {\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [contentReview.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendContentReviewNotification({\n context,\n reviewers,\n contentReview,\n workflow,\n contentReviewUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send content review notifications.`,\n \"CONTENT_REVIEW_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n contentReviewId: contentReview.id,\n contentReviewUrl,\n contentUrl,\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data,\n stack: ex.stack\n }\n }\n );\n }\n };\n\n await context.security.withoutAuthorization(async () => {\n return execute();\n });\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,8BAAA,GAAAL,OAAA;AAEO,MAAMM,8BAA8B,GAAIC,OAAmB,IAAW;EACzEA,OAAO,CAACC,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IACxF,MAAMG,OAAO,GAAG,MAAAA,CAAA,KAAY;MACxB,IAAIH,aAAa,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;QAClC;MACJ;MACA,MAAM,CAACC,IAAI,CAAC,GAAGN,aAAa,CAACI,KAAK;MAClC,IAAI,
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_appUrl","_contentReviewUrl","_contentUrl","_reviewers","_sendContentReviewNotification","attachContentReviewAfterCreate","context","apw","contentReview","onContentReviewAfterCreate","subscribe","execute","steps","length","step","id","settings","getAppUrl","contentReviewUrl","createContentReviewUrl","baseUrl","appUrl","contentReviewId","stepId","workflow","get","workflowId","WebinyError","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","sendContentReviewNotification","ex","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["contentReviewAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { getAppUrl } from \"./appUrl\";\nimport { createContentReviewUrl } from \"./contentReviewUrl\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendContentReviewNotification } from \"./sendContentReviewNotification\";\n\nexport const attachContentReviewAfterCreate = (context: ApwContext): void => {\n context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const execute = async () => {\n if (contentReview.steps.length === 0) {\n return;\n }\n const [step] = contentReview.steps;\n if (!step?.id) {\n return;\n }\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n\n const contentReviewUrl = createContentReviewUrl({\n baseUrl: settings.appUrl,\n contentReviewId: contentReview.id,\n stepId: step.id\n });\n if (!contentReviewUrl) {\n return;\n }\n\n /**\n * We go and check the workflow.\n */\n const workflow = await context.apw.workflow.get(contentReview.workflowId);\n if (!workflow) {\n throw new WebinyError(\n `There is no workflow with Id \"${contentReview.workflowId}\".`,\n \"WORKFLOW_NOT_FOUND\",\n {\n workflowId: contentReview.workflowId\n }\n );\n }\n\n const contentUrl = createContentUrl({\n plugins: context.plugins,\n baseUrl: settings.appUrl,\n contentReview,\n workflow\n });\n if (!contentUrl) {\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [contentReview.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendContentReviewNotification({\n context,\n reviewers,\n contentReview,\n workflow,\n contentReviewUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send content review notifications.`,\n \"CONTENT_REVIEW_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n contentReviewId: contentReview.id,\n contentReviewUrl,\n contentUrl,\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data,\n stack: ex.stack\n }\n }\n );\n }\n };\n\n await context.security.withoutAuthorization(async () => {\n return execute();\n });\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,8BAAA,GAAAL,OAAA;AAEO,MAAMM,8BAA8B,GAAIC,OAAmB,IAAW;EACzEA,OAAO,CAACC,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IACxF,MAAMG,OAAO,GAAG,MAAAA,CAAA,KAAY;MACxB,IAAIH,aAAa,CAACI,KAAK,CAACC,MAAM,KAAK,CAAC,EAAE;QAClC;MACJ;MACA,MAAM,CAACC,IAAI,CAAC,GAAGN,aAAa,CAACI,KAA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ChBU;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOQ,EAAE,EAAE;QACT,MAAM,IAAIT,cAAW,CAChB,8CAA6C,EAC9C,uCAAuC,EACvC;UACID,UAAU,EAAEF,QAAQ,CAACT,EAAE;UACvBO,eAAe,EAAEd,aAAa,CAACO,EAAE;UACjCG,gBAAgB;UAChBU,UAAU;UACVS,KAAK,EAAE;YACHC,OAAO,EAAEF,EAAE,CAACE,OAAO;YACnBC,IAAI,EAAEH,EAAE,CAACG,IAAI;YACbC,IAAI,EAAEJ,EAAE,CAACI,IAAI;YACbC,KAAK,EAAEL,EAAE,CAACK;UACd;QACJ,CACJ,CAAC;MACL;IACJ,CAAC;IAED,MAAMnC,OAAO,CAACoC,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,OAAOhC,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACiC,OAAA,CAAAvC,8BAAA,GAAAA,8BAAA"}
|
@@ -1,11 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
5
4
|
value: true
|
6
5
|
});
|
7
6
|
exports.updatePendingChangeRequestsCount = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
7
|
var _utils = require("../utils");
|
10
8
|
const updatePendingChangeRequests = async ({
|
11
9
|
contentReviewMethods,
|
@@ -20,11 +18,13 @@ const updatePendingChangeRequests = async ({
|
|
20
18
|
contentReviewMethods,
|
21
19
|
id,
|
22
20
|
getNewContentReviewData: data => {
|
23
|
-
return
|
24
|
-
|
21
|
+
return {
|
22
|
+
...data,
|
23
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => ({
|
24
|
+
...step,
|
25
25
|
pendingChangeRequests: step.pendingChangeRequests + delta
|
26
26
|
}))
|
27
|
-
}
|
27
|
+
};
|
28
28
|
}
|
29
29
|
});
|
30
30
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","
|
1
|
+
{"version":3,"names":["_utils","require","updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","onChangeRequestAfterDelete","subscribe","resolved","contentReview","onChangeRequestAfterCreate","onChangeRequestAfterUpdate","original","exports"],"sources":["updatePendingChangeRequests.ts"],"sourcesContent":["import { ApwChangeRequest, ApwContentReviewCrud, LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\ninterface UpdatePendingChangeRequestsParams {\n contentReviewMethods: ApwContentReviewCrud;\n delta: number;\n step: ApwChangeRequest[\"step\"];\n}\n\nconst updatePendingChangeRequests = async ({\n contentReviewMethods,\n step,\n delta\n}: UpdatePendingChangeRequestsParams): Promise<void> => {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n pendingChangeRequests: step.pendingChangeRequests + delta\n }))\n };\n }\n });\n};\n\nexport const updatePendingChangeRequestsCount = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({ changeRequest }) => {\n /**\n * If the deleted changeRequest was marked as resolved. We don't need to do anything here,\n * because \"pendingChangeRequests has been already updated in \"onAfterChangeRequestUpdate\" hook.\n */\n if (changeRequest.resolved === true) {\n return;\n }\n /**\n * After a \"changeRequest\" is deleted, decrement the \"pendingChangeRequests\" count\n * in the corresponding step of the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: -1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n /**\n * After a \"changeRequest\" is created, increment the \"pendingChangeRequests\" count\n * of the corresponding step in the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: 1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterUpdate.subscribe(async ({ changeRequest, original }) => {\n /**\n * After a \"changeRequest\" is created, and the value of \"resolved\" field has changed;\n * then we also need to update the \"pendingChangeRequests\" count of the corresponding step in the content review entry.\n */\n if (original.resolved !== changeRequest.resolved) {\n const resolved = changeRequest.resolved;\n const delta = resolved === true ? -1 : 1;\n\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta\n });\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAYA,MAAMC,2BAA2B,GAAG,MAAAA,CAAO;EACvCC,oBAAoB;EACpBC,IAAI;EACJC;AAC+B,CAAC,KAAoB;EACpD,MAAM;IAAEC,EAAE;IAAEC;EAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;EAE1D,MAAM,IAAAK,0BAAmB,EAAC;IACtBN,oBAAoB;IACpBG,EAAE;IACFI,uBAAuB,EAAEC,IAAI,IAAI;MAC7B,OAAO;QACH,GAAGA,IAAI;QACPC,KAAK,EAAE,IAAAC,8BAAuB,EAACF,IAAI,CAACC,KAAK,EAAEL,MAAM,EAAEH,IAAI,KAAK;UACxD,GAAGA,IAAI;UACPU,qBAAqB,EAAEV,IAAI,CAACU,qBAAqB,GAAGT;QACxD,CAAC,CAAC;MACN,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAEM,MAAMU,gCAAgC,GAAGA,CAAC;EAC7CC;AACsC,CAAC,K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_interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
5
4
|
value: true
|
6
5
|
});
|
7
6
|
exports.updateTotalCommentsCount = exports.updateLatestCommentId = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
7
|
var _utils = require("../utils");
|
10
8
|
const updateTotalCommentsCount = ({
|
11
9
|
apw
|
@@ -29,11 +27,13 @@ const updateTotalCommentsCount = ({
|
|
29
27
|
contentReviewMethods: apw.contentReview,
|
30
28
|
id,
|
31
29
|
getNewContentReviewData: data => {
|
32
|
-
return
|
33
|
-
|
30
|
+
return {
|
31
|
+
...data,
|
32
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => ({
|
33
|
+
...step,
|
34
34
|
totalComments: step.totalComments - 1
|
35
35
|
}))
|
36
|
-
}
|
36
|
+
};
|
37
37
|
}
|
38
38
|
});
|
39
39
|
}
|
@@ -53,11 +53,13 @@ const updateTotalCommentsCount = ({
|
|
53
53
|
contentReviewMethods: apw.contentReview,
|
54
54
|
id,
|
55
55
|
getNewContentReviewData: data => {
|
56
|
-
return
|
57
|
-
|
56
|
+
return {
|
57
|
+
...data,
|
58
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => ({
|
59
|
+
...step,
|
58
60
|
totalComments: step.totalComments + 1
|
59
61
|
}))
|
60
|
-
}
|
62
|
+
};
|
61
63
|
}
|
62
64
|
});
|
63
65
|
});
|
@@ -80,9 +82,10 @@ const updateLatestCommentId = ({
|
|
80
82
|
contentReviewMethods: apw.contentReview,
|
81
83
|
id,
|
82
84
|
getNewContentReviewData: contentReview => {
|
83
|
-
return
|
85
|
+
return {
|
86
|
+
...contentReview,
|
84
87
|
latestCommentId: comment.id
|
85
|
-
}
|
88
|
+
};
|
86
89
|
}
|
87
90
|
});
|
88
91
|
});
|
@@ -100,9 +103,10 @@ const updateLatestCommentId = ({
|
|
100
103
|
contentReviewMethods: apw.contentReview,
|
101
104
|
id,
|
102
105
|
getNewContentReviewData: contentReview => {
|
103
|
-
return
|
106
|
+
return {
|
107
|
+
...contentReview,
|
104
108
|
latestCommentId: comment.id
|
105
|
-
}
|
109
|
+
};
|
106
110
|
}
|
107
111
|
});
|
108
112
|
});
|
@@ -133,9 +137,10 @@ const updateLatestCommentId = ({
|
|
133
137
|
contentReviewMethods: apw.contentReview,
|
134
138
|
id,
|
135
139
|
getNewContentReviewData: contentReview => {
|
136
|
-
return
|
140
|
+
return {
|
141
|
+
...contentReview,
|
137
142
|
latestCommentId: latestComment ? latestComment.id : null
|
138
|
-
}
|
143
|
+
};
|
139
144
|
}
|
140
145
|
});
|
141
146
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","updateTotalCommentsCount","apw","comment","onCommentAfterDelete","subscribe","step","id","stepId","extractContentReviewIdAndStep","updateContentReview","contentReviewMethods","contentReview","getNewContentReviewData","data","
|
1
|
+
{"version":3,"names":["_utils","require","updateTotalCommentsCount","apw","comment","onCommentAfterDelete","subscribe","step","id","stepId","extractContentReviewIdAndStep","updateContentReview","contentReviewMethods","contentReview","getNewContentReviewData","data","steps","updateContentReviewStep","totalComments","onCommentAfterCreate","exports","updateLatestCommentId","latestCommentId","onCommentAfterUpdate","safelyGetContentReview","latestComment","list","where","changeRequest","sort"],"sources":["updateTotalComments.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n safelyGetContentReview,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\nexport const updateTotalCommentsCount = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n const { step } = comment;\n /**\n * After a \"comment\" is deleted, decrement the \"totalComments\" count\n * in the corresponding step of the content review entry.\n */\n if (step) {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments - 1\n }))\n };\n }\n });\n }\n });\n\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, increment the \"totalComments\" count\n * of the corresponding step in the content review entry.\n */\n const { id, stepId } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments + 1\n }))\n };\n }\n });\n });\n};\n\nexport const updateLatestCommentId = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterUpdate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n const contentReview = await safelyGetContentReview({\n id,\n contentReviewMethods: apw.contentReview\n });\n\n if (contentReview && contentReview.latestCommentId === comment.id) {\n const [[latestComment]] = await apw.comment.list({\n where: { changeRequest: { id: comment.changeRequest } },\n sort: [\"createdOn_DESC\"]\n });\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: latestComment ? latestComment.id : null\n };\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GAAGA,CAAC;EAAEC;AAA8C,CAAC,KAAK;EAC3FA,GAAG,CAACC,OAAO,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAQ,CAAC,KAAK;IAC9D,MAAM;MAAEG;IAAK,CAAC,GAAGH,OAAO;IACxB;AACR;AACA;AACA;IACQ,IAAIG,IAAI,EAAE;MACN,MAAM;QAAEC,EAAE;QAAEC;MAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACH,IAAI,CAAC;MAE1D,MAAM,IAAAI,0BAAmB,EAAC;QACtBC,oBAAoB,EAAET,GAAG,CAACU,aAAa;QACvCL,EAAE;QACFM,uBAAuB,EAAEC,IAAI,IAAI;UAC7B,OAAO;YACH,GAAGA,IAAI;YACPC,KAAK,EAAE,IAAAC,8BAAuB,EAACF,IAAI,CAACC,KAAK,EAAEP,MAAM,EAAEF,IAAI,KAAK;cACxD,GAAGA,IAAI;cACPW,aAAa,EAAEX,IAAI,CAACW,aAAa,GAAG;YACxC,CAAC,CAAC;UACN,CAAC;QACL;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;EAEFf,GAAG,CAACC,OAAO,CAACe,oBAAoB,CAACb,SAAS,CAAC,OAAO;IAAEF;EAAQ,CAAC,KAAK;IAC9D;AACR;AACA;AACA;IACQ,MAAM;MAAEI,EAAE;MAAEC;IAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACN,OAAO,CAACG,IAAI,CAAC;IAElE,MAAM,IAAAI,0BAAmB,EAAC;MACtBC,oBAAoB,EAAET,GAAG,CAACU,aAAa;MACvCL,EAAE;MACFM,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AAC,CAAC;EACN,CAAC,CAAC;EAEFL,GAAG,CAACC,OAAO,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAQ,CAAC,KAAK;IAC9D;AACR;AACA;AACA;IACQ,MAAM;MAAEI;IAAG,CAAC,GAAG,IAAAE,oCAA6B,EAACN,OAAO,CAACG,IAAI,CAAC;IAE1D,MAAMM,aAAa,GAAG,MAAM,IAAAW,6BAAsB,EAAC;MAC/ChB,EAAE;MACFI,oBAAoB,EAAET,GAAG,CAACU;IAC9B,CAAC,CAAC;IAEF,IAAIA,aAAa,IAAIA,aAAa,CAACS,eAAe,KAAKlB,OAAO,CAACI,EAAE,EAAE;MAC/D,MAAM,CAAC,CAACiB,aAAa,CAAC,CAAC,GAAG,MAAMtB,GAAG,CAACC,OAAO,CAACsB,IAAI,CAAC;QAC7CC,KAAK,EAAE;UAAEC,aAAa,EAAE;YAAEpB,EAAE,EAAEJ,OAAO,CAACwB;UAAc;QAAE,CAAC;QACvDC,IAAI,EAAE,CAAC,gBAAgB;MAC3B,CAAC,CAAC;MAEF,MAAM,IAAAlB,0BAAmB,EAAC;QACtBC,oBAAoB,EAAET,GAAG,CAACU,aAAa;QACvCL,EAAE;QACFM,uBAAuB,EAAED,aAAa,IAAI;UACtC,OAAO;YACH,GAAGA,aAAa;YAChBS,eAAe,EAAEG,aAAa,GAAGA,aAAa,CAACjB,EAAE,GAAG;UACxD,CAAC;QACL;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAC,qBAAA,GAAAA,qBAAA"}
|
@@ -16,21 +16,19 @@ class PageApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSe
|
|
16
16
|
page.settings = (0, _set.default)(page.settings || {}, "apw.workflowId", id);
|
17
17
|
}
|
18
18
|
getWorkflowId(page) {
|
19
|
-
var _page$settings$apw;
|
20
19
|
if (!page.settings) {
|
21
20
|
return null;
|
22
21
|
}
|
23
|
-
return
|
22
|
+
return page.settings.apw?.workflowId || null;
|
24
23
|
}
|
25
24
|
setContentReviewId(page, id) {
|
26
25
|
page.settings = (0, _set.default)(page.settings || {}, "apw.contentReviewId", id);
|
27
26
|
}
|
28
27
|
getContentReviewId(page) {
|
29
|
-
var _page$settings$apw2;
|
30
28
|
if (!page.settings) {
|
31
29
|
return null;
|
32
30
|
}
|
33
|
-
return
|
31
|
+
return page.settings.apw?.contentReviewId;
|
34
32
|
}
|
35
33
|
}
|
36
34
|
exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","
|
1
|
+
{"version":3,"names":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId","exports"],"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,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEO,MAAMI,2BAA2B,SAASC,kDAAwB,CAAC;EACtDC,MAAMA,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,IAAI;EACxC;EAEgBC,aAAaA,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,aAAaA,CAACJ,IAAsB,EAAiB;IACjE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,OAAOF,IAAI,CAACE,QAAQ,CAACG,GAAG,EAAEC,UAAU,IAAI,IAAI;EAChD;EAEgBC,kBAAkBA,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,kBAAkBA,CAACR,IAAsB,EAAiB;IACtE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,OAAOF,IAAI,CAACE,QAAQ,CAACG,GAAG,EAAEI,eAAe;EAC7C;AACJ;AAACC,OAAA,CAAAjB,2BAAA,GAAAA,2BAAA"}
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.linkContentReviewToPage = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
10
9
|
var _types = require("../../types");
|
11
10
|
var _utils = require("./utils");
|
@@ -28,11 +27,13 @@ const linkContentReviewToPage = params => {
|
|
28
27
|
updatePage: pageBuilder.updatePage,
|
29
28
|
uniquePageId: content.id,
|
30
29
|
getNewSettings: settings => {
|
31
|
-
return
|
32
|
-
|
30
|
+
return {
|
31
|
+
...settings,
|
32
|
+
apw: {
|
33
|
+
...(settings.apw || {}),
|
33
34
|
contentReviewId: contentReview.id
|
34
|
-
}
|
35
|
-
}
|
35
|
+
}
|
36
|
+
};
|
36
37
|
}
|
37
38
|
});
|
38
39
|
});
|
@@ -50,19 +51,20 @@ const linkContentReviewToPage = params => {
|
|
50
51
|
updatePage: pageBuilder.updatePage,
|
51
52
|
uniquePageId: content.id,
|
52
53
|
getNewSettings: settings => {
|
53
|
-
return
|
54
|
-
|
54
|
+
return {
|
55
|
+
...settings,
|
56
|
+
apw: {
|
57
|
+
...(settings.apw || {}),
|
55
58
|
contentReviewId: null
|
56
|
-
}
|
57
|
-
}
|
59
|
+
}
|
60
|
+
};
|
58
61
|
}
|
59
62
|
});
|
60
63
|
});
|
61
64
|
pageBuilder.onPageBeforeDelete.subscribe(async ({
|
62
65
|
page
|
63
66
|
}) => {
|
64
|
-
|
65
|
-
const contentReviewId = (_page$settings = page.settings) === null || _page$settings === void 0 || (_page$settings = _page$settings.apw) === null || _page$settings === void 0 ? void 0 : _page$settings.contentReviewId;
|
67
|
+
const contentReviewId = page.settings?.apw?.contentReviewId;
|
66
68
|
if (!contentReviewId) {
|
67
69
|
return;
|
68
70
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","linkContentReviewToPage","params","apw","pageBuilder","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","PAGE","updatePageSettings","getPage","updatePage","uniquePageId","id","getNewSettings","settings","
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","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","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQO,MAAMG,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,OAAO;UACH,GAAGA,QAAQ;UACXf,GAAG,EAAE;YACD,IAAIe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC,CAAC;YACvBgB,eAAe,EAAEd,aAAa,CAACW;UACnC;QACJ,CAAC;MACL;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,OAAO;UACH,GAAGA,QAAQ;UACXf,GAAG,EAAE;YACD,IAAIe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC,CAAC;YACvBgB,eAAe,EAAE;UACrB;QACJ,CAAC;MACL;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFf,WAAW,CAACiB,kBAAkB,CAACd,SAAS,CAAC,OAAO;IAAEe;EAAK,CAAC,KAAK;IACzD,MAAMH,eAAe,GAAGG,IAAI,CAACJ,QAAQ,EAAEf,GAAG,EAAEgB,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,CACJ,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAA1B,uBAAA,GAAAA,uBAAA"}
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.updateContentReviewStatus = void 0;
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
9
8
|
var _get = _interopRequireDefault(require("lodash/get"));
|
10
9
|
var _types = require("../../types");
|
11
10
|
var _utils = require("../../crud/utils");
|
@@ -33,9 +32,11 @@ const updateContentReviewStatus = params => {
|
|
33
32
|
if (contentReview.reviewStatus === _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {
|
34
33
|
await apw.contentReview.update(contentReviewId, {
|
35
34
|
reviewStatus: _types.ApwContentReviewStatus.PUBLISHED,
|
36
|
-
content:
|
35
|
+
content: {
|
36
|
+
...contentReview.content,
|
37
|
+
..._utils.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,
|
37
38
|
publishedBy: identity.id
|
38
|
-
}
|
39
|
+
}
|
39
40
|
});
|
40
41
|
}
|
41
42
|
});
|
@@ -57,9 +58,11 @@ const updateContentReviewStatus = params => {
|
|
57
58
|
if (contentReview.reviewStatus === _types.ApwContentReviewStatus.PUBLISHED) {
|
58
59
|
await apw.contentReview.update(contentReviewId, {
|
59
60
|
reviewStatus: _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED,
|
60
|
-
content:
|
61
|
+
content: {
|
62
|
+
...contentReview.content,
|
63
|
+
..._utils.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,
|
61
64
|
publishedBy: null
|
62
|
-
}
|
65
|
+
}
|
63
66
|
});
|
64
67
|
}
|
65
68
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_get","_interopRequireDefault","require","_types","_utils","updateContentReviewStatus","params","apw","pageBuilder","security","onPageAfterPublish","subscribe","page","contentReviewId","get","contentReview","identity","getIdentity","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED","update","PUBLISHED","content","
|
1
|
+
{"version":3,"names":["_get","_interopRequireDefault","require","_types","_utils","updateContentReviewStatus","params","apw","pageBuilder","security","onPageAfterPublish","subscribe","page","contentReviewId","get","contentReview","identity","getIdentity","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED","update","PUBLISHED","content","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","publishedBy","id","onPageAfterUnpublish","exports"],"sources":["updateContentReviewStatus.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReviewStatus,\n ApwOnPageBeforePublishTopicParams\n} from \"~/types\";\nimport { INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META } from \"~/crud/utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\ninterface UpdateContentReviewStatusParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n security: Security;\n}\n\nexport const updateContentReviewStatus = (params: UpdateContentReviewStatusParams) => {\n const { apw, pageBuilder, security } = params;\n\n pageBuilder.onPageAfterPublish.subscribe<ApwOnPageBeforePublishTopicParams>(\n async ({ page }) => {\n const contentReviewId = get(page, \"settings.apw.contentReviewId\");\n /**\n * Bail out if there is no \"content review\" linked.\n */\n if (!contentReviewId) {\n return;\n }\n\n const contentReview = await apw.contentReview.get(contentReviewId);\n const identity = security.getIdentity();\n /**\n * If content review is \"readyToBePublished set its status as \"published\" after page publish.\n */\n if (contentReview.reviewStatus === ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n await apw.contentReview.update(contentReviewId, {\n reviewStatus: ApwContentReviewStatus.PUBLISHED,\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,\n publishedBy: identity.id\n }\n });\n }\n }\n );\n pageBuilder.onPageAfterUnpublish.subscribe<ApwOnPageBeforePublishTopicParams>(\n async ({ page }) => {\n const contentReviewId = get(page, \"settings.apw.contentReviewId\");\n /**\n * Bail out if there is no \"content review\" linked.\n */\n if (!contentReviewId) {\n return;\n }\n\n const contentReview = await apw.contentReview.get(contentReviewId);\n /**\n * If content review is \"published set its status as \"readyToBePublished\" after page unpublish.\n */\n\n if (contentReview.reviewStatus === ApwContentReviewStatus.PUBLISHED) {\n await apw.contentReview.update(contentReviewId, {\n reviewStatus: ApwContentReviewStatus.READY_TO_BE_PUBLISHED,\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META,\n publishedBy: null\n }\n });\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAUO,MAAMG,yBAAyB,GAAIC,MAAuC,IAAK;EAClF,MAAM;IAAEC,GAAG;IAAEC,WAAW;IAAEC;EAAS,CAAC,GAAGH,MAAM;EAE7CE,WAAW,CAACE,kBAAkB,CAACC,SAAS,CACpC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAChB,MAAMC,eAAe,GAAG,IAAAC,YAAG,EAACF,IAAI,EAAE,8BAA8B,CAAC;IACjE;AACZ;AACA;IACY,IAAI,CAACC,eAAe,EAAE;MAClB;IACJ;IAEA,MAAME,aAAa,GAAG,MAAMR,GAAG,CAACQ,aAAa,CAACD,GAAG,CAACD,eAAe,CAAC;IAClE,MAAMG,QAAQ,GAAGP,QAAQ,CAACQ,WAAW,CAAC,CAAC;IACvC;AACZ;AACA;IACY,IAAIF,aAAa,CAACG,YAAY,KAAKC,6BAAsB,CAACC,qBAAqB,EAAE;MAC7E,MAAMb,GAAG,CAACQ,aAAa,CAACM,MAAM,CAACR,eAAe,EAAE;QAC5CK,YAAY,EAAEC,6BAAsB,CAACG,SAAS;QAC9CC,OAAO,EAAE;UACL,GAAGR,aAAa,CAACQ,OAAO;UACxB,GAAGC,mDAA4C;UAC/CC,WAAW,EAAET,QAAQ,CAACU;QAC1B;MACJ,CAAC,CAAC;IACN;EACJ,CACJ,CAAC;EACDlB,WAAW,CAACmB,oBAAoB,CAAChB,SAAS,CACtC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAChB,MAAMC,eAAe,GAAG,IAAAC,YAAG,EAACF,IAAI,EAAE,8BAA8B,CAAC;IACjE;AACZ;AACA;IACY,IAAI,CAACC,eAAe,EAAE;MAClB;IACJ;IAEA,MAAME,aAAa,GAAG,MAAMR,GAAG,CAACQ,aAAa,CAACD,GAAG,CAACD,eAAe,CAAC;IAClE;AACZ;AACA;;IAEY,IAAIE,aAAa,CAACG,YAAY,KAAKC,6BAAsB,CAACG,SAAS,EAAE;MACjE,MAAMf,GAAG,CAACQ,aAAa,CAACM,MAAM,CAACR,eAAe,EAAE;QAC5CK,YAAY,EAAEC,6BAAsB,CAACC,qBAAqB;QAC1DG,OAAO,EAAE;UACL,GAAGR,aAAa,CAACQ,OAAO;UACxB,GAAGC,mDAA4C;UAC/CC,WAAW,EAAE;QACjB;MACJ,CAAC,CAAC;IACN;EACJ,CACJ,CAAC;AACL,CAAC;AAACG,OAAA,CAAAvB,yBAAA,GAAAA,yBAAA"}
|
@@ -5,8 +5,8 @@ interface AssignWorkflowToPageParams {
|
|
5
5
|
page: PageWithWorkflow;
|
6
6
|
}
|
7
7
|
export declare const assignWorkflowToPage: ({ listWorkflow, page }: AssignWorkflowToPageParams) => Promise<void>;
|
8
|
-
export declare const hasPages: (workflow: ApwWorkflow) =>
|
9
|
-
export declare const shouldUpdatePages: (scope: ApwWorkflowScope, prevScope: ApwWorkflowScope) =>
|
8
|
+
export declare const hasPages: (workflow: ApwWorkflow) => boolean;
|
9
|
+
export declare const shouldUpdatePages: (scope: ApwWorkflowScope, prevScope: ApwWorkflowScope) => boolean;
|
10
10
|
interface GetUpdatePageOpsResult {
|
11
11
|
addedPages: string[];
|
12
12
|
removedPages: string[];
|