@webiny/api-apw 5.43.3 → 6.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApwChangeRequestNotification.d.ts +1 -1
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.d.ts +1 -1
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.d.ts +1 -1
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.d.ts +1 -1
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.d.ts +1 -1
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.d.ts +1 -1
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.d.ts +1 -1
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.d.ts +2 -2
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.d.ts +1 -1
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.d.ts +1 -1
- package/crud/index.js.map +1 -1
- package/crud/utils.d.ts +2 -2
- package/crud/utils.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +4 -5
- package/index.js.map +1 -1
- package/package.json +23 -24
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.d.ts +2 -2
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.d.ts +4 -4
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/triggerContentReview.d.ts +2 -2
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +2 -2
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +3 -3
- package/plugins/context.js +3 -14
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.d.ts +1 -1
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.d.ts +1 -1
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.d.ts +1 -1
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.d.ts +1 -1
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.d.ts +1 -1
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.d.ts +1 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.d.ts +1 -1
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +1 -1
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.d.ts +3 -3
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +2 -2
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +2 -2
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +2 -2
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.d.ts +2 -2
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/getAppUrl.d.ts +2 -0
- package/plugins/hooks/notifications/getAppUrl.js +19 -0
- package/plugins/hooks/notifications/getAppUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.d.ts +1 -1
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.d.ts +1 -1
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.d.ts +1 -1
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.d.ts +1 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.d.ts +1 -1
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/utils.d.ts +4 -3
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.d.ts +1 -1
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +3 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.d.ts +2 -2
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/index.d.ts +1 -1
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +5 -5
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.d.ts +2 -2
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +2 -2
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +3 -3
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.d.ts +1 -1
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/utils.d.ts +2 -2
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +1 -1
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +2 -2
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.d.ts +2 -2
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.d.ts +2 -2
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +13 -30
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.d.ts +2 -2
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/fieldResolver.d.ts +2 -2
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +1 -1
- package/utils/pickEntryFieldValues.js.map +1 -1
- package/utils/resolve.d.ts +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +0 -2
- package/plugins/hooks/notifications/appUrl.js +0 -20
- package/plugins/hooks/notifications/appUrl.js.map +0 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -36
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -28
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -22
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
- package/plugins/pageBuilder/index.d.ts +0 -11
- package/plugins/pageBuilder/index.js +0 -44
- package/plugins/pageBuilder/index.js.map +0 -1
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkContentReviewToPage.js +0 -93
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkWorkflowToPage.js +0 -165
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -33
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +0 -33
- package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -33
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +0 -49
- package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
- package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
- package/plugins/pageBuilder/triggerContentReview.js +0 -40
- package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
- package/plugins/pageBuilder/updateContentReviewStatus.js +0 -70
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
- package/plugins/pageBuilder/utils.d.ts +0 -22
- package/plugins/pageBuilder/utils.js +0 -151
- package/plugins/pageBuilder/utils.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_plugins","require","_handlerGraphql","_types","_resolve","_interopRequireDefault","_utils","contentReviewSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwContentReviewContent","version","parent","_","context","getContent","apw","getContentGetter","type","content","id","settings","publishedOn","lastPublishedOn","publishedBy","reviewer","list","where","identityId","scheduledBy","ApwContentReviewListItem","activeStep","steps","find","step","status","ApwContentReviewStepStatus","ACTIVE","totalComments","reduce","count","isNaN","reviewers","reviewerIds","includes","push","ApwQuery","getContentReview","args","resolve","contentReview","get","listContentReviews","entries","meta","ListResponse","e","ErrorResponse","isReviewRequired","data","ApwMutation","createContentReview","create","deleteContentReview","delete","provideSignOff","retractSignOff","publishContent","datetime","unpublishContent","deleteScheduledAction","_default","exports","default"],"sources":["contentReview.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport {\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwContext,\n ApwContentReviewListParams,\n ApwContentReviewContent\n} from \"~/types\";\nimport resolve from \"~/utils/resolve\";\nimport { onByFields, dateTimeFieldsSorters } from \"./utils\";\n\nconst contentReviewSchema = new GraphQLSchemaPlugin<ApwContext>({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type ApwContentReviewListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n reviewStatus: ApwContentReviewStatus\n activeStep: ApwContentReviewStep\n totalComments: Int\n latestCommentId: String\n reviewers: [ID!]!\n }\n\n type ApwListContentReviewsResponse {\n data: [ApwContentReviewListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwContentReviewReviewer {\n id: ID\n displayName: String\n }\n\n type ApwContentReviewComment {\n body: JSON\n author: String\n }\n\n type ApwContentReviewChangeRequested {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewComment]\n }\n\n enum ApwContentReviewStepStatus {\n done\n active\n inactive\n }\n\n enum ApwContentReviewStatus {\n underReview\n readyToBePublished\n published\n requiresMyAttention\n }\n\n type ApwContentReviewStep {\n status: ApwContentReviewStepStatus\n id: String\n title: String\n pendingChangeRequests: Int\n signOffProvidedOn: DateTime\n signOffProvidedBy: ApwIdentity\n }\n\n type ApwContentReview {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n workflow: ID\n reviewStatus: ApwContentReviewStatus\n }\n\n type ApwContentReviewResponse {\n data: ApwContentReview\n error: ApwError\n }\n\n type ApwDeleteContentReviewResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListContentReviewsSort {\n id_ASC\n id_DESC\n\n ${dateTimeFieldsSorters}\n \n title_ASC\n title_DESC\n }\n\n input ApwContentReviewReviewerInput {\n id: ID\n }\n\n input ApwContentReviewScopeInput {\n type: String\n options: JSON\n }\n\n input ApwContentReviewCommentInput {\n body: JSON\n author: String\n }\n\n input ApwContentReviewChangeRequestedInput {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewCommentInput]\n }\n\n enum ApwContentReviewContentTypes {\n page\n cms_entry\n }\n\n type ApwContentReviewContentSettings {\n modelId: String\n }\n\n input ApwContentReviewContentSettingsInput {\n modelId: String\n }\n\n type ApwContentReviewContent {\n id: ID!\n type: ApwContentReviewContentTypes!\n version: Int!\n settings: ApwContentReviewContentSettings\n publishedOn: String\n publishedBy: ApwIdentity\n scheduledOn: DateTime\n scheduledBy: ApwIdentity\n }\n\n input ApwContentReviewContentInput {\n id: ID!\n type: ApwContentReviewContentTypes!\n settings: ApwContentReviewContentSettingsInput\n }\n\n input ApwCreateContentReviewInput {\n content: ApwContentReviewContentInput!\n }\n\n input ApwListContentReviewsWhereInput {\n id: ID\n reviewStatus: ApwContentReviewStatus\n title: String\n title_contains: String\n }\n\n type ApwProvideSignOffResponse {\n data: Boolean\n error: ApwError\n }\n\n type ApwIsReviewRequiredData {\n isReviewRequired: Boolean\n contentReviewId: ID\n }\n\n type ApwIsReviewRequiredResponse {\n data: ApwIsReviewRequiredData\n error: ApwError\n }\n\n type ApwPublishContentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwContentActions {\n publish\n unpublish\n }\n\n type ApwScheduleActionResponse {\n data: Boolean\n error: ApwError\n }\n\n input ApwScheduleActionInput {\n action: ApwContentActions!\n datetime: String!\n type: ApwContentReviewContentTypes!\n entryId: ID!\n }\n\n extend type ApwQuery {\n getContentReview(id: ID!): ApwContentReviewResponse\n\n listContentReviews(\n where: ApwListContentReviewsWhereInput\n limit: Int\n after: String\n sort: [ApwListContentReviewsSort!]\n ): ApwListContentReviewsResponse\n\n isReviewRequired(data: ApwContentReviewContentInput!): ApwIsReviewRequiredResponse\n }\n\n extend type ApwMutation {\n createContentReview(data: ApwCreateContentReviewInput!): ApwContentReviewResponse\n\n deleteContentReview(id: ID!): ApwDeleteContentReviewResponse\n\n provideSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n retractSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n publishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n unpublishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n scheduleAction(data: ApwScheduleActionInput!): ApwScheduleActionResponse\n\n deleteScheduledAction(id: ID!): ApwScheduleActionResponse\n }\n `,\n resolvers: {\n ApwContentReviewContent: {\n version: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.version;\n },\n publishedOn: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n\n // In case a page was returned, let's read the `publishedOn` field.\n if (\"publishedOn\" in content) {\n return content.publishedOn;\n }\n\n // In case a CMS entry was returned, let's read the entry-level `lastPublishedOn` field.\n return content.lastPublishedOn;\n },\n publishedBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.publishedBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n },\n scheduledBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.scheduledBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n }\n },\n ApwContentReviewListItem: {\n activeStep: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.find(step => step.status === ApwContentReviewStepStatus.ACTIVE);\n },\n totalComments: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.reduce((count, step) => {\n /**\n * Aggregate totalComments from each step.\n */\n if (!isNaN(step.totalComments)) {\n count += step.totalComments;\n }\n\n return count;\n }, 0);\n },\n reviewers: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n const reviewerIds: string[] = [];\n\n for (const step of steps) {\n for (const reviewer of step.reviewers) {\n if (!reviewerIds.includes(reviewer.id)) {\n reviewerIds.push(reviewer.id);\n }\n }\n }\n return reviewerIds;\n }\n },\n ApwQuery: {\n getContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.get(args.id));\n },\n listContentReviews: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwContentReviewListParams.\n */\n const [entries, meta] = await context.apw.contentReview.list(\n args as unknown as ApwContentReviewListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n isReviewRequired: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.isReviewRequired(args.data));\n }\n },\n ApwMutation: {\n createContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.create(args.data));\n },\n deleteContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.delete(args.id));\n },\n provideSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.provideSignOff(args.id, args.step));\n },\n retractSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.retractSignOff(args.id, args.step));\n },\n publishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.publishContent(args.id, args.datetime)\n );\n },\n unpublishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.unpublishContent(args.id, args.datetime)\n );\n },\n deleteScheduledAction: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.deleteScheduledAction(args.id));\n }\n }\n }\n});\n\nexport default contentReviewSchema;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,mBAAmB,GAAG,IAAIC,4BAAmB,CAAa;EAC5D;EACAC,QAAQ,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;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,cAAcA,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAqB;AACnC;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;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,uBAAuB,EAAE;MACrBC,OAAO,EAAE,MAAAA,CAAOC,MAA+B,EAAEC,CAAC,EAAEC,OAAmB,KAAK;QACxE,MAAMC,UAAU,GAAGD,OAAO,CAACE,GAAG,CAACC,gBAAgB,CAACL,MAAM,CAACM,IAAI,CAAC;QAC5D,MAAMC,OAAO,GAAG,MAAMJ,UAAU,CAACH,MAAM,CAACQ,EAAE,EAAER,MAAM,CAACS,QAAQ,CAAC;QAC5D,IAAI,CAACF,OAAO,EAAE;UACV,OAAO,IAAI;QACf;QACA,OAAOA,OAAO,CAACR,OAAO;MAC1B,CAAC;MACDW,WAAW,EAAE,MAAAA,CAAOV,MAA+B,EAAEC,CAAC,EAAEC,OAAmB,KAAK;QAC5E,MAAMC,UAAU,GAAGD,OAAO,CAACE,GAAG,CAACC,gBAAgB,CAACL,MAAM,CAACM,IAAI,CAAC;QAC5D,MAAMC,OAAO,GAAG,MAAMJ,UAAU,CAACH,MAAM,CAACQ,EAAE,EAAER,MAAM,CAACS,QAAQ,CAAC;QAC5D,IAAI,CAACF,OAAO,EAAE;UACV,OAAO,IAAI;QACf;;QAEA;QACA,IAAI,aAAa,IAAIA,OAAO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XnC,OAAO,CAACE,GAAG,CAACkC,aAAa,CAACiB,cAAc,CAACnB,IAAI,CAAC5B,EAAE,EAAE4B,IAAI,CAACoB,QAAQ,CACnE,CAAC;MACL,CAAC;MACDC,gBAAgB,EAAE,MAAAA,CAAOxD,CAAC,EAAEmC,IAAS,EAAElC,OAAO,KAAK;QAC/C,OAAO,IAAAmC,gBAAO,EAAC,MACXnC,OAAO,CAACE,GAAG,CAACkC,aAAa,CAACmB,gBAAgB,CAACrB,IAAI,CAAC5B,EAAE,EAAE4B,IAAI,CAACoB,QAAQ,CACrE,CAAC;MACL,CAAC;MACDE,qBAAqB,EAAE,MAAAA,CAAOzD,CAAC,EAAEmC,IAAS,EAAElC,OAAO,KAAK;QACpD,OAAO,IAAAmC,gBAAO,EAAC,MAAMnC,OAAO,CAACE,GAAG,CAACkC,aAAa,CAACoB,qBAAqB,CAACtB,IAAI,CAAC5B,EAAE,CAAC,CAAC;MAClF;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYrE,mBAAmB","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_plugins","require","_handlerGraphql","_types","_resolve","_interopRequireDefault","_utils","contentReviewSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwContentReviewContent","version","parent","_","context","getContent","apw","getContentGetter","type","content","id","settings","publishedOn","lastPublishedOn","publishedBy","reviewer","list","where","identityId","scheduledBy","ApwContentReviewListItem","activeStep","steps","find","step","status","ApwContentReviewStepStatus","ACTIVE","totalComments","reduce","count","isNaN","reviewers","reviewerIds","includes","push","ApwQuery","getContentReview","args","resolve","contentReview","get","listContentReviews","entries","meta","ListResponse","e","ErrorResponse","isReviewRequired","data","ApwMutation","createContentReview","create","deleteContentReview","delete","provideSignOff","retractSignOff","publishContent","datetime","unpublishContent","deleteScheduledAction","_default","exports","default"],"sources":["contentReview.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport type {\n ApwContentReviewStep,\n ApwContext,\n ApwContentReviewListParams,\n ApwContentReviewContent\n} from \"~/types\";\nimport { ApwContentReviewStepStatus } from \"~/types\";\nimport resolve from \"~/utils/resolve\";\nimport { onByFields, dateTimeFieldsSorters } from \"./utils\";\n\nconst contentReviewSchema = new GraphQLSchemaPlugin<ApwContext>({\n // Had to remove /* GraphQL */ because prettier would not format the code correctly.\n typeDefs: `\n type ApwContentReviewListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n reviewStatus: ApwContentReviewStatus\n activeStep: ApwContentReviewStep\n totalComments: Int\n latestCommentId: String\n reviewers: [ID!]!\n }\n\n type ApwListContentReviewsResponse {\n data: [ApwContentReviewListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwContentReviewReviewer {\n id: ID\n displayName: String\n }\n\n type ApwContentReviewComment {\n body: JSON\n author: String\n }\n\n type ApwContentReviewChangeRequested {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewComment]\n }\n\n enum ApwContentReviewStepStatus {\n done\n active\n inactive\n }\n\n enum ApwContentReviewStatus {\n underReview\n readyToBePublished\n published\n requiresMyAttention\n }\n\n type ApwContentReviewStep {\n status: ApwContentReviewStepStatus\n id: String\n title: String\n pendingChangeRequests: Int\n signOffProvidedOn: DateTime\n signOffProvidedBy: ApwIdentity\n }\n\n type ApwContentReview {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # ContentReview specific fields\n title: String\n steps: [ApwContentReviewStep]\n content: ApwContentReviewContent\n workflow: ID\n reviewStatus: ApwContentReviewStatus\n }\n\n type ApwContentReviewResponse {\n data: ApwContentReview\n error: ApwError\n }\n\n type ApwDeleteContentReviewResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListContentReviewsSort {\n id_ASC\n id_DESC\n\n ${dateTimeFieldsSorters}\n \n title_ASC\n title_DESC\n }\n\n input ApwContentReviewReviewerInput {\n id: ID\n }\n\n input ApwContentReviewScopeInput {\n type: String\n options: JSON\n }\n\n input ApwContentReviewCommentInput {\n body: JSON\n author: String\n }\n\n input ApwContentReviewChangeRequestedInput {\n title: String\n body: JSON\n media: JSON\n step: String\n resolved: Boolean\n comments: [ApwContentReviewCommentInput]\n }\n\n enum ApwContentReviewContentTypes {\n page\n cms_entry\n }\n\n type ApwContentReviewContentSettings {\n modelId: String\n }\n\n input ApwContentReviewContentSettingsInput {\n modelId: String\n }\n\n type ApwContentReviewContent {\n id: ID!\n type: ApwContentReviewContentTypes!\n version: Int!\n settings: ApwContentReviewContentSettings\n publishedOn: String\n publishedBy: ApwIdentity\n scheduledOn: DateTime\n scheduledBy: ApwIdentity\n }\n\n input ApwContentReviewContentInput {\n id: ID!\n type: ApwContentReviewContentTypes!\n settings: ApwContentReviewContentSettingsInput\n }\n\n input ApwCreateContentReviewInput {\n content: ApwContentReviewContentInput!\n }\n\n input ApwListContentReviewsWhereInput {\n id: ID\n reviewStatus: ApwContentReviewStatus\n title: String\n title_contains: String\n }\n\n type ApwProvideSignOffResponse {\n data: Boolean\n error: ApwError\n }\n\n type ApwIsReviewRequiredData {\n isReviewRequired: Boolean\n contentReviewId: ID\n }\n\n type ApwIsReviewRequiredResponse {\n data: ApwIsReviewRequiredData\n error: ApwError\n }\n\n type ApwPublishContentResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwContentActions {\n publish\n unpublish\n }\n\n type ApwScheduleActionResponse {\n data: Boolean\n error: ApwError\n }\n\n input ApwScheduleActionInput {\n action: ApwContentActions!\n datetime: String!\n type: ApwContentReviewContentTypes!\n entryId: ID!\n }\n\n extend type ApwQuery {\n getContentReview(id: ID!): ApwContentReviewResponse\n\n listContentReviews(\n where: ApwListContentReviewsWhereInput\n limit: Int\n after: String\n sort: [ApwListContentReviewsSort!]\n ): ApwListContentReviewsResponse\n\n isReviewRequired(data: ApwContentReviewContentInput!): ApwIsReviewRequiredResponse\n }\n\n extend type ApwMutation {\n createContentReview(data: ApwCreateContentReviewInput!): ApwContentReviewResponse\n\n deleteContentReview(id: ID!): ApwDeleteContentReviewResponse\n\n provideSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n retractSignOff(id: ID!, step: String!): ApwProvideSignOffResponse\n\n publishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n unpublishContent(id: ID!, datetime: String): ApwPublishContentResponse\n\n scheduleAction(data: ApwScheduleActionInput!): ApwScheduleActionResponse\n\n deleteScheduledAction(id: ID!): ApwScheduleActionResponse\n }\n `,\n resolvers: {\n ApwContentReviewContent: {\n version: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n return content.version;\n },\n publishedOn: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const getContent = context.apw.getContentGetter(parent.type);\n const content = await getContent(parent.id, parent.settings);\n if (!content) {\n return null;\n }\n\n // In case a page was returned, let's read the `publishedOn` field.\n if (\"publishedOn\" in content) {\n return content.publishedOn;\n }\n\n // In case a CMS entry was returned, let's read the entry-level `lastPublishedOn` field.\n return content.lastPublishedOn;\n },\n publishedBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.publishedBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n },\n scheduledBy: async (parent: ApwContentReviewContent, _, context: ApwContext) => {\n const id = parent.scheduledBy;\n if (id) {\n const [[reviewer]] = await context.apw.reviewer.list({\n where: { identityId: id }\n });\n return reviewer;\n }\n return null;\n }\n },\n ApwContentReviewListItem: {\n activeStep: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.find(step => step.status === ApwContentReviewStepStatus.ACTIVE);\n },\n totalComments: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n return steps.reduce((count, step) => {\n /**\n * Aggregate totalComments from each step.\n */\n if (!isNaN(step.totalComments)) {\n count += step.totalComments;\n }\n\n return count;\n }, 0);\n },\n reviewers: async parent => {\n const steps: ApwContentReviewStep[] = parent.steps;\n const reviewerIds: string[] = [];\n\n for (const step of steps) {\n for (const reviewer of step.reviewers) {\n if (!reviewerIds.includes(reviewer.id)) {\n reviewerIds.push(reviewer.id);\n }\n }\n }\n return reviewerIds;\n }\n },\n ApwQuery: {\n getContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.get(args.id));\n },\n listContentReviews: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwContentReviewListParams.\n */\n const [entries, meta] = await context.apw.contentReview.list(\n args as unknown as ApwContentReviewListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n isReviewRequired: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.isReviewRequired(args.data));\n }\n },\n ApwMutation: {\n createContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.create(args.data));\n },\n deleteContentReview: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.delete(args.id));\n },\n provideSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.provideSignOff(args.id, args.step));\n },\n retractSignOff: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.retractSignOff(args.id, args.step));\n },\n publishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.publishContent(args.id, args.datetime)\n );\n },\n unpublishContent: async (_, args: any, context) => {\n return resolve(() =>\n context.apw.contentReview.unpublishContent(args.id, args.datetime)\n );\n },\n deleteScheduledAction: async (_, args: any, context) => {\n return resolve(() => context.apw.contentReview.deleteScheduledAction(args.id));\n }\n }\n }\n});\n\nexport default contentReviewSchema;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,mBAAmB,GAAG,IAAIC,4BAAmB,CAAa;EAC5D;EACAC,QAAQ,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;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,cAAcA,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAqB;AACnC;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;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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AC;MACL,CAAC;MACDE,qBAAqB,EAAE,MAAAA,CAAOzD,CAAC,EAAEmC,IAAS,EAAElC,OAAO,KAAK;QACpD,OAAO,IAAAmC,gBAAO,EAAC,MAAMnC,OAAO,CAACE,GAAG,CAACkC,aAAa,CAACoB,qBAAqB,CAACtB,IAAI,CAAC5B,EAAE,CAAC,CAAC;MAClF;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYrE,mBAAmB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_plugins","require","_handlerGraphql","_resolve","_interopRequireDefault","_utils","workflowSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse","_default","exports","default"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { ApwContext, ApwReviewerListParams } 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 ApwReviewerListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwListReviewersResponse {\n data: [ApwReviewerListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwReviewer {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwReviewerResponse {\n data: ApwReviewer\n error: ApwError\n }\n\n type ApwDeleteReviewerResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListReviewersSort {\n id_ASC\n id_DESC\n\n ${dateTimeFieldsSorters}\n \n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwListReviewersWhereInput {\n identityId: ID\n }\n\n input ApwListReviewersSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n extend type ApwQuery {\n getReviewer(id: ID!): ApwReviewerResponse\n\n listReviewers(\n where: ApwListReviewersWhereInput\n limit: Int\n after: String\n sort: [ApwListReviewersSort!]\n search: ApwListReviewersSearchInput\n ): ApwListReviewersResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getReviewer: async (_, args: any, context) => {\n return resolve(() => context.apw.reviewer.get(args.id));\n },\n listReviewers: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwReviewerListParams.\n */\n const [entries, meta] = await context.apw.reviewer.list(\n args as unknown as ApwReviewerListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\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,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcA,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAqB;AACnC;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,QAAQ,EAAE;MACNC,WAAW,EAAE,MAAAA,CAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC1C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACC,GAAG,CAACL,IAAI,CAACM,EAAE,CAAC,CAAC;MAC3D,CAAC;MACDC,aAAa,EAAE,MAAAA,CAAOR,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMR,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACM,IAAI,CACnDV,IACJ,CAAC;UACD,OAAO,IAAIW,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYzB,cAAc","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_plugins","require","_handlerGraphql","_resolve","_interopRequireDefault","_utils","workflowSchema","GraphQLSchemaPlugin","typeDefs","onByFields","dateTimeFieldsSorters","resolvers","ApwQuery","getReviewer","_","args","context","resolve","apw","reviewer","get","id","listReviewers","entries","meta","list","ListResponse","e","ErrorResponse","_default","exports","default"],"sources":["reviewer.gql.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport type { ApwContext, ApwReviewerListParams } 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 ApwReviewerListItem {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwListReviewersResponse {\n data: [ApwReviewerListItem]\n error: ApwError\n meta: ApwMeta\n }\n\n type ApwReviewer {\n # System generated fields\n id: ID\n \n ${onByFields}\n \n # Reviewer specific fields\n identityId: ID\n displayName: String\n type: String\n email: String\n }\n\n type ApwReviewerResponse {\n data: ApwReviewer\n error: ApwError\n }\n\n type ApwDeleteReviewerResponse {\n data: Boolean\n error: ApwError\n }\n\n enum ApwListReviewersSort {\n id_ASC\n id_DESC\n\n ${dateTimeFieldsSorters}\n \n publishedOn_ASC\n publishedOn_DESC\n title_ASC\n title_DESC\n }\n\n input ApwListReviewersWhereInput {\n identityId: ID\n }\n\n input ApwListReviewersSearchInput {\n # By specifying \"query\", the search will be performed against workflow' \"title\" field.\n query: String\n }\n\n extend type ApwQuery {\n getReviewer(id: ID!): ApwReviewerResponse\n\n listReviewers(\n where: ApwListReviewersWhereInput\n limit: Int\n after: String\n sort: [ApwListReviewersSort!]\n search: ApwListReviewersSearchInput\n ): ApwListReviewersResponse\n }\n `,\n resolvers: {\n ApwQuery: {\n getReviewer: async (_, args: any, context) => {\n return resolve(() => context.apw.reviewer.get(args.id));\n },\n listReviewers: async (_, args: any, context) => {\n try {\n /**\n * We know that args is ApwReviewerListParams.\n */\n const [entries, meta] = await context.apw.reviewer.list(\n args as unknown as ApwReviewerListParams\n );\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\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,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcA,iBAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAcC,4BAAqB;AACnC;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,QAAQ,EAAE;MACNC,WAAW,EAAE,MAAAA,CAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC1C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACC,GAAG,CAACL,IAAI,CAACM,EAAE,CAAC,CAAC;MAC3D,CAAC;MACDC,aAAa,EAAE,MAAAA,CAAOR,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACO,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMR,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACM,IAAI,CACnDV,IACJ,CAAC;UACD,OAAO,IAAIW,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ;EACJ;AACJ,CAAC,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYzB,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,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;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,iBAAU;AACxB;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,4BAAqB;AACnC;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;A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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":[]}
|
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 type { 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,EAAE;AACd;AACA;AACA;AACA;AACA,cAAcC,iBAAU;AACxB;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,iBAAU;AACxB;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,4BAAqB;AACnC;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;IACJ,CAAC;IACDC,QAAQ,EAAE;MACNC,WAAW,EAAE,MAAAA,CAAOC,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC1C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACC,GAAG,CAACL,IAAI,CAACJ,EAAE,CAAC,CAAC;MAC3D,CAAC;MACDU,aAAa,EAAE,MAAAA,CAAOP,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC5C,IAAI;UACA;AACpB;AACA;UACoB,MAAM,CAACM,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMP,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACK,IAAI,CACnDT,IACJ,CAAC;UACD,OAAO,IAAIU,4BAAY,CAACH,OAAO,EAAEC,IAAI,CAAC;QAC1C,CAAC,CAAC,OAAOG,CAAC,EAAE;UACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;QAC/B;MACJ;IACJ,CAAC;IACDE,WAAW,EAAE;MACTC,cAAc,EAAE,MAAAA,CAAOf,CAAC,EAAEC,IAAS,EAAEC,OAAO,KAAK;QAC7C,OAAO,IAAAC,gBAAO,EAAC,MAAMD,OAAO,CAACE,GAAG,CAACC,QAAQ,CAACW,MAAM,CAACf,IAAI,CAACgB,IAAI,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.d.ts
CHANGED
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,aAAc;AAC5B;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
|
+
{"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 type { 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,aAAc;AAC5B;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,2 +1,2 @@
|
|
1
|
-
import { LifeCycleHookCallbackParams } from "../../types";
|
1
|
+
import type { LifeCycleHookCallbackParams } from "../../types";
|
2
2
|
export declare const createReviewerFromIdentity: ({ security, apw }: LifeCycleHookCallbackParams) => void;
|
@@ -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;Q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;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","ignoreList":[]}
|
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 type { 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,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,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,CAAC,+CAA+Cd,QAAQ,CAACI,EAAE,EAAE,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","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { LifeCycleHookCallbackParams } from "../../types";
|
1
|
+
import type { LifeCycleHookCallbackParams } from "../../types";
|
2
2
|
export declare const deleteChangeRequestsWithContentReview: ({ apw }: Pick<LifeCycleHookCallbackParams, "apw">) => void;
|
@@ -1 +1 @@
|
|
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,EAAE,GAAGd,aAAa,CAACM,EAAE,IAAIC,MAAM;YACvC;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
|
+
{"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 type { 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,q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ifeCycleHookCallbackParams } from "../../types";
|
1
|
+
import type { LifeCycleHookCallbackParams } from "../../types";
|
2
2
|
export declare const deleteCommentsAfterChangeRequest: ({ apw }: Pick<LifeCycleHookCallbackParams, "apw">) => void;
|
@@ -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","ignoreList":[]}
|
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 type { 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":[]}
|
package/plugins/hooks/index.d.ts
CHANGED
@@ -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,IA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entReview","_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 type { 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,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Context } from "../../types";
|
1
|
+
import type { ApwContext } from "../../types";
|
2
2
|
export declare const initializeContentReviewSteps: ({ apw, plugins }: ApwContext) => void;
|
@@ -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 {\
|
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 type { ApwContentReviewStepStatus, ApwContext } from \"~/types\";\nimport { ApwContentReviewStatus, ApwWorkflowStepTypes } 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;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AAEO,MAAMK,4BAA4B,GA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,EACbO,KAAK,EACLL,kBACJ,CAAC;MACDA,kBAAkB,GAAGM,MAAM;MAC3B,OAAO;QACH,GAAGF,IAAI;QACPE,MAAM;QACNE,qBAAqB,EAAE,CAAC;QACxBC,aAAa,EAAE;MACnB,CAAC;IACL,CAAC,CAAC;IACF;AACR;AACA;IACQ,MAAMC,cAAc,GAAGR,YAAY,CAACS,KAAK,CAACP,IAAI,IAAI;MAC9C,OAAOA,IAAI,CAACrB,IAAI,KAAK6B,2BAAoB,CAACC,aAAa;IAC3D,CAAC,CAAC;IACF,IAAIH,cAAc,EAAE;MAChB5B,KAAK,CAACgC,YAAY,GAAGC,6BAAsB,CAACC,qBAAqB;IACrE;IAEAlC,KAAK,GAAG,IAAAS,YAAS,EAACT,KAAK,EAAE,OAAO,EAAEoB,YAAY,CAAC;EACnD,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAzC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../types";
|
1
|
+
import type { ApwContext } from "../../types";
|
2
2
|
export declare const initializeNotifications: (context: ApwContext) => void;
|
@@ -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","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_contentReviewAfterCreate","require","_commentAfterCreate","_changeRequestAfterCreate","initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate","exports"],"sources":["initializeNotifications.ts"],"sourcesContent":["import type { 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,6 +1,6 @@
|
|
1
|
-
import { AdvancedPublishingWorkflow } from "../../types";
|
2
|
-
import { HeadlessCms } from "@webiny/api-headless-cms/types";
|
3
|
-
import { Security } from "@webiny/api-security/types";
|
1
|
+
import type { AdvancedPublishingWorkflow } from "../../types";
|
2
|
+
import type { HeadlessCms } from "@webiny/api-headless-cms/types";
|
3
|
+
import type { Security } from "@webiny/api-security/types";
|
4
4
|
interface ListWorkflowsParams {
|
5
5
|
apw: AdvancedPublishingWorkflow;
|
6
6
|
cms: HeadlessCms;
|
@@ -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","ignoreList":[]}
|
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 type { AdvancedPublishingWorkflow } from \"~/types\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { 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,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../../types";
|
1
|
+
import type { ApwContext } from "../../../types";
|
2
2
|
export declare const attachChangeRequestAfterCreate: (context: ApwContext) => void;
|
@@ -11,7 +11,7 @@ var _contentUrl = require("./contentUrl");
|
|
11
11
|
var _sendChangeRequestNotification = require("./sendChangeRequestNotification");
|
12
12
|
var _reviewers = require("./reviewers");
|
13
13
|
var _changeRequestUrl = require("./changeRequestUrl");
|
14
|
-
var
|
14
|
+
var _getAppUrl = require("./getAppUrl");
|
15
15
|
const attachChangeRequestAfterCreate = context => {
|
16
16
|
context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({
|
17
17
|
changeRequest
|
@@ -26,7 +26,7 @@ const attachChangeRequestAfterCreate = context => {
|
|
26
26
|
step: changeRequest.step
|
27
27
|
});
|
28
28
|
}
|
29
|
-
const settings = await (0,
|
29
|
+
const settings = await (0, _getAppUrl.getAppUrl)(context);
|
30
30
|
if (!settings) {
|
31
31
|
return;
|
32
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_sendChangeRequestNotification","_reviewers","_changeRequestUrl","
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_sendChangeRequestNotification","_reviewers","_changeRequestUrl","_getAppUrl","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 type { 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/getAppUrl\";\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,UAAA,GAAAN,OAAA;AAEO,MAAMO,8BAA8B,GAAIC,OAAmB,IAAW;EACzEA,OAAO,CAACC,GAAG,CAACC,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-
import { ApwContext } from "../../../types";
|
1
|
+
import type { ApwContext } from "../../../types";
|
2
2
|
export declare const attachCommentAfterCreate: (context: ApwContext) => void;
|
@@ -11,7 +11,7 @@ var _contentUrl = require("./contentUrl");
|
|
11
11
|
var _commentUrl = require("./commentUrl");
|
12
12
|
var _reviewers = require("./reviewers");
|
13
13
|
var _sendCommentNotification = require("./sendCommentNotification");
|
14
|
-
var
|
14
|
+
var _getAppUrl = require("./getAppUrl");
|
15
15
|
const attachCommentAfterCreate = context => {
|
16
16
|
context.apw.comment.onCommentAfterCreate.subscribe(async ({
|
17
17
|
comment
|
@@ -33,7 +33,7 @@ const attachCommentAfterCreate = context => {
|
|
33
33
|
step: changeRequest.step
|
34
34
|
});
|
35
35
|
}
|
36
|
-
const settings = await (0,
|
36
|
+
const settings = await (0, _getAppUrl.getAppUrl)(context);
|
37
37
|
if (!settings) {
|
38
38
|
return;
|
39
39
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_commentUrl","_reviewers","_sendCommentNotification","
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_commentUrl","_reviewers","_sendCommentNotification","_getAppUrl","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 type { 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/getAppUrl\";\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,UAAA,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,IAClB,CAAC;MACD,IAAI,CAACF,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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,CACjB,uCAAuC,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,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../../types";
|
1
|
+
import type { ApwContext } from "../../../types";
|
2
2
|
export declare const attachContentReviewAfterCreate: (context: ApwContext) => void;
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
});
|
7
7
|
exports.attachContentReviewAfterCreate = void 0;
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
9
|
-
var
|
9
|
+
var _getAppUrl = require("./getAppUrl");
|
10
10
|
var _contentReviewUrl = require("./contentReviewUrl");
|
11
11
|
var _contentUrl = require("./contentUrl");
|
12
12
|
var _reviewers = require("./reviewers");
|
@@ -23,7 +23,7 @@ const attachContentReviewAfterCreate = context => {
|
|
23
23
|
if (!step?.id) {
|
24
24
|
return;
|
25
25
|
}
|
26
|
-
const settings = await (0,
|
26
|
+
const settings = await (0, _getAppUrl.getAppUrl)(context);
|
27
27
|
if (!settings) {
|
28
28
|
return;
|
29
29
|
}
|