@webiny/api-apw 5.40.0-beta.2 → 5.40.0-beta.3
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.map +1 -1
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js.map +1 -1
- package/crud/utils.js +1 -2
- package/crud/utils.js.map +1 -1
- package/index.js.map +1 -1
- package/package.json +33 -33
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +10 -1
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +1 -2
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +1 -2
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +1 -2
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +1 -2
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.js +2 -4
- package/plugins/graphql/utils.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +1 -2
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.js +0 -1
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.js +1 -3
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.js +2 -4
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.js +3 -6
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.js +1 -2
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.js +1 -2
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +1 -2
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +1 -2
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.js +1 -2
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.js +6 -12
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.js +1 -2
- package/utils/pickEntryFieldValues.js.map +1 -1
- package/utils/resolve.js.map +1 -1
package/plugins/graphql/utils.js
CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.onByFields = exports.dateTimeFieldsSorters = void 0;
|
7
|
-
const onByFields = ["createdOn: DateTime!", "modifiedOn: DateTime", "savedOn: DateTime!", "createdBy: ApwIdentity!", "modifiedBy: ApwIdentity", "savedBy: ApwIdentity!"].join("\n");
|
8
|
-
exports.
|
9
|
-
const dateTimeFieldsSorters = ["createdOn_ASC", "createdOn_DESC", "modifiedOn_ASC", "modifiedOn_DESC", "savedOn_ASC", "savedOn_DESC"].join("\n");
|
10
|
-
exports.dateTimeFieldsSorters = dateTimeFieldsSorters;
|
7
|
+
const onByFields = exports.onByFields = ["createdOn: DateTime!", "modifiedOn: DateTime", "savedOn: DateTime!", "createdBy: ApwIdentity!", "modifiedBy: ApwIdentity", "savedBy: ApwIdentity!"].join("\n");
|
8
|
+
const dateTimeFieldsSorters = exports.dateTimeFieldsSorters = ["createdOn_ASC", "createdOn_DESC", "modifiedOn_ASC", "modifiedOn_DESC", "savedOn_ASC", "savedOn_DESC"].join("\n");
|
11
9
|
|
12
10
|
//# sourceMappingURL=utils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["onByFields","
|
1
|
+
{"version":3,"names":["onByFields","exports","join","dateTimeFieldsSorters"],"sources":["utils.ts"],"sourcesContent":["export const onByFields = [\n \"createdOn: DateTime!\",\n \"modifiedOn: DateTime\",\n \"savedOn: DateTime!\",\n \"createdBy: ApwIdentity!\",\n \"modifiedBy: ApwIdentity\",\n \"savedBy: ApwIdentity!\"\n].join(\"\\n\");\n\nexport const dateTimeFieldsSorters = [\n \"createdOn_ASC\",\n \"createdOn_DESC\",\n \"modifiedOn_ASC\",\n \"modifiedOn_DESC\",\n \"savedOn_ASC\",\n \"savedOn_DESC\"\n].join(\"\\n\");\n"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,CACtB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,CAC1B,CAACE,IAAI,CAAC,IAAI,CAAC;AAEL,MAAMC,qBAAqB,GAAAF,OAAA,CAAAE,qBAAA,GAAG,CACjC,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,CACjB,CAACD,IAAI,CAAC,IAAI,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;EACDC,SAAS,EAAE;IACPC,eAAe,EAAE;MACbC,SAAS,EAAEC,MAAM,IAAI;QACjB,MAAMD,SAAwB,GAAGC,MAAM,CAACD,SAAS;QACjD,OAAOA,SAAS,CAACE,GAAG,CAAC,CAAC;UAAEC;QAAG,CAAC,KAAKA,EAAE,CAAC;MACxC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M,CAACpB,IAAI,CAACJ,EAAE,CAAC,CAAC;MAC9D;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAyB,QAAA,
|
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;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AAI,CAAC,CAAC;MAChE,CAAC;MACDC,cAAc,EAAE,MAAAA,CAAOlB,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,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,GAAAC,OAAA,CAAAC,OAAA,GAEYrC,cAAc","ignoreList":[]}
|
package/plugins/graphql.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_workflow","_interopRequireDefault","require","_contentReview","_reviewer","_comment","_changeRequest","_plugins","_api","emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","_default","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema","exports","default"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwIdentity {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAGA,MAAMO,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIC,4BAAmB,CAAC;EACvCC,QAAQ,EAAE,aAAe;AAC7B;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,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IACT,CAAC;IACDO,QAAQ,EAAE;MACND,GAAG,EAAEN;IACT;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAEYA,CAAA,KAAM;EACjB,OAAO,IAAIC,kBAAa,CAAaC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,aAAa,CAAC,4BAA4B,CAAC,EAAE;MAC1D;IACJ;IAEAF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,CACrBb,UAAU,EACVc,iBAAc,EACdC,sBAAmB,EACnBC,iBAAc,EACdC,gBAAa,EACbC,sBAAqB,CACxB,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAb,QAAA"}
|
1
|
+
{"version":3,"names":["_workflow","_interopRequireDefault","require","_contentReview","_reviewer","_comment","_changeRequest","_plugins","_api","emptyResolver","baseSchema","GraphQLSchemaPlugin","typeDefs","resolvers","Query","apw","Mutation","_default","ContextPlugin","context","wcp","canUseFeature","plugins","register","workflowSchema","contentReviewSchema","reviewerSchema","commentSchema","changeRequestedSchema","exports","default"],"sources":["graphql.ts"],"sourcesContent":["import workflowSchema from \"./graphql/workflow.gql\";\nimport contentReviewSchema from \"./graphql/contentReview.gql\";\nimport reviewerSchema from \"./graphql/reviewer.gql\";\nimport commentSchema from \"./graphql/comment.gql\";\nimport changeRequestedSchema from \"./graphql/changeRequest.gql\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\n\nconst emptyResolver = () => ({});\n\nconst baseSchema = new GraphQLSchemaPlugin({\n typeDefs: /* GraphQL */ `\n input ApwRefFieldInput {\n id: ID!\n modelId: String\n }\n\n input ApwRefFieldWhereInput {\n id: String\n id_not: String\n id_in: [String!]\n id_not_in: [String]\n entryId: String\n entryId_not: String\n entryId_in: [String!]\n entryId_not_in: [String!]\n }\n\n type ApwRefField {\n modelId: String!\n entryId: ID!\n id: ID!\n }\n\n type ApwMeta {\n hasMoreItems: Boolean\n totalCount: Int\n cursor: String\n }\n type ApwIdentity {\n id: ID\n displayName: String\n type: String\n }\n type ApwError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n extend type Query {\n apw: ApwQuery\n }\n extend type Mutation {\n apw: ApwMutation\n }\n `,\n resolvers: {\n Query: {\n apw: emptyResolver\n },\n Mutation: {\n apw: emptyResolver\n }\n }\n});\n\nexport default () => {\n return new ContextPlugin<ApwContext>(context => {\n if (!context.wcp.canUseFeature(\"advancedPublishingWorkflow\")) {\n return;\n }\n\n context.plugins.register([\n baseSchema,\n workflowSchema,\n contentReviewSchema,\n reviewerSchema,\n commentSchema,\n changeRequestedSchema\n ]);\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAGA,MAAMO,aAAa,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAEhC,MAAMC,UAAU,GAAG,IAAIC,4BAAmB,CAAC;EACvCC,QAAQ,EAAE,aAAe;AAC7B;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,KAAK;EACDC,SAAS,EAAE;IACPC,KAAK,EAAE;MACHC,GAAG,EAAEN;IACT,CAAC;IACDO,QAAQ,EAAE;MACND,GAAG,EAAEN;IACT;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAQ,QAAA,GAEYA,CAAA,KAAM;EACjB,OAAO,IAAIC,kBAAa,CAAaC,OAAO,IAAI;IAC5C,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,aAAa,CAAC,4BAA4B,CAAC,EAAE;MAC1D;IACJ;IAEAF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,CACrBb,UAAU,EACVc,iBAAc,EACdC,sBAAmB,EACnBC,iBAAc,EACdC,gBAAa,EACbC,sBAAqB,CACxB,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAb,QAAA","ignoreList":[]}
|
@@ -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 = 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;QACH,MAAMD,CAAC;MACX;IACJ;IACA,MAAME,KAAK,GAAGT,QAAQ,EAAES,KAAK,IAAI,IAAI;IACrC;AACR;AACA;IACQ,IAAI,CAACR,QAAQ,EAAE;MACX,IAAI;QACA,MAAMJ,GAAG,CAACI,QAAQ,CAACS,MAAM,CAAC;UACtBN,UAAU,EAAEJ,QAAQ,CAACK,EAAE;UACvBM,WAAW,EAAEX,QAAQ,CAACW,WAAW;UACjCC,IAAI,EAAEZ,QAAQ,CAACY,IAAI;UACnBH;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOI,EAAE,EAAE;QACTC,OAAO,CAACC,GAAG,CACN,6DAA4Df,QAAQ,CAACK,EAAG,EAC7E,CAAC;QACDS,OAAO,CAACC,GAAG,CAACC,IAAI,CAACC,SAAS,CAACJ,EAAE,CAAC,CAAC;QAC/B,MAAMA,EAAE;MACZ;MACA;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMK,MAAM,GAAGjB,QAAQ,CAACU,WAAW,KAAKX,QAAQ,CAACW,WAAW,IAAIV,QAAQ,CAACQ,KAAK,KAAKA,KAAK;IACxF,IAAI,CAACS,MAAM,EAAE;MACT;IACJ;IACA,IAAI;MACA,MAAMrB,GAAG,CAACI,QAAQ,CAACiB,MAAM,CAACjB,QAAQ,CAACI,EAAE,EAAE;QACnCD,UAAU,EAAEH,QAAQ,CAACG,UAAU;QAC/BQ,IAAI,EAAEX,QAAQ,CAACW,IAAI;QACnBD,WAAW,EAAEX,QAAQ,CAACW,WAAW;QACjCF;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOI,EAAE,EAAE;MACTC,OAAO,CAACC,GAAG,CAAE,+CAA8Cd,QAAQ,CAACI,EAAG,EAAC,CAAC;MACzES,OAAO,CAACC,GAAG,CAACC,IAAI,CAACC,SAAS,CAACJ,EAAE,CAAC,CAAC;MAC/B,MAAMA,EAAE;IACZ;EACJ,CAAC,CAAC;AACN,CAAC;AAACM,OAAA,CAAAxB,0BAAA,GAAAA,0BAAA"}
|
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;QACH,MAAMD,CAAC;MACX;IACJ;IACA,MAAME,KAAK,GAAGT,QAAQ,EAAES,KAAK,IAAI,IAAI;IACrC;AACR;AACA;IAC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viewAfterDelete","subscribe","steps","i","length","id","stepId","meta","totalCount","changeRequests","changeRequest","list","where","step","e","message","console","log","delete","exports"],"sources":["deleteChangeRequestsAfterContentReview.ts"],"sourcesContent":["import { ApwChangeRequest, LifeCycleHookCallbackParams, ListMeta } from \"~/types\";\n\nexport const deleteChangeRequestsWithContentReview = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n /**\n * Also delete all associated \"changeRequest\" when a \"contentReview\" is deleted.\n */\n const steps = contentReview.steps;\n /**\n * For each step get associated change requests and delete them.\n */\n for (let i = 0; i < steps.length; i++) {\n const { id: stepId } = steps[i];\n\n let meta: Pick<ListMeta, \"totalCount\"> = {\n totalCount: 1\n };\n /**\n * Paginate through change requests.\n */\n while (meta.totalCount > 0) {\n let changeRequests: ApwChangeRequest[] = [];\n /**\n * Get all change requests.\n */\n try {\n [changeRequests, meta] = await apw.changeRequest.list({\n where: {\n step: `${contentReview.id}#${stepId}`\n }\n });\n } catch (e) {\n meta.totalCount = 0;\n if (e.message !== \"index_not_found_exception\") {\n throw e;\n }\n console.log(e);\n }\n\n /**\n * Delete change requests one by one.\n */\n for (const changeRequest of changeRequests) {\n await apw.changeRequest.delete(changeRequest.id);\n }\n }\n }\n });\n};\n"],"mappings":";;;;;;AAEO,MAAMA,qCAAqC,GAAGA,CAAC;EAClDC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;IACQ,MAAMG,KAAK,GAAGH,aAAa,CAACG,KAAK;IACjC;AACR;AACA;IACQ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,KAAK,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;MACnC,MAAM;QAAEE,EAAE,EAAEC;MAAO,CAAC,GAAGJ,KAAK,CAACC,CAAC,CAAC;MAE/B,IAAII,IAAkC,GAAG;QACrCC,UAAU,EAAE;MAChB,CAAC;MACD;AACZ;AACA;MACY,OAAOD,IAAI,CAACC,UAAU,GAAG,CAAC,EAAE;QACxB,IAAIC,cAAkC,GAAG,EAAE;QAC3C;AAChB;AACA;QACgB,IAAI;UACA,CAACA,cAAc,EAAEF,IAAI,CAAC,GAAG,MAAMT,GAAG,CAACY,aAAa,CAACC,IAAI,CAAC;YAClDC,KAAK,EAAE;cACHC,IAAI,EAAG,GAAEd,aAAa,CAACM,EAAG,IAAGC,MAAO;YACxC;UACJ,CAAC,CAAC;QACN,CAAC,CAAC,OAAOQ,CAAC,EAAE;UACRP,IAAI,CAACC,UAAU,GAAG,CAAC;UACnB,IAAIM,CAAC,CAACC,OAAO,KAAK,2BAA2B,EAAE;YAC3C,MAAMD,CAAC;UACX;UACAE,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC;QAClB;;QAEA;AAChB;AACA;QACgB,KAAK,MAAMJ,aAAa,IAAID,cAAc,EAAE;UACxC,MAAMX,GAAG,CAACY,aAAa,CAACQ,MAAM,CAACR,aAAa,CAACL,EAAE,CAAC;QACpD;MACJ;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAtB,qCAAA,GAAAA,qCAAA"}
|
1
|
+
{"version":3,"names":["deleteChangeRequestsWithContentReview","apw","contentReview","onContentReviewAfterDelete","subscribe","steps","i","length","id","stepId","meta","totalCount","changeRequests","changeRequest","list","where","step","e","message","console","log","delete","exports"],"sources":["deleteChangeRequestsAfterContentReview.ts"],"sourcesContent":["import { ApwChangeRequest, LifeCycleHookCallbackParams, ListMeta } from \"~/types\";\n\nexport const deleteChangeRequestsWithContentReview = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n /**\n * Also delete all associated \"changeRequest\" when a \"contentReview\" is deleted.\n */\n const steps = contentReview.steps;\n /**\n * For each step get associated change requests and delete them.\n */\n for (let i = 0; i < steps.length; i++) {\n const { id: stepId } = steps[i];\n\n let meta: Pick<ListMeta, \"totalCount\"> = {\n totalCount: 1\n };\n /**\n * Paginate through change requests.\n */\n while (meta.totalCount > 0) {\n let changeRequests: ApwChangeRequest[] = [];\n /**\n * Get all change requests.\n */\n try {\n [changeRequests, meta] = await apw.changeRequest.list({\n where: {\n step: `${contentReview.id}#${stepId}`\n }\n });\n } catch (e) {\n meta.totalCount = 0;\n if (e.message !== \"index_not_found_exception\") {\n throw e;\n }\n console.log(e);\n }\n\n /**\n * Delete change requests one by one.\n */\n for (const changeRequest of changeRequests) {\n await apw.changeRequest.delete(changeRequest.id);\n }\n }\n }\n });\n};\n"],"mappings":";;;;;;AAEO,MAAMA,qCAAqC,GAAGA,CAAC;EAClDC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;IACQ,MAAMG,KAAK,GAAGH,aAAa,CAACG,KAAK;IACjC;AACR;AACA;IACQ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,KAAK,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;MACnC,MAAM;QAAEE,EAAE,EAAEC;MAAO,CAAC,GAAGJ,KAAK,CAACC,CAAC,CAAC;MAE/B,IAAII,IAAkC,GAAG;QACrCC,UAAU,EAAE;MAChB,CAAC;MACD;AACZ;AACA;MACY,OAAOD,IAAI,CAACC,UAAU,GAAG,CAAC,EAAE;QACxB,IAAIC,cAAkC,GAAG,EAAE;QAC3C;AAChB;AACA;QACgB,IAAI;UACA,CAACA,cAAc,EAAEF,IAAI,CAAC,GAAG,MAAMT,GAAG,CAACY,aAAa,CAACC,IAAI,CAAC;YAClDC,KAAK,EAAE;cACHC,IAAI,EAAG,GAAEd,aAAa,CAACM,EAAG,IAAGC,MAAO;YACxC;UACJ,CAAC,CAAC;QACN,CAAC,CAAC,OAAOQ,CAAC,EAAE;UACRP,IAAI,CAACC,UAAU,GAAG,CAAC;UACnB,IAAIM,CAAC,CAACC,OAAO,KAAK,2BAA2B,EAAE;YAC3C,MAAMD,CAAC;UACX;UACAE,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC;QAClB;;QAEA;AAChB;AACA;QACgB,KAAK,MAAMJ,aAAa,IAAID,cAAc,EAAE;UACxC,MAAMX,GAAG,CAACY,aAAa,CAACQ,MAAM,CAACR,aAAa,CAACL,EAAE,CAAC;QACpD;MACJ;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAtB,qCAAA,GAAAA,qCAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deleteCommentsAfterChangeRequest","apw","changeRequest","onChangeRequestAfterDelete","subscribe","meta","totalCount","comments","comment","list","where","id","e","message","console","log","delete","exports"],"sources":["deleteCommentsAfterChangeRequest.ts"],"sourcesContent":["import { ApwComment, LifeCycleHookCallbackParams, ListMeta } from \"~/types\";\n\nexport const deleteCommentsAfterChangeRequest = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({ changeRequest }) => {\n /**\n * Also delete all associated comments with \"changeRequest\".\n */\n let meta: Pick<ListMeta, \"totalCount\"> = {\n totalCount: 1\n };\n /**\n * Paginate through comments.\n */\n while (meta.totalCount > 0) {\n let comments: ApwComment[] = [];\n /**\n * Get all comments.\n */\n try {\n [comments, meta] = await apw.comment.list({\n where: {\n changeRequest: {\n id: changeRequest.id\n }\n }\n });\n } catch (e) {\n meta.totalCount = 0;\n if (e.message !== \"index_not_found_exception\") {\n throw e;\n }\n console.log(e);\n }\n\n /**\n * Delete comments one by one.\n */\n for (const comment of comments) {\n await apw.comment.delete(comment.id);\n }\n }\n });\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gCAAgC,GAAGA,CAAC;EAC7CC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;IACQ,IAAIG,IAAkC,GAAG;MACrCC,UAAU,EAAE;IAChB,CAAC;IACD;AACR;AACA;IACQ,OAAOD,IAAI,CAACC,UAAU,GAAG,CAAC,EAAE;MACxB,IAAIC,QAAsB,GAAG,EAAE;MAC/B;AACZ;AACA;MACY,IAAI;QACA,CAACA,QAAQ,EAAEF,IAAI,CAAC,GAAG,MAAMJ,GAAG,CAACO,OAAO,CAACC,IAAI,CAAC;UACtCC,KAAK,EAAE;YACHR,aAAa,EAAE;cACXS,EAAE,EAAET,aAAa,CAACS;YACtB;UACJ;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOC,CAAC,EAAE;QACRP,IAAI,CAACC,UAAU,GAAG,CAAC;QACnB,IAAIM,CAAC,CAACC,OAAO,KAAK,2BAA2B,EAAE;UAC3C,MAAMD,CAAC;QACX;QACAE,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC;MAClB;;MAEA;AACZ;AACA;MACY,KAAK,MAAMJ,OAAO,IAAID,QAAQ,EAAE;QAC5B,MAAMN,GAAG,CAACO,OAAO,CAACQ,MAAM,CAACR,OAAO,CAACG,EAAE,CAAC;MACxC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACM,OAAA,CAAAjB,gCAAA,GAAAA,gCAAA"}
|
1
|
+
{"version":3,"names":["deleteCommentsAfterChangeRequest","apw","changeRequest","onChangeRequestAfterDelete","subscribe","meta","totalCount","comments","comment","list","where","id","e","message","console","log","delete","exports"],"sources":["deleteCommentsAfterChangeRequest.ts"],"sourcesContent":["import { ApwComment, LifeCycleHookCallbackParams, ListMeta } from \"~/types\";\n\nexport const deleteCommentsAfterChangeRequest = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({ changeRequest }) => {\n /**\n * Also delete all associated comments with \"changeRequest\".\n */\n let meta: Pick<ListMeta, \"totalCount\"> = {\n totalCount: 1\n };\n /**\n * Paginate through comments.\n */\n while (meta.totalCount > 0) {\n let comments: ApwComment[] = [];\n /**\n * Get all comments.\n */\n try {\n [comments, meta] = await apw.comment.list({\n where: {\n changeRequest: {\n id: changeRequest.id\n }\n }\n });\n } catch (e) {\n meta.totalCount = 0;\n if (e.message !== \"index_not_found_exception\") {\n throw e;\n }\n console.log(e);\n }\n\n /**\n * Delete comments one by one.\n */\n for (const comment of comments) {\n await apw.comment.delete(comment.id);\n }\n }\n });\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gCAAgC,GAAGA,CAAC;EAC7CC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;IACQ,IAAIG,IAAkC,GAAG;MACrCC,UAAU,EAAE;IAChB,CAAC;IACD;AACR;AACA;IACQ,OAAOD,IAAI,CAACC,UAAU,GAAG,CAAC,EAAE;MACxB,IAAIC,QAAsB,GAAG,EAAE;MAC/B;AACZ;AACA;MACY,IAAI;QACA,CAACA,QAAQ,EAAEF,IAAI,CAAC,GAAG,MAAMJ,GAAG,CAACO,OAAO,CAACC,IAAI,CAAC;UACtCC,KAAK,EAAE;YACHR,aAAa,EAAE;cACXS,EAAE,EAAET,aAAa,CAACS;YACtB;UACJ;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOC,CAAC,EAAE;QACRP,IAAI,CAACC,UAAU,GAAG,CAAC;QACnB,IAAIM,CAAC,CAACC,OAAO,KAAK,2BAA2B,EAAE;UAC3C,MAAMD,CAAC;QACX;QACAE,OAAO,CAACC,GAAG,CAACH,CAAC,CAAC;MAClB;;MAEA;AACZ;AACA;MACY,KAAK,MAAMJ,OAAO,IAAID,QAAQ,EAAE;QAC5B,MAAMN,GAAG,CAACO,OAAO,CAACQ,MAAM,CAACR,OAAO,CAACG,EAAE,CAAC;MACxC;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACM,OAAA,CAAAjB,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_api","require","_deleteCommentsAfterChangeRequest","_deleteChangeRequestsAfterContentReview","_createReviewerFromIdentity","_initializeContentReviewSteps","_updatePendingChangeRequests","_updateTotalComments","_validateChangeRequest","_validateContentReview","_validateComment","_listContentReviews","_initializeNotifications","attachApwHooks","ContextPlugin","context","security","apw","validateContentReview","validateChangeRequest","validateComment","createReviewerFromIdentity","initializeContentReviewSteps","updatePendingChangeRequestsCount","updateTotalCommentsCount","updateLatestCommentId","deleteCommentsAfterChangeRequest","deleteChangeRequestsWithContentReview","listContentReviews","initializeNotifications","exports"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { deleteCommentsAfterChangeRequest } from \"./deleteCommentsAfterChangeRequest\";\nimport { deleteChangeRequestsWithContentReview } from \"./deleteChangeRequestsAfterContentReview\";\nimport { createReviewerFromIdentity } from \"./createReviewerFromIdentity\";\nimport { initializeContentReviewSteps } from \"./initializeContentReviewSteps\";\nimport { updatePendingChangeRequestsCount } from \"./updatePendingChangeRequests\";\nimport { updateTotalCommentsCount, updateLatestCommentId } from \"./updateTotalComments\";\nimport { validateChangeRequest } from \"./validateChangeRequest\";\nimport { validateContentReview } from \"./validateContentReview\";\nimport { validateComment } from \"./validateComment\";\nimport { listContentReviews } from \"./listContentReviews\";\nimport { initializeNotifications } from \"./initializeNotifications\";\n\nexport const attachApwHooks = () =>\n /**\n * Hook into CMS events and execute business logic.\n */\n new ContextPlugin<ApwContext>(async context => {\n const { security, apw } = context;\n\n validateContentReview({ apw });\n\n validateChangeRequest({ apw });\n\n validateComment({ apw });\n\n createReviewerFromIdentity({ security, apw });\n\n initializeContentReviewSteps(context);\n\n updatePendingChangeRequestsCount({ apw });\n\n updateTotalCommentsCount({ apw });\n\n updateLatestCommentId({ apw });\n\n deleteCommentsAfterChangeRequest({ apw });\n\n deleteChangeRequestsWithContentReview({ apw });\n\n listContentReviews(context);\n\n initializeNotifications(context);\n });\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,iCAAA,GAAAD,OAAA;AACA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AACA,IAAAI,6BAAA,GAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AACA,IAAAW,wBAAA,GAAAX,OAAA;AAEO,MAAMY,cAAc,GAAGA,CAAA;AAC1B;AACJ;AACA;AACI,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,QAAQ;IAAEC;EAAI,CAAC,GAAGF,OAAO;EAEjC,IAAAG,4CAAqB,EAAC;IAAED;EAAI,CAAC,CAAC;EAE9B,IAAAE,4CAAqB,EAAC;IAAEF;EAAI,CAAC,CAAC;EAE9B,IAAAG,gCAAe,EAAC;IAAEH;EAAI,CAAC,CAAC;EAExB,IAAAI,sDAA0B,EAAC;IAAEL,QAAQ;IAAEC;EAAI,CAAC,CAAC;EAE7C,IAAAK,0DAA4B,EAACP,OAAO,CAAC;EAErC,IAAAQ,6DAAgC,EAAC;IAAEN;EAAI,CAAC,CAAC;EAEzC,IAAAO,6CAAwB,EAAC;IAAEP;EAAI,CAAC,CAAC;EAEjC,IAAAQ,0CAAqB,EAAC;IAAER;EAAI,CAAC,CAAC;EAE9B,IAAAS,kEAAgC,EAAC;IAAET;EAAI,CAAC,CAAC;EAEzC,IAAAU,6EAAqC,EAAC;IAAEV;EAAI,CAAC,CAAC;EAE9C,IAAAW,sCAAkB,EAACb,OAAO,CAAC;EAE3B,IAAAc,gDAAuB,EAACd,OAAO,CAAC;AACpC,CAAC,CAAC;AAACe,OAAA,CAAAjB,cAAA,GAAAA,cAAA"}
|
1
|
+
{"version":3,"names":["_api","require","_deleteCommentsAfterChangeRequest","_deleteChangeRequestsAfterContentReview","_createReviewerFromIdentity","_initializeContentReviewSteps","_updatePendingChangeRequests","_updateTotalComments","_validateChangeRequest","_validateContentReview","_validateComment","_listContentReviews","_initializeNotifications","attachApwHooks","ContextPlugin","context","security","apw","validateContentReview","validateChangeRequest","validateComment","createReviewerFromIdentity","initializeContentReviewSteps","updatePendingChangeRequestsCount","updateTotalCommentsCount","updateLatestCommentId","deleteCommentsAfterChangeRequest","deleteChangeRequestsWithContentReview","listContentReviews","initializeNotifications","exports"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContext } from \"~/types\";\nimport { deleteCommentsAfterChangeRequest } from \"./deleteCommentsAfterChangeRequest\";\nimport { deleteChangeRequestsWithContentReview } from \"./deleteChangeRequestsAfterContentReview\";\nimport { createReviewerFromIdentity } from \"./createReviewerFromIdentity\";\nimport { initializeContentReviewSteps } from \"./initializeContentReviewSteps\";\nimport { updatePendingChangeRequestsCount } from \"./updatePendingChangeRequests\";\nimport { updateTotalCommentsCount, updateLatestCommentId } from \"./updateTotalComments\";\nimport { validateChangeRequest } from \"./validateChangeRequest\";\nimport { validateContentReview } from \"./validateContentReview\";\nimport { validateComment } from \"./validateComment\";\nimport { listContentReviews } from \"./listContentReviews\";\nimport { initializeNotifications } from \"./initializeNotifications\";\n\nexport const attachApwHooks = () =>\n /**\n * Hook into CMS events and execute business logic.\n */\n new ContextPlugin<ApwContext>(async context => {\n const { security, apw } = context;\n\n validateContentReview({ apw });\n\n validateChangeRequest({ apw });\n\n validateComment({ apw });\n\n createReviewerFromIdentity({ security, apw });\n\n initializeContentReviewSteps(context);\n\n updatePendingChangeRequestsCount({ apw });\n\n updateTotalCommentsCount({ apw });\n\n updateLatestCommentId({ apw });\n\n deleteCommentsAfterChangeRequest({ apw });\n\n deleteChangeRequestsWithContentReview({ apw });\n\n listContentReviews(context);\n\n initializeNotifications(context);\n });\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAEA,IAAAC,iCAAA,GAAAD,OAAA;AACA,IAAAE,uCAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AACA,IAAAI,6BAAA,GAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AACA,IAAAW,wBAAA,GAAAX,OAAA;AAEO,MAAMY,cAAc,GAAGA,CAAA;AAC1B;AACJ;AACA;AACI,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,QAAQ;IAAEC;EAAI,CAAC,GAAGF,OAAO;EAEjC,IAAAG,4CAAqB,EAAC;IAAED;EAAI,CAAC,CAAC;EAE9B,IAAAE,4CAAqB,EAAC;IAAEF;EAAI,CAAC,CAAC;EAE9B,IAAAG,gCAAe,EAAC;IAAEH;EAAI,CAAC,CAAC;EAExB,IAAAI,sDAA0B,EAAC;IAAEL,QAAQ;IAAEC;EAAI,CAAC,CAAC;EAE7C,IAAAK,0DAA4B,EAACP,OAAO,CAAC;EAErC,IAAAQ,6DAAgC,EAAC;IAAEN;EAAI,CAAC,CAAC;EAEzC,IAAAO,6CAAwB,EAAC;IAAEP;EAAI,CAAC,CAAC;EAEjC,IAAAQ,0CAAqB,EAAC;IAAER;EAAI,CAAC,CAAC;EAE9B,IAAAS,kEAAgC,EAAC;IAAET;EAAI,CAAC,CAAC;EAEzC,IAAAU,6EAAqC,EAAC;IAAEV;EAAI,CAAC,CAAC;EAE9C,IAAAW,sCAAkB,EAACb,OAAO,CAAC;EAE3B,IAAAc,gDAAuB,EAACd,OAAO,CAAC;AACpC,CAAC,CAAC;AAACe,OAAA,CAAAjB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
@@ -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","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,CA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,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
|
+
{"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,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Ac,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","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_contentReviewAfterCreate","require","_commentAfterCreate","_changeRequestAfterCreate","initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate","exports"],"sources":["initializeNotifications.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,OAAmB,IAAK;EAC5D,IAAAC,wDAA8B,EAACD,OAAO,CAAC;EACvC,IAAAE,4CAAwB,EAACF,OAAO,CAAC;EACjC,IAAAG,wDAA8B,EAACH,OAAO,CAAC;AAC3C,CAAC;AAACI,OAAA,CAAAL,uBAAA,GAAAA,uBAAA"}
|
1
|
+
{"version":3,"names":["_contentReviewAfterCreate","require","_commentAfterCreate","_changeRequestAfterCreate","initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate","exports"],"sources":["initializeNotifications.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,OAAmB,IAAK;EAC5D,IAAAC,wDAA8B,EAACD,OAAO,CAAC;EACvC,IAAAE,4CAAwB,EAACF,OAAO,CAAC;EACjC,IAAAG,wDAA8B,EAACH,OAAO,CAAC;AAC3C,CAAC;AAACI,OAAA,CAAAL,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -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,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
|
+
{"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","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getAppUrl","context","tenant","tenancy","getCurrentTenant","id","settings","getSettings","ex","code","exports"],"sources":["appUrl.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\n\nexport const getAppUrl = async (context: ApwContext) => {\n const tenant = context.tenancy.getCurrentTenant().id;\n try {\n return await context.settings.getSettings(tenant);\n } catch (ex) {\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n return null;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,SAAS,GAAG,MAAOC,OAAmB,IAAK;EACpD,MAAMC,MAAM,GAAGD,OAAO,CAACE,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAACC,EAAE;EACpD,IAAI;IACA,OAAO,MAAMJ,OAAO,CAACK,QAAQ,CAACC,WAAW,CAACL,MAAM,CAAC;EACrD,CAAC,CAAC,OAAOM,EAAE,EAAE;IACT,IAAIA,EAAE,CAACC,IAAI,KAAK,WAAW,EAAE;MACzB,MAAMD,EAAE;IACZ;EACJ;EACA,OAAO,IAAI;AACf,CAAC;AAACE,OAAA,CAAAV,SAAA,GAAAA,SAAA"}
|
1
|
+
{"version":3,"names":["getAppUrl","context","tenant","tenancy","getCurrentTenant","id","settings","getSettings","ex","code","exports"],"sources":["appUrl.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\n\nexport const getAppUrl = async (context: ApwContext) => {\n const tenant = context.tenancy.getCurrentTenant().id;\n try {\n return await context.settings.getSettings(tenant);\n } catch (ex) {\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n return null;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,SAAS,GAAG,MAAOC,OAAmB,IAAK;EACpD,MAAMC,MAAM,GAAGD,OAAO,CAACE,OAAO,CAACC,gBAAgB,CAAC,CAAC,CAACC,EAAE;EACpD,IAAI;IACA,OAAO,MAAMJ,OAAO,CAACK,QAAQ,CAACC,WAAW,CAACL,MAAM,CAAC;EACrD,CAAC,CAAC,OAAOM,EAAE,EAAE;IACT,IAAIA,EAAE,CAACC,IAAI,KAAK,WAAW,EAAE;MACzB,MAAMD,EAAE;IACZ;EACJ;EACA,OAAO,IAAI;AACf,CAAC;AAACE,OAAA,CAAAV,SAAA,GAAAA,SAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_sendChangeRequestNotification","_reviewers","_changeRequestUrl","_appUrl","attachChangeRequestAfterCreate","context","apw","changeRequest","onChangeRequestAfterCreate","subscribe","execute","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","WebinyError","settings","getAppUrl","changeRequestUrl","createChangeRequestUrl","baseUrl","appUrl","changeRequestId","contentReview","get","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendChangeRequestNotification","ex","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["changeRequestAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { sendChangeRequestNotification } from \"./sendChangeRequestNotification\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { createChangeRequestUrl } from \"./changeRequestUrl\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachChangeRequestAfterCreate = (context: ApwContext): void => {\n context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n const execute = async () => {\n const { id: contentReviewId, stepId } = extractContentReviewIdAndStep(\n changeRequest.step\n );\n if (!stepId) {\n throw new WebinyError(\"Malformed changeRequest.step value.\", \"MALFORMED_VALUE\", {\n step: changeRequest.step\n });\n }\n\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n /**\n * We will check if we can create a comment url before we go digging further into the database.\n */\n const changeRequestUrl = createChangeRequestUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!changeRequestUrl) {\n return;\n }\n /**\n * Let's see if content review exists.\n */\n const contentReview = await context.apw.contentReview.get(contentReviewId);\n if (!contentReview) {\n throw new WebinyError(\n `There is no contentReview with id \"${contentReviewId}\".`,\n \"CONTENT_REVIEW_NOT_FOUND\",\n {\n contentReviewId\n }\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 workflowId \"${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: [changeRequest.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendChangeRequestNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n changeRequestUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send change request notifications.`,\n \"CHANGE_REQUEST_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n changeRequestUrl,\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,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEO,MAAMO,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,MAAM;QAAEC,EAAE,EAAEC,eAAe;QAAEC;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MACJ,CAAC,CAAC;MACF,IAAI,CAACE,UAAU,EAAE;QACb;MACJ;MAEA,MAAMG,SAAS,GAAG,MAAM,IAAAC,yBAAc,EAAC;QACnC3B,OAAO;QACPqB,QAAQ;QACRO,OAAO,EAAE,CAAC1B,aAAa,CAAC2B,SAAS,CAACvB,EAAE;MACxC,CAAC,CAAC;MACF,IAAIoB,SAAS,CAACI,MAAM,KAAK,CAAC,EAAE;QACxB;MACJ;MAEA,IAAI;QACA,MAAM,IAAAC,4DAA6B,EAAC;UAChC/B,OAAO;UACP0B,SAAS;UACTxB,aAAa;UACbiB,aAAa;UACbE,QAAQ;UACRP,gBAAgB;UAChBS;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOS,EAAE,EAAE;QACT,MAAM,IAAIrB,cAAW,CAChB,8CAA6C,EAC9C,uCAAuC,EACvC;UACIW,UAAU,EAAED,QAAQ,CAACf,EAAE;UACvBY,eAAe,EAAEhB,aAAa,CAACI,EAAE;UACjCC,eAAe;UACfO,gBAAgB;UAChBS,UAAU;UACVU,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,MAAMrC,OAAO,CAACsC,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,OAAOlC,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACmC,OAAA,CAAAzC,8BAAA,GAAAA,8BAAA"}
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_sendChangeRequestNotification","_reviewers","_changeRequestUrl","_appUrl","attachChangeRequestAfterCreate","context","apw","changeRequest","onChangeRequestAfterCreate","subscribe","execute","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","WebinyError","settings","getAppUrl","changeRequestUrl","createChangeRequestUrl","baseUrl","appUrl","changeRequestId","contentReview","get","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendChangeRequestNotification","ex","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["changeRequestAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { sendChangeRequestNotification } from \"./sendChangeRequestNotification\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { createChangeRequestUrl } from \"./changeRequestUrl\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachChangeRequestAfterCreate = (context: ApwContext): void => {\n context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n const execute = async () => {\n const { id: contentReviewId, stepId } = extractContentReviewIdAndStep(\n changeRequest.step\n );\n if (!stepId) {\n throw new WebinyError(\"Malformed changeRequest.step value.\", \"MALFORMED_VALUE\", {\n step: changeRequest.step\n });\n }\n\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n /**\n * We will check if we can create a comment url before we go digging further into the database.\n */\n const changeRequestUrl = createChangeRequestUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!changeRequestUrl) {\n return;\n }\n /**\n * Let's see if content review exists.\n */\n const contentReview = await context.apw.contentReview.get(contentReviewId);\n if (!contentReview) {\n throw new WebinyError(\n `There is no contentReview with id \"${contentReviewId}\".`,\n \"CONTENT_REVIEW_NOT_FOUND\",\n {\n contentReviewId\n }\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 workflowId \"${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: [changeRequest.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendChangeRequestNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n changeRequestUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send change request notifications.`,\n \"CHANGE_REQUEST_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n changeRequestUrl,\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,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEO,MAAMO,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,MAAM;QAAEC,EAAE,EAAEC,eAAe;QAAEC;MAAO,CAAC,GAAG,IAAAC,oCAA6B,EACjEP,aAAa,CAACQ,IAClB,CAAC;MACD,IAAI,CAACF,MAAM,EAAE;QACT,MAAM,IAAIG,cAAW,CAAC,qCAAqC,EAAE,iBAAiB,EAAE;UAC5ED,IAAI,EAA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AAC2B,SAAS,CAACvB,EAAE;MACxC,CAAC,CAAC;MACF,IAAIoB,SAAS,CAACI,MAAM,KAAK,CAAC,EAAE;QACxB;MACJ;MAEA,IAAI;QACA,MAAM,IAAAC,4DAA6B,EAAC;UAChC/B,OAAO;UACP0B,SAAS;UACTxB,aAAa;UACbiB,aAAa;UACbE,QAAQ;UACRP,gBAAgB;UAChBS;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOS,EAAE,EAAE;QACT,MAAM,IAAIrB,cAAW,CAChB,8CAA6C,EAC9C,uCAAuC,EACvC;UACIW,UAAU,EAAED,QAAQ,CAACf,EAAE;UACvBY,eAAe,EAAEhB,aAAa,CAACI,EAAE;UACjCC,eAAe;UACfO,gBAAgB;UAChBS,UAAU;UACVU,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,MAAMrC,OAAO,CAACsC,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,OAAOlC,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACmC,OAAA,CAAAzC,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createChangeRequestUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId","exports"],"sources":["changeRequestUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createChangeRequestUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":";;;;;;AAMO,MAAMA,sBAAsB,GAAIC,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGP,MAAM;EAEpE,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAC;AAC3F,CAAC;AAACG,OAAA,CAAAT,sBAAA,GAAAA,sBAAA"}
|
1
|
+
{"version":3,"names":["createChangeRequestUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId","exports"],"sources":["changeRequestUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createChangeRequestUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":";;;;;;AAMO,MAAMA,sBAAsB,GAAIC,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGP,MAAM;EAEpE,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAC;AAC3F,CAAC;AAACG,OAAA,CAAAT,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_commentUrl","_reviewers","_sendCommentNotification","_appUrl","attachCommentAfterCreate","context","apw","comment","onCommentAfterCreate","subscribe","execute","changeRequest","get","WebinyError","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","settings","getAppUrl","commentUrl","createCommentUrl","baseUrl","appUrl","changeRequestId","console","log","contentReview","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendCommentNotification","ex","commentId","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["commentAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { createCommentUrl } from \"./commentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendCommentNotification } from \"./sendCommentNotification\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachCommentAfterCreate = (context: ApwContext): void => {\n context.apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n const execute = async () => {\n const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);\n if (!changeRequest) {\n throw new WebinyError(\"Missing change request.\", \"CHANGE_REQUEST_NOT_FOUND\", {\n changeRequest: comment.changeRequest,\n comment: comment.id\n });\n }\n\n const { id: contentReviewId, stepId } = extractContentReviewIdAndStep(\n changeRequest.step\n );\n if (!stepId) {\n throw new WebinyError(\"Malformed changeRequest.step value.\", \"MALFORMED_VALUE\", {\n step: changeRequest.step\n });\n }\n\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n /**\n * We will check if we can create a comment url before we go digging further into the database.\n */\n const commentUrl = createCommentUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!commentUrl) {\n console.log(\"No comment url.\");\n return;\n }\n /**\n * Let's see if content review exists.\n */\n const contentReview = await context.apw.contentReview.get(contentReviewId);\n if (!contentReview) {\n throw new WebinyError(\n `There is no contentReview with id \"${contentReviewId}\".`,\n \"CONTENT_REVIEW_NOT_FOUND\",\n {\n contentReviewId\n }\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 workflowId \"${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 console.log(\"No content url.\");\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [comment.createdBy.id]\n });\n\n if (reviewers.length === 0) {\n console.log(\"No reviewers to send the e-mail notification to.\");\n return;\n }\n\n try {\n await sendCommentNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n commentUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send comment notifications.`,\n \"COMMENT_NOTIFICATIONS_NOT_SENT\",\n {\n commentId: comment.id,\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n commentUrl,\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,sBA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AAa;UACbiB,aAAa;UACbC,QAAQ;UACRR,UAAU;UACVU;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOS,EAAE,EAAE;QACT,MAAM,IAAI3B,cAAW,CAChB,uCAAsC,EACvC,gCAAgC,EAChC;UACI4B,SAAS,EAAElC,OAAO,CAACO,EAAE;UACrBgB,UAAU,EAAED,QAAQ,CAACf,EAAE;UACvBW,eAAe,EAAEd,aAAa,CAACG,EAAE;UACjCC,eAAe;UACfM,UAAU;UACVU,UAAU;UACVW,KAAK,EAAE;YACHC,OAAO,EAAEH,EAAE,CAACG,OAAO;YACnBC,IAAI,EAAEJ,EAAE,CAACI,IAAI;YACbC,IAAI,EAAEL,EAAE,CAACK,IAAI;YACbC,KAAK,EAAEN,EAAE,CAACM;UACd;QACJ,CACJ,CAAC;MACL;IACJ,CAAC;IAED,MAAMzC,OAAO,CAAC0C,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,OAAOtC,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACuC,OAAA,CAAA7C,wBAAA,GAAAA,wBAAA"}
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_commentUrl","_reviewers","_sendCommentNotification","_appUrl","attachCommentAfterCreate","context","apw","comment","onCommentAfterCreate","subscribe","execute","changeRequest","get","WebinyError","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","settings","getAppUrl","commentUrl","createCommentUrl","baseUrl","appUrl","changeRequestId","console","log","contentReview","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendCommentNotification","ex","commentId","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["commentAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { createCommentUrl } from \"./commentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendCommentNotification } from \"./sendCommentNotification\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachCommentAfterCreate = (context: ApwContext): void => {\n context.apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n const execute = async () => {\n const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);\n if (!changeRequest) {\n throw new WebinyError(\"Missing change request.\", \"CHANGE_REQUEST_NOT_FOUND\", {\n changeRequest: comment.changeRequest,\n comment: comment.id\n });\n }\n\n const { id: contentReviewId, stepId } = extractContentReviewIdAndStep(\n changeRequest.step\n );\n if (!stepId) {\n throw new WebinyError(\"Malformed changeRequest.step value.\", \"MALFORMED_VALUE\", {\n step: changeRequest.step\n });\n }\n\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n /**\n * We will check if we can create a comment url before we go digging further into the database.\n */\n const commentUrl = createCommentUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!commentUrl) {\n console.log(\"No comment url.\");\n return;\n }\n /**\n * Let's see if content review exists.\n */\n const contentReview = await context.apw.contentReview.get(contentReviewId);\n if (!contentReview) {\n throw new WebinyError(\n `There is no contentReview with id \"${contentReviewId}\".`,\n \"CONTENT_REVIEW_NOT_FOUND\",\n {\n contentReviewId\n }\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 workflowId \"${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 console.log(\"No content url.\");\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [comment.createdBy.id]\n });\n\n if (reviewers.length === 0) {\n console.log(\"No reviewers to send the e-mail notification to.\");\n return;\n }\n\n try {\n await sendCommentNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n commentUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send comment notifications.`,\n \"COMMENT_NOTIFICATIONS_NOT_SENT\",\n {\n commentId: comment.id,\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n commentUrl,\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,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEO,MAAMO,wBAAwB,GAAIC,OAAmB,IAAW;EACnEA,OAAO,CAACC,GAAG,CAACC,OAAO,CAACC,oBAAoB,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAQ,CAAC,KAAK;IACtE,MAAMG,OAAO,GAAG,MAAAA,CAAA,KAAY;MACxB,MAAMC,aAAa,GAAG,MAAMN,OAAO,CAACC,GAAG,CAACK,aAAa,CAACC,GAAG,CAACL,OAAO,CAACI,aAAa,CAAC;MAChF,IAAI,CAACA,aAAa,EAAE;QAChB,MAAM,IAAIE,cAAW,CAAC,yBAAyB,EAAE,0BAA0B,EAAE;UACzEF,aAAa,EAAEJ,OAAO,CAACI,aAAa;UACpCJ,OAAO,EAAEA,OAAO,CAACO;QACrB,CAAC,CAAC;MACN;MAEA,MAAM;QAAEA,EAAE,EAAEC,eAAe;QAAEC;MAAO,CAAC,GAAG,IAAAC,oCAA6B,EACjEN,aAAa,CAACO,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,CAAC;MACF,IAAI,CAACE,UAAU,EAAE;QACbL,OAAO,CAACC,GAAG,CAAC,iBAAiB,CAAC;QAC9B;MACJ;MAEA,MAAMO,SAAS,GAAG,MAAM,IAAAC,yBAAc,EAAC;QACnC9B,OAAO;QACPwB,QAAQ;QACRO,OAAO,EAAE,CAAC7B,OAAO,CAAC8B,SAAS,CAACvB,EAAE;MAClC,CAAC,CAAC;MAEF,IAAIoB,SAAS,CAACI,MAAM,KAAK,CAAC,EAAE;QACxBZ,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;QAC/D;MACJ;MAEA,IAAI;QACA,MAAM,IAAAY,gDAAuB,EAAC;UAC1BlC,OAAO;UACP6B,SAAS;UACTvB,aAAa;UACbiB,aAAa;UACbC,QAAQ;UACRR,UAAU;UACVU;QACJ,CAAC,CAAC;MACN,CAAC,CAAC,OAAOS,EAAE,EAAE;QACT,MAAM,IAAI3B,cAAW,CAChB,uCAAsC,EACvC,gCAAgC,EAChC;UACI4B,SAAS,EAAElC,OAAO,CAACO,EAAE;UACrBgB,UAAU,EAAED,QAAQ,CAACf,EAAE;UACvBW,eAAe,EAAEd,aAAa,CAACG,EAAE;UACjCC,eAAe;UACfM,UAAU;UACVU,UAAU;UACVW,KAAK,EAAE;YACHC,OAAO,EAAEH,EAAE,CAACG,OAAO;YACnBC,IAAI,EAAEJ,EAAE,CAACI,IAAI;YACbC,IAAI,EAAEL,EAAE,CAACK,IAAI;YACbC,KAAK,EAAEN,EAAE,CAACM;UACd;QACJ,CACJ,CAAC;MACL;IACJ,CAAC;IAED,MAAMzC,OAAO,CAAC0C,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,OAAOtC,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACuC,OAAA,CAAA7C,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createCommentUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId","exports"],"sources":["commentUrl.ts"],"sourcesContent":["interface CreateCommentUrlParams {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createCommentUrl = (params: CreateCommentUrlParams): string | null => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":";;;;;;AAMO,MAAMA,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGP,MAAM;EAEpE,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAC;AAC3F,CAAC;AAACG,OAAA,CAAAT,gBAAA,GAAAA,gBAAA"}
|
1
|
+
{"version":3,"names":["createCommentUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId","exports"],"sources":["commentUrl.ts"],"sourcesContent":["interface CreateCommentUrlParams {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createCommentUrl = (params: CreateCommentUrlParams): string | null => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":";;;;;;AAMO,MAAMA,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGP,MAAM;EAEpE,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAC;AAC3F,CAAC;AAACG,OAAA,CAAAT,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -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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,OAAO,EAAE,CAACzB,aAAa,CAAC0B,SAAS,CAACnB,EAAE;MACxC,CAAC,CAAC;MACF,IAAIgB,SAAS,CAAClB,MAAM,KAAK,CAAC,EAAE;QACxB;MACJ;MAEA,IAAI;QACA,MAAM,IAAAsB,4DAA6B,EAAC;UAChC7B,OAAO;UACPyB,SAAS;UACTvB,aAAa;UACbgB,QAAQ;UACRN,gBAAgB;UAChBU;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
|
+
{"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":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AAU,GAAG,IAAAC,4BAAgB,EAAC;QAChCC,OAAO,EAAExB,OAAO,CAACwB,OAAO;QACxBV,OAAO,EAAEJ,QAAQ,CAACK,MAAM;QACxBb,aAAa;QACbgB;MACJ,CAAC,CAAC;MACF,IAAI,CAACI,UAAU,EAAE;QACb;MACJ;MAEA,MAAMG,SAAS,GAAG,MAAM,IAAAC,yBAAc,EAAC;QACnC1B,OAAO;QACPkB,QAAQ;QACRS,OAAO,EAAE,CAACzB,aAAa,CAAC0B,SAAS,CAACnB,EAAE;MACxC,CAAC,CAAC;MACF,IAAIgB,SAAS,CAAClB,MAAM,KAAK,CAAC,EAAE;QACxB;MACJ;MAEA,IAAI;QACA,MAAM,IAAAsB,4DAA6B,EAAC;UAChC7B,OAAO;UACPyB,SAAS;UACTvB,aAAa;UACbgB,QAAQ;UACRN,gBAAgB;UAChBU;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","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createContentReviewUrl","params","key","console","log","baseUrl","contentReviewId","stepId","exports"],"sources":["contentReviewUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createContentReviewUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;\n};\n"],"mappings":";;;;;;AAKO,MAAMA,sBAAsB,GAAIC,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGN,MAAM;EAEnD,OAAQ,GAAEI,OAAQ,wBAAuBC,eAAgB,IAAGC,MAAO,EAAC;AACxE,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA"}
|
1
|
+
{"version":3,"names":["createContentReviewUrl","params","key","console","log","baseUrl","contentReviewId","stepId","exports"],"sources":["contentReviewUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createContentReviewUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;\n};\n"],"mappings":";;;;;;AAKO,MAAMA,sBAAsB,GAAIC,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGN,MAAM;EAEnD,OAAQ,GAAEI,OAAQ,wBAAuBC,eAAgB,IAAGC,MAAO,EAAC;AACxE,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ApwContentUrlPlugin","require","createContentUrl","params","plugins","contentReview","type","contentType","content","contentUrlPlugin","byType","ApwContentUrlPlugin","filter","plugin","canUse","reverse","create","exports"],"sources":["contentUrl.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { ApwContentUrlPlugin, ApwContentUrlPluginCbParams } from \"~/ApwContentUrlPlugin\";\n\ninterface Params extends ApwContentUrlPluginCbParams {\n plugins: PluginsContainer;\n}\n\nexport const createContentUrl = (params: Params): string | null => {\n const { plugins, contentReview } = params;\n\n const { type: contentType } = contentReview.content;\n\n const [contentUrlPlugin] = plugins\n .byType<ApwContentUrlPlugin>(ApwContentUrlPlugin.type)\n .filter(plugin => {\n return plugin.canUse(contentType);\n })\n .reverse();\n if (!contentUrlPlugin) {\n return null;\n }\n\n return contentUrlPlugin.create(params);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAMO,MAAMC,gBAAgB,GAAIC,MAAc,IAAoB;EAC/D,MAAM;IAAEC,OAAO;IAAEC;EAAc,CAAC,GAAGF,MAAM;EAEzC,MAAM;IAAEG,IAAI,EAAEC;EAAY,CAAC,GAAGF,aAAa,CAACG,OAAO;EAEnD,MAAM,CAACC,gBAAgB,CAAC,GAAGL,OAAO,CAC7BM,MAAM,CAAsBC,wCAAmB,CAACL,IAAI,CAAC,CACrDM,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACP,WAAW,CAAC;EACrC,CAAC,CAAC,CACDQ,OAAO,CAAC,CAAC;EACd,IAAI,CAACN,gBAAgB,EAAE;IACnB,OAAO,IAAI;EACf;EAEA,OAAOA,gBAAgB,CAACO,MAAM,CAACb,MAAM,CAAC;AAC1C,CAAC;AAACc,OAAA,CAAAf,gBAAA,GAAAA,gBAAA"}
|
1
|
+
{"version":3,"names":["_ApwContentUrlPlugin","require","createContentUrl","params","plugins","contentReview","type","contentType","content","contentUrlPlugin","byType","ApwContentUrlPlugin","filter","plugin","canUse","reverse","create","exports"],"sources":["contentUrl.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { ApwContentUrlPlugin, ApwContentUrlPluginCbParams } from \"~/ApwContentUrlPlugin\";\n\ninterface Params extends ApwContentUrlPluginCbParams {\n plugins: PluginsContainer;\n}\n\nexport const createContentUrl = (params: Params): string | null => {\n const { plugins, contentReview } = params;\n\n const { type: contentType } = contentReview.content;\n\n const [contentUrlPlugin] = plugins\n .byType<ApwContentUrlPlugin>(ApwContentUrlPlugin.type)\n .filter(plugin => {\n return plugin.canUse(contentType);\n })\n .reverse();\n if (!contentUrlPlugin) {\n return null;\n }\n\n return contentUrlPlugin.create(params);\n};\n"],"mappings":";;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAMO,MAAMC,gBAAgB,GAAIC,MAAc,IAAoB;EAC/D,MAAM;IAAEC,OAAO;IAAEC;EAAc,CAAC,GAAGF,MAAM;EAEzC,MAAM;IAAEG,IAAI,EAAEC;EAAY,CAAC,GAAGF,aAAa,CAACG,OAAO;EAEnD,MAAM,CAACC,gBAAgB,CAAC,GAAGL,OAAO,CAC7BM,MAAM,CAAsBC,wCAAmB,CAACL,IAAI,CAAC,CACrDM,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACP,WAAW,CAAC;EACrC,CAAC,CAAC,CACDQ,OAAO,CAAC,CAAC;EACd,IAAI,CAACN,gBAAgB,EAAE;IACnB,OAAO,IAAI;EACf;EAEA,OAAOA,gBAAgB,CAACO,MAAM,CAACb,MAAM,CAAC;AAC1C,CAAC;AAACc,OAAA,CAAAf,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ApwChangeRequestNotification","require","getLastChangeRequestNotificationPlugin","params","context","type","plugins","byType","ApwChangeRequestNotification","filter","plugin","canUse","shift","exports"],"sources":["lastChangeRequestNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\ninterface GetLastChangeRequestNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastChangeRequestNotificationPlugin {\n (params: GetLastChangeRequestNotificationPluginParams):\n | ApwChangeRequestNotification\n | undefined;\n}\nexport const getLastChangeRequestNotificationPlugin: GetLastChangeRequestNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwChangeRequestNotification>(ApwChangeRequestNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;AACA,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA"}
|
1
|
+
{"version":3,"names":["_ApwChangeRequestNotification","require","getLastChangeRequestNotificationPlugin","params","context","type","plugins","byType","ApwChangeRequestNotification","filter","plugin","canUse","shift","exports"],"sources":["lastChangeRequestNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\ninterface GetLastChangeRequestNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastChangeRequestNotificationPlugin {\n (params: GetLastChangeRequestNotificationPluginParams):\n | ApwChangeRequestNotification\n | undefined;\n}\nexport const getLastChangeRequestNotificationPlugin: GetLastChangeRequestNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwChangeRequestNotification>(ApwChangeRequestNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;AACA,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ApwCommentNotification","require","getLastCommentNotificationPlugin","params","context","type","plugins","byType","ApwCommentNotification","filter","plugin","canUse","shift","exports"],"sources":["lastCommentNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwCommentNotification } from \"~/ApwCommentNotification\";\n\ninterface GetLastCommentNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastCommentNotificationPlugin {\n (params: GetLastCommentNotificationPluginParams): ApwCommentNotification | undefined;\n}\nexport const getLastCommentNotificationPlugin: GetLastCommentNotificationPlugin = params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwCommentNotification>(ApwCommentNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n};\n"],"mappings":";;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA;AASO,MAAMC,gCAAkE,GAAGC,MAAM,IAAI;EACxF,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACH,IAAI,CAAC,CAC3DI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,gCAAA,GAAAA,gCAAA"}
|
1
|
+
{"version":3,"names":["_ApwCommentNotification","require","getLastCommentNotificationPlugin","params","context","type","plugins","byType","ApwCommentNotification","filter","plugin","canUse","shift","exports"],"sources":["lastCommentNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwCommentNotification } from \"~/ApwCommentNotification\";\n\ninterface GetLastCommentNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastCommentNotificationPlugin {\n (params: GetLastCommentNotificationPluginParams): ApwCommentNotification | undefined;\n}\nexport const getLastCommentNotificationPlugin: GetLastCommentNotificationPlugin = params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwCommentNotification>(ApwCommentNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n};\n"],"mappings":";;;;;;AACA,IAAAA,uBAAA,GAAAC,OAAA;AASO,MAAMC,gCAAkE,GAAGC,MAAM,IAAI;EACxF,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACH,IAAI,CAAC,CAC3DI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ApwContentReviewNotification","require","getLastContentReviewNotificationPlugin","params","context","type","plugins","byType","ApwContentReviewNotification","filter","plugin","canUse","shift","exports"],"sources":["lastContentReviewNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\ninterface GetLastContentReviewNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastContentReviewNotificationPlugin {\n (params: GetLastContentReviewNotificationPluginParams):\n | ApwContentReviewNotification\n | undefined;\n}\nexport const getLastContentReviewNotificationPlugin: GetLastContentReviewNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwContentReviewNotification>(ApwContentReviewNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;AACA,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA"}
|
1
|
+
{"version":3,"names":["_ApwContentReviewNotification","require","getLastContentReviewNotificationPlugin","params","context","type","plugins","byType","ApwContentReviewNotification","filter","plugin","canUse","shift","exports"],"sources":["lastContentReviewNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\ninterface GetLastContentReviewNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastContentReviewNotificationPlugin {\n (params: GetLastContentReviewNotificationPluginParams):\n | ApwContentReviewNotification\n | undefined;\n}\nexport const getLastContentReviewNotificationPlugin: GetLastContentReviewNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwContentReviewNotification>(ApwContentReviewNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;AACA,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getReviewerIdList","steps","reduce","collection","step","reviewer","reviewers","includes","id","push","exports","fetchReviewers","params","context","workflow","exclude","idList","security","withoutAuthorization","apw","list","where","id_in","limit","filter","item","email","identityId"],"sources":["reviewers.ts"],"sourcesContent":["import { ApwContext, ApwReviewerWithEmail, ApwWorkflow, ApwWorkflowStep } from \"~/types\";\n\ninterface GetReviewerIdListParams {\n steps: ApwWorkflowStep[];\n}\n\ninterface GetReviewerIdList {\n (params: GetReviewerIdListParams): string[];\n}\n\nexport const getReviewerIdList: GetReviewerIdList = ({ steps }) => {\n return steps.reduce<string[]>((collection, step) => {\n for (const reviewer of step.reviewers) {\n if (collection.includes(reviewer.id)) {\n return collection;\n }\n collection.push(reviewer.id);\n }\n\n return collection;\n }, []);\n};\n\ninterface FetchReviewersParams {\n context: ApwContext;\n workflow: ApwWorkflow;\n exclude: string[];\n}\n\nexport const fetchReviewers = async (\n params: FetchReviewersParams\n): Promise<ApwReviewerWithEmail[]> => {\n const { context, workflow, exclude } = params;\n\n const idList = getReviewerIdList(workflow);\n\n return context.security.withoutAuthorization(async () => {\n const [reviewers] = await context.apw.reviewer.list({\n where: {\n id_in: idList\n },\n limit: 10000\n });\n return reviewers.filter((item): item is ApwReviewerWithEmail => {\n if (!item.email) {\n return false;\n } else if (exclude.includes(item.identityId)) {\n return false;\n }\n\n return true;\n });\n });\n};\n"],"mappings":";;;;;;AAUO,MAAMA,iBAAoC,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAC/D,OAAOA,KAAK,CAACC,MAAM,CAAW,CAACC,UAAU,EAAEC,IAAI,KAAK;IAChD,KAAK,MAAMC,QAAQ,IAAID,IAAI,CAACE,SAAS,EAAE;MACnC,IAAIH,UAAU,CAACI,QAAQ,CAACF,QAAQ,CAACG,EAAE,CAAC,EAAE;QAClC,OAAOL,UAAU;MACrB;MACAA,UAAU,CAACM,IAAI,CAACJ,QAAQ,CAACG,EAAE,CAAC;IAChC;IAEA,OAAOL,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACO,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAQK,MAAMW,cAAc,GAAG,MAC1BC,MAA4B,IACM;EAClC,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE7C,MAAMI,MAAM,GAAGhB,iBAAiB,CAACc,QAAQ,CAAC;EAE1C,OAAOD,OAAO,CAACI,QAAQ,CAACC,oBAAoB,CAAC,YAAY;IACrD,MAAM,CAACZ,SAAS,CAAC,GAAG,MAAMO,OAAO,CAACM,GAAG,CAACd,QAAQ,CAACe,IAAI,CAAC;MAChDC,KAAK,EAAE;QACHC,KAAK,EAAEN;MACX,CAAC;MACDO,KAAK,EAAE;IACX,CAAC,CAAC;IACF,OAAOjB,SAAS,CAACkB,MAAM,CAAEC,IAAI,IAAmC;MAC5D,IAAI,CAACA,IAAI,CAACC,KAAK,EAAE;QACb,OAAO,KAAK;MAChB,CAAC,MAAM,IAAIX,OAAO,CAACR,QAAQ,CAACkB,IAAI,CAACE,UAAU,CAAC,EAAE;QAC1C,OAAO,KAAK;MAChB;MAEA,OAAO,IAAI;IACf,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACjB,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
|
1
|
+
{"version":3,"names":["getReviewerIdList","steps","reduce","collection","step","reviewer","reviewers","includes","id","push","exports","fetchReviewers","params","context","workflow","exclude","idList","security","withoutAuthorization","apw","list","where","id_in","limit","filter","item","email","identityId"],"sources":["reviewers.ts"],"sourcesContent":["import { ApwContext, ApwReviewerWithEmail, ApwWorkflow, ApwWorkflowStep } from \"~/types\";\n\ninterface GetReviewerIdListParams {\n steps: ApwWorkflowStep[];\n}\n\ninterface GetReviewerIdList {\n (params: GetReviewerIdListParams): string[];\n}\n\nexport const getReviewerIdList: GetReviewerIdList = ({ steps }) => {\n return steps.reduce<string[]>((collection, step) => {\n for (const reviewer of step.reviewers) {\n if (collection.includes(reviewer.id)) {\n return collection;\n }\n collection.push(reviewer.id);\n }\n\n return collection;\n }, []);\n};\n\ninterface FetchReviewersParams {\n context: ApwContext;\n workflow: ApwWorkflow;\n exclude: string[];\n}\n\nexport const fetchReviewers = async (\n params: FetchReviewersParams\n): Promise<ApwReviewerWithEmail[]> => {\n const { context, workflow, exclude } = params;\n\n const idList = getReviewerIdList(workflow);\n\n return context.security.withoutAuthorization(async () => {\n const [reviewers] = await context.apw.reviewer.list({\n where: {\n id_in: idList\n },\n limit: 10000\n });\n return reviewers.filter((item): item is ApwReviewerWithEmail => {\n if (!item.email) {\n return false;\n } else if (exclude.includes(item.identityId)) {\n return false;\n }\n\n return true;\n });\n });\n};\n"],"mappings":";;;;;;AAUO,MAAMA,iBAAoC,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAC/D,OAAOA,KAAK,CAACC,MAAM,CAAW,CAACC,UAAU,EAAEC,IAAI,KAAK;IAChD,KAAK,MAAMC,QAAQ,IAAID,IAAI,CAACE,SAAS,EAAE;MACnC,IAAIH,UAAU,CAACI,QAAQ,CAACF,QAAQ,CAACG,EAAE,CAAC,EAAE;QAClC,OAAOL,UAAU;MACrB;MACAA,UAAU,CAACM,IAAI,CAACJ,QAAQ,CAACG,EAAE,CAAC;IAChC;IAEA,OAAOL,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACO,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAQK,MAAMW,cAAc,GAAG,MAC1BC,MAA4B,IACM;EAClC,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE7C,MAAMI,MAAM,GAAGhB,iBAAiB,CAACc,QAAQ,CAAC;EAE1C,OAAOD,OAAO,CAACI,QAAQ,CAACC,oBAAoB,CAAC,YAAY;IACrD,MAAM,CAACZ,SAAS,CAAC,GAAG,MAAMO,OAAO,CAACM,GAAG,CAACd,QAAQ,CAACe,IAAI,CAAC;MAChDC,KAAK,EAAE;QACHC,KAAK,EAAEN;MACX,CAAC;MACDO,KAAK,EAAE;IACX,CAAC,CAAC;IACF,OAAOjB,SAAS,CAACkB,MAAM,CAAEC,IAAI,IAAmC;MAC5D,IAAI,CAACA,IAAI,CAACC,KAAK,EAAE;QACb,OAAO,KAAK;MAChB,CAAC,MAAM,IAAIX,OAAO,CAACR,QAAQ,CAACkB,IAAI,CAACE,UAAU,CAAC,EAAE;QAC1C,OAAO,KAAK;MAChB;MAEA,OAAO,IAAI;IACf,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACjB,OAAA,CAAAC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_lastChangeRequestNotificationPlugin","require","sendChangeRequestNotification","params","context","reviewers","contentReview","length","changeRequestPlugin","getLastChangeRequestNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendChangeRequestNotification.ts"],"sourcesContent":["import { getLastChangeRequestNotificationPlugin } from \"./lastChangeRequestNotificationPlugin\";\nimport { ApwChangeRequestNotificationCbParams } from \"~/ApwChangeRequestNotification\";\n\nexport const sendChangeRequestNotification = async (\n params: ApwChangeRequestNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const changeRequestPlugin = getLastChangeRequestNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!changeRequestPlugin) {\n console.log(\"No e-mail body change request plugin.\");\n return;\n }\n\n const body = changeRequestPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new change request on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0EAA0E;IACnFC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA"}
|
1
|
+
{"version":3,"names":["_lastChangeRequestNotificationPlugin","require","sendChangeRequestNotification","params","context","reviewers","contentReview","length","changeRequestPlugin","getLastChangeRequestNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendChangeRequestNotification.ts"],"sourcesContent":["import { getLastChangeRequestNotificationPlugin } from \"./lastChangeRequestNotificationPlugin\";\nimport { ApwChangeRequestNotificationCbParams } from \"~/ApwChangeRequestNotification\";\n\nexport const sendChangeRequestNotification = async (\n params: ApwChangeRequestNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const changeRequestPlugin = getLastChangeRequestNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!changeRequestPlugin) {\n console.log(\"No e-mail body change request plugin.\");\n return;\n }\n\n const body = changeRequestPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new change request on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0EAA0E;IACnFC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_lastCommentNotificationPlugin","require","sendCommentNotification","params","context","reviewers","contentReview","length","commentPlugin","getLastCommentNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendCommentNotification.ts"],"sourcesContent":["import { getLastCommentNotificationPlugin } from \"./lastCommentNotificationPlugin\";\nimport { ApwCommentNotificationCbParams } from \"~/ApwCommentNotification\";\n\nexport const sendCommentNotification = async (\n params: ApwCommentNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const commentPlugin = getLastCommentNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!commentPlugin) {\n console.log(\"No e-mail body comment plugin.\");\n return;\n }\n\n const body = commentPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new comment on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AAGO,MAAMC,uBAAuB,GAAG,MACnCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,aAAa,GAAG,IAAAC,+DAAgC,EAAC;IACnDL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,aAAa,EAAE;IAChBI,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAC7C;EACJ;EAEA,MAAMC,IAAI,GAAGN,aAAa,CAACO,MAAM,CAACZ,MAAM,CAAC;EACzC,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,2CAA0CL,aAAa,CAACQ,IAAK,EAAC,CAAC;IAC5E;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,mEAAmE;IAC5EC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,uBAAA,GAAAA,uBAAA"}
|
1
|
+
{"version":3,"names":["_lastCommentNotificationPlugin","require","sendCommentNotification","params","context","reviewers","contentReview","length","commentPlugin","getLastCommentNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendCommentNotification.ts"],"sourcesContent":["import { getLastCommentNotificationPlugin } from \"./lastCommentNotificationPlugin\";\nimport { ApwCommentNotificationCbParams } from \"~/ApwCommentNotification\";\n\nexport const sendCommentNotification = async (\n params: ApwCommentNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const commentPlugin = getLastCommentNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!commentPlugin) {\n console.log(\"No e-mail body comment plugin.\");\n return;\n }\n\n const body = commentPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new comment on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AAGO,MAAMC,uBAAuB,GAAG,MACnCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,aAAa,GAAG,IAAAC,+DAAgC,EAAC;IACnDL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,aAAa,EAAE;IAChBI,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAC7C;EACJ;EAEA,MAAMC,IAAI,GAAGN,aAAa,CAACO,MAAM,CAACZ,MAAM,CAAC;EACzC,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,2CAA0CL,aAAa,CAACQ,IAAK,EAAC,CAAC;IAC5E;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,mEAAmE;IAC5EC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_lastContentReviewNotificationPlugin","require","sendContentReviewNotification","params","context","reviewers","contentReview","length","contentReviewPlugin","getLastContentReviewNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendContentReviewNotification.ts"],"sourcesContent":["import { getLastContentReviewNotificationPlugin } from \"./lastContentReviewNotificationPlugin\";\nimport { ApwContentReviewNotificationCbParams } from \"~/ApwContentReviewNotification\";\n\nexport const sendContentReviewNotification = async (\n params: ApwContentReviewNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const contentReviewPlugin = getLastContentReviewNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!contentReviewPlugin) {\n console.log(\"No e-mail body content review plugin.\");\n return;\n }\n\n const body = contentReviewPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new content review which you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA"}
|
1
|
+
{"version":3,"names":["_lastContentReviewNotificationPlugin","require","sendContentReviewNotification","params","context","reviewers","contentReview","length","contentReviewPlugin","getLastContentReviewNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify","exports"],"sources":["sendContentReviewNotification.ts"],"sourcesContent":["import { getLastContentReviewNotificationPlugin } from \"./lastContentReviewNotificationPlugin\";\nimport { ApwContentReviewNotificationCbParams } from \"~/ApwContentReviewNotification\";\n\nexport const sendContentReviewNotification = async (\n params: ApwContentReviewNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const contentReviewPlugin = getLastContentReviewNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!contentReviewPlugin) {\n console.log(\"No e-mail body content review plugin.\");\n return;\n }\n\n const body = contentReviewPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new content review which you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
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,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAQ,KAAK,IAAI,EAAE;MACjC;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMlB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;MACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;MACxBC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFW,GAAG,CAACC,aAAa,CAACK,0BAA0B,CAACH,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,MAAMf,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;MACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;MACxBC,KAAK,EAAE;IACX,CAAC,CAAC;EACN,CAAC,CAAC;EAEFW,GAAG,CAACC,aAAa,CAACM,0BAA0B,CAACJ,SAAS,CAAC,OAAO;IAAEF,aAAa;IAAEO;EAAS,CAAC,KAAK;IAC1F;AACR;AACA;AACA;IACQ,IAAIA,QAAQ,CAACJ,QAAQ,KAAKH,aAAa,CAACG,QAAQ,EAAE;MAC9C,MAAMA,QAAQ,GAAGH,aAAa,CAACG,QAAQ;MACvC,MAAMf,KAAK,GAAGe,QAAQ,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;MAExC,MAAMlB,2BAA2B,CAAC;QAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;QACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;QACxBC;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAV,gCAAA,GAAAA,gCAAA"}
|
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,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAQ,KAAK,IAAI,EAAE;MACjC;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMlB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;MACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;MACxBC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFW,GAAG,CAACC,aAAa,CAACK,0BAA0B,CAACH,SAAS,CAA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