@webiny/api-apw 5.40.0-beta.2 → 5.40.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/ApwChangeRequestNotification.js.map +1 -1
  2. package/ApwCommentNotification.js.map +1 -1
  3. package/ApwContentReviewNotification.js.map +1 -1
  4. package/ApwContentUrlPlugin.js.map +1 -1
  5. package/ContentApwSettingsPlugin.js.map +1 -1
  6. package/crud/createChangeRequestMethods.js.map +1 -1
  7. package/crud/createCommentMethods.js.map +1 -1
  8. package/crud/createContentReviewMethods.js.map +1 -1
  9. package/crud/createReviewerMethods.js.map +1 -1
  10. package/crud/createWorkflowMethods.js.map +1 -1
  11. package/crud/index.js.map +1 -1
  12. package/crud/utils.js +1 -2
  13. package/crud/utils.js.map +1 -1
  14. package/index.js.map +1 -1
  15. package/package.json +33 -33
  16. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  17. package/plugins/cms/apwEntryPlugins.js +10 -1
  18. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  19. package/plugins/cms/index.js.map +1 -1
  20. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  21. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  22. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  23. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  24. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  25. package/plugins/cms/notifications/contentUrl.js.map +1 -1
  26. package/plugins/cms/triggerContentReview.js.map +1 -1
  27. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  28. package/plugins/cms/utils.js.map +1 -1
  29. package/plugins/context.js.map +1 -1
  30. package/plugins/graphql/changeRequest.gql.js +1 -2
  31. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  32. package/plugins/graphql/comment.gql.js +1 -2
  33. package/plugins/graphql/comment.gql.js.map +1 -1
  34. package/plugins/graphql/contentReview.gql.js +1 -2
  35. package/plugins/graphql/contentReview.gql.js.map +1 -1
  36. package/plugins/graphql/reviewer.gql.js +1 -2
  37. package/plugins/graphql/reviewer.gql.js.map +1 -1
  38. package/plugins/graphql/utils.js +2 -4
  39. package/plugins/graphql/utils.js.map +1 -1
  40. package/plugins/graphql/workflow.gql.js +1 -2
  41. package/plugins/graphql/workflow.gql.js.map +1 -1
  42. package/plugins/graphql.js.map +1 -1
  43. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  44. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  45. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  46. package/plugins/hooks/index.js.map +1 -1
  47. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  48. package/plugins/hooks/initializeNotifications.js.map +1 -1
  49. package/plugins/hooks/listContentReviews.js.map +1 -1
  50. package/plugins/hooks/notifications/appUrl.js.map +1 -1
  51. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  52. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
  53. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  54. package/plugins/hooks/notifications/commentUrl.js.map +1 -1
  55. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  56. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
  57. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  58. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  59. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  60. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  61. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  62. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  63. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  64. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  65. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  66. package/plugins/hooks/updateTotalComments.js.map +1 -1
  67. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  68. package/plugins/hooks/validateComment.js.map +1 -1
  69. package/plugins/hooks/validateContentReview.js.map +1 -1
  70. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  71. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  72. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  73. package/plugins/pageBuilder/index.js.map +1 -1
  74. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  75. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  76. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
  77. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
  78. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
  79. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
  80. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  81. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  82. package/plugins/pageBuilder/utils.js.map +1 -1
  83. package/plugins/utils.js.map +1 -1
  84. package/scheduler/createScheduleActionMethods.js.map +1 -1
  85. package/scheduler/handlers/executeAction/index.js +0 -1
  86. package/scheduler/handlers/executeAction/index.js.map +1 -1
  87. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  88. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  89. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  90. package/scheduler/handlers/executeAction/security.js.map +1 -1
  91. package/scheduler/handlers/scheduleAction/index.js +1 -3
  92. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  93. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  94. package/scheduler/handlers/utils.js +2 -4
  95. package/scheduler/handlers/utils.js.map +1 -1
  96. package/scheduler/index.js.map +1 -1
  97. package/scheduler/types.js +3 -6
  98. package/scheduler/types.js.map +1 -1
  99. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  100. package/storageOperations/commentStorageOperations.js.map +1 -1
  101. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  102. package/storageOperations/index.js.map +1 -1
  103. package/storageOperations/models/changeRequest.model.js +1 -2
  104. package/storageOperations/models/changeRequest.model.js.map +1 -1
  105. package/storageOperations/models/comment.model.js +1 -2
  106. package/storageOperations/models/comment.model.js.map +1 -1
  107. package/storageOperations/models/contentReview.model.js +1 -2
  108. package/storageOperations/models/contentReview.model.js.map +1 -1
  109. package/storageOperations/models/index.js.map +1 -1
  110. package/storageOperations/models/reviewer.model.js +1 -2
  111. package/storageOperations/models/reviewer.model.js.map +1 -1
  112. package/storageOperations/models/utils.js.map +1 -1
  113. package/storageOperations/models/workflow.model.js +1 -2
  114. package/storageOperations/models/workflow.model.js.map +1 -1
  115. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  116. package/storageOperations/types.js.map +1 -1
  117. package/storageOperations/workflowStorageOperations.js.map +1 -1
  118. package/types.js +6 -12
  119. package/types.js.map +1 -1
  120. package/utils/contentApwSettingsPlugin.js.map +1 -1
  121. package/utils/errors.js.map +1 -1
  122. package/utils/fieldResolver.js.map +1 -1
  123. package/utils/pickEntryFieldValues.js +1 -2
  124. package/utils/pickEntryFieldValues.js.map +1 -1
  125. package/utils/resolve.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","ApwChangeRequestNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwChangeRequestNotification"],"sources":["ApwChangeRequestNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwChangeRequestNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n changeRequestUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwChangeRequestNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwChangeRequestNotificationCb {\n (params: ApwChangeRequestNotificationCbParams):\n | ApwChangeRequestNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwChangeRequestNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.changeRequest\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwChangeRequestNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwChangeRequestNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwChangeRequestNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwChangeRequestNotification = (\n contentType: ApwContentTypes,\n cb: ApwChangeRequestNotificationCb\n) => {\n return new ApwChangeRequestNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA6BO,MAAMC,4BAA4B,SAASC,eAAM,CAAC;EACrD,OAAgCC,IAAI,GAAW,gCAAgC;EAKxEC,WAAWA,CAACC,WAA4B,EAAEC,EAAkC,EAAE;IACjF,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAA4C,EAAE;IACxD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA;AAEM,MAAMU,kCAAkC,GAAGA,CAC9CN,WAA4B,EAC5BC,EAAkC,KACjC;EACD,OAAO,IAAIL,4BAA4B,CAACI,WAAW,EAAEC,EAAE,CAAC;AAC5D,CAAC;AAACI,OAAA,CAAAC,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_plugins","require","ApwChangeRequestNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwChangeRequestNotification"],"sources":["ApwChangeRequestNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwChangeRequestNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n changeRequestUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwChangeRequestNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwChangeRequestNotificationCb {\n (params: ApwChangeRequestNotificationCbParams):\n | ApwChangeRequestNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwChangeRequestNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.changeRequest\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwChangeRequestNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwChangeRequestNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwChangeRequestNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwChangeRequestNotification = (\n contentType: ApwContentTypes,\n cb: ApwChangeRequestNotificationCb\n) => {\n return new ApwChangeRequestNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA6BO,MAAMC,4BAA4B,SAASC,eAAM,CAAC;EACrD,OAAgCC,IAAI,GAAW,gCAAgC;EAKxEC,WAAWA,CAACC,WAA4B,EAAEC,EAAkC,EAAE;IACjF,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAA4C,EAAE;IACxD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA;AAEM,MAAMU,kCAAkC,GAAGA,CAC9CN,WAA4B,EAC5BC,EAAkC,KACjC;EACD,OAAO,IAAIL,4BAA4B,CAACI,WAAW,EAAEC,EAAE,CAAC;AAC5D,CAAC;AAACI,OAAA,CAAAC,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","ApwCommentNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwCommentNotification"],"sources":["ApwCommentNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwCommentNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n commentUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwCommentNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwCommentNotificationCb {\n (params: ApwCommentNotificationCbParams):\n | ApwCommentNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwCommentNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.comment\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwCommentNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwCommentNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwCommentNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwCommentNotification = (\n contentType: ApwContentTypes,\n cb: ApwCommentNotificationCb\n) => {\n return new ApwCommentNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA6BO,MAAMC,sBAAsB,SAASC,eAAM,CAAC;EAC/C,OAAgCC,IAAI,GAAW,0BAA0B;EAKlEC,WAAWA,CAACC,WAA4B,EAAEC,EAA4B,EAAE;IAC3E,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAAsC,EAAE;IAClD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,sBAAA,GAAAA,sBAAA;AAEM,MAAMU,4BAA4B,GAAGA,CACxCN,WAA4B,EAC5BC,EAA4B,KAC3B;EACD,OAAO,IAAIL,sBAAsB,CAACI,WAAW,EAAEC,EAAE,CAAC;AACtD,CAAC;AAACI,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"names":["_plugins","require","ApwCommentNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwCommentNotification"],"sources":["ApwCommentNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwChangeRequest,\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwCommentNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n commentUrl: string;\n contentUrl: string;\n changeRequest: ApwChangeRequest;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwCommentNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwCommentNotificationCb {\n (params: ApwCommentNotificationCbParams):\n | ApwCommentNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwCommentNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.comment\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwCommentNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwCommentNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwCommentNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwCommentNotification = (\n contentType: ApwContentTypes,\n cb: ApwCommentNotificationCb\n) => {\n return new ApwCommentNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA6BO,MAAMC,sBAAsB,SAASC,eAAM,CAAC;EAC/C,OAAgCC,IAAI,GAAW,0BAA0B;EAKlEC,WAAWA,CAACC,WAA4B,EAAEC,EAA4B,EAAE;IAC3E,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAAsC,EAAE;IAClD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,sBAAA,GAAAA,sBAAA;AAEM,MAAMU,4BAA4B,GAAGA,CACxCN,WAA4B,EAC5BC,EAA4B,KAC3B;EACD,OAAO,IAAIL,sBAAsB,CAACI,WAAW,EAAEC,EAAE,CAAC;AACtD,CAAC;AAACI,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","ApwContentReviewNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwContentReviewNotification"],"sources":["ApwContentReviewNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwContentReviewNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n contentReviewUrl: string;\n contentUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentReviewNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwContentReviewNotificationCb {\n (params: ApwContentReviewNotificationCbParams):\n | ApwContentReviewNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwContentReviewNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.contentReview\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwContentReviewNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentReviewNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwContentReviewNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwContentReviewNotification = (\n contentType: ApwContentTypes,\n cb: ApwContentReviewNotificationCb\n) => {\n return new ApwContentReviewNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA2BO,MAAMC,4BAA4B,SAASC,eAAM,CAAC;EACrD,OAAgCC,IAAI,GAAW,gCAAgC;EAKxEC,WAAWA,CAACC,WAA4B,EAAEC,EAAkC,EAAE;IACjF,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAA4C,EAAE;IACxD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA;AAEM,MAAMU,kCAAkC,GAAGA,CAC9CN,WAA4B,EAC5BC,EAAkC,KACjC;EACD,OAAO,IAAIL,4BAA4B,CAACI,WAAW,EAAEC,EAAE,CAAC;AAC5D,CAAC;AAACI,OAAA,CAAAC,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_plugins","require","ApwContentReviewNotification","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwContentReviewNotification"],"sources":["ApwContentReviewNotification.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport {\n ApwContentReview,\n ApwContentTypes,\n ApwContext,\n ApwReviewerWithEmail,\n ApwWorkflow\n} from \"~/types\";\n\nexport interface ApwContentReviewNotificationCbParams {\n context: ApwContext;\n reviewers: ApwReviewerWithEmail[];\n contentReviewUrl: string;\n contentUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentReviewNotificationCbParamsResponse {\n text: string;\n html?: string;\n}\nexport interface ApwContentReviewNotificationCb {\n (params: ApwContentReviewNotificationCbParams):\n | ApwContentReviewNotificationCbParamsResponse\n | null\n | undefined;\n}\nexport class ApwContentReviewNotification extends Plugin {\n public static override readonly type: string = \"apw.notification.contentReview\";\n\n private readonly contentType: ApwContentTypes;\n private readonly cb: ApwContentReviewNotificationCb;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentReviewNotificationCb) {\n super();\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return contentType === this.contentType;\n }\n\n public create(params: ApwContentReviewNotificationCbParams) {\n return this.cb(params);\n }\n}\n\nexport const createApwContentReviewNotification = (\n contentType: ApwContentTypes,\n cb: ApwContentReviewNotificationCb\n) => {\n return new ApwContentReviewNotification(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AA2BO,MAAMC,4BAA4B,SAASC,eAAM,CAAC;EACrD,OAAgCC,IAAI,GAAW,gCAAgC;EAKxEC,WAAWA,CAACC,WAA4B,EAAEC,EAAkC,EAAE;IACjF,KAAK,CAAC,CAAC;IACP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAOA,WAAW,KAAK,IAAI,CAACA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAA4C,EAAE;IACxD,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA;AAEM,MAAMU,kCAAkC,GAAGA,CAC9CN,WAA4B,EAC5BC,EAAkC,KACjC;EACD,OAAO,IAAIL,4BAA4B,CAACI,WAAW,EAAEC,EAAE,CAAC;AAC5D,CAAC;AAACI,OAAA,CAAAC,kCAAA,GAAAA,kCAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","ApwContentUrlPlugin","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwContentUrlPlugin"],"sources":["ApwContentUrlPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApwContentReview, ApwContentTypes, ApwWorkflow } from \"~/types\";\n\nexport interface ApwContentUrlPluginCbParams {\n baseUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentUrlPluginCb {\n (params: ApwContentUrlPluginCbParams): string | null;\n}\n\nexport class ApwContentUrlPlugin extends Plugin {\n public static override type = \"apw.contentUrl\";\n\n private readonly cb: ApwContentUrlPluginCb;\n private readonly contentType: ApwContentTypes;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentUrlPluginCb) {\n super();\n\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return this.contentType === contentType;\n }\n\n public create(params: ApwContentUrlPluginCbParams): string | null {\n return this.cb(params);\n }\n}\n\nexport const createApwContentUrlPlugin = (\n contentType: ApwContentTypes,\n cb: ApwContentUrlPluginCb\n) => {\n return new ApwContentUrlPlugin(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAYO,MAAMC,mBAAmB,SAASC,eAAM,CAAC;EAC5C,OAAuBC,IAAI,GAAG,gBAAgB;EAKvCC,WAAWA,CAACC,WAA4B,EAAEC,EAAyB,EAAE;IACxE,KAAK,CAAC,CAAC;IAEP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAO,IAAI,CAACA,WAAW,KAAKA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAAmC,EAAiB;IAC9D,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,mBAAA,GAAAA,mBAAA;AAEM,MAAMU,yBAAyB,GAAGA,CACrCN,WAA4B,EAC5BC,EAAyB,KACxB;EACD,OAAO,IAAIL,mBAAmB,CAACI,WAAW,EAAEC,EAAE,CAAC;AACnD,CAAC;AAACI,OAAA,CAAAC,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_plugins","require","ApwContentUrlPlugin","Plugin","type","constructor","contentType","cb","canUse","create","params","exports","createApwContentUrlPlugin"],"sources":["ApwContentUrlPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { ApwContentReview, ApwContentTypes, ApwWorkflow } from \"~/types\";\n\nexport interface ApwContentUrlPluginCbParams {\n baseUrl: string;\n contentReview: ApwContentReview;\n workflow: ApwWorkflow;\n}\nexport interface ApwContentUrlPluginCb {\n (params: ApwContentUrlPluginCbParams): string | null;\n}\n\nexport class ApwContentUrlPlugin extends Plugin {\n public static override type = \"apw.contentUrl\";\n\n private readonly cb: ApwContentUrlPluginCb;\n private readonly contentType: ApwContentTypes;\n\n public constructor(contentType: ApwContentTypes, cb: ApwContentUrlPluginCb) {\n super();\n\n this.contentType = contentType;\n this.cb = cb;\n }\n\n public canUse(contentType: ApwContentTypes): boolean {\n return this.contentType === contentType;\n }\n\n public create(params: ApwContentUrlPluginCbParams): string | null {\n return this.cb(params);\n }\n}\n\nexport const createApwContentUrlPlugin = (\n contentType: ApwContentTypes,\n cb: ApwContentUrlPluginCb\n) => {\n return new ApwContentUrlPlugin(contentType, cb);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAYO,MAAMC,mBAAmB,SAASC,eAAM,CAAC;EAC5C,OAAuBC,IAAI,GAAG,gBAAgB;EAKvCC,WAAWA,CAACC,WAA4B,EAAEC,EAAyB,EAAE;IACxE,KAAK,CAAC,CAAC;IAEP,IAAI,CAACD,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACC,EAAE,GAAGA,EAAE;EAChB;EAEOC,MAAMA,CAACF,WAA4B,EAAW;IACjD,OAAO,IAAI,CAACA,WAAW,KAAKA,WAAW;EAC3C;EAEOG,MAAMA,CAACC,MAAmC,EAAiB;IAC9D,OAAO,IAAI,CAACH,EAAE,CAACG,MAAM,CAAC;EAC1B;AACJ;AAACC,OAAA,CAAAT,mBAAA,GAAAA,mBAAA;AAEM,MAAMU,yBAAyB,GAAGA,CACrCN,WAA4B,EAC5BC,EAAyB,KACxB;EACD,OAAO,IAAIL,mBAAmB,CAACI,WAAW,EAAEC,EAAE,CAAC;AACnD,CAAC;AAACI,OAAA,CAAAC,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_Plugin","require","ContentApwSettingsPlugin","Plugin","type","exports"],"sources":["ContentApwSettingsPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport abstract class ContentApwSettingsPlugin extends Plugin {\n public static override type = \"apw.contentApwSettings\";\n\n public abstract canUse(type: ApwContentTypes): boolean;\n\n public abstract setWorkflowId(content: any, id: string | null): void;\n\n public abstract getWorkflowId(content: any): string | null;\n\n public abstract setContentReviewId(content: any, id: string | null): void;\n\n public abstract getContentReviewId(content: any): string | null;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAGO,MAAeC,wBAAwB,SAASC,cAAM,CAAC;EAC1D,OAAuBC,IAAI,GAAG,wBAAwB;AAW1D;AAACC,OAAA,CAAAH,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_Plugin","require","ContentApwSettingsPlugin","Plugin","type","exports"],"sources":["ContentApwSettingsPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/Plugin\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport abstract class ContentApwSettingsPlugin extends Plugin {\n public static override type = \"apw.contentApwSettings\";\n\n public abstract canUse(type: ApwContentTypes): boolean;\n\n public abstract setWorkflowId(content: any, id: string | null): void;\n\n public abstract getWorkflowId(content: any): string | null;\n\n public abstract setContentReviewId(content: any, id: string | null): void;\n\n public abstract getContentReviewId(content: any): string | null;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAGO,MAAeC,wBAAwB,SAASC,cAAM,CAAC;EAC1D,OAAuBC,IAAI,GAAG,wBAAwB;AAW1D;AAACC,OAAA,CAAAH,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_pubsub","require","createChangeRequestMethods","storageOperations","onChangeRequestBeforeCreate","createTopic","onChangeRequestAfterCreate","onChangeRequestBeforeUpdate","onChangeRequestAfterUpdate","onChangeRequestBeforeDelete","onChangeRequestAfterDelete","get","id","getChangeRequest","list","params","listChangeRequests","create","data","publish","input","changeRequest","createChangeRequest","update","original","updateChangeRequest","delete","deleteChangeRequest"],"sources":["createChangeRequestMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwChangeRequestCrud,\n CreateApwParams,\n OnChangeRequestAfterCreateTopicParams,\n OnChangeRequestAfterDeleteTopicParams,\n OnChangeRequestAfterUpdateTopicParams,\n OnChangeRequestBeforeCreateTopicParams,\n OnChangeRequestBeforeDeleteTopicParams,\n OnChangeRequestBeforeUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n // create\n const onChangeRequestBeforeCreate = createTopic<OnChangeRequestBeforeCreateTopicParams>(\n \"apw.onChangeRequestBeforeCreate\"\n );\n const onChangeRequestAfterCreate = createTopic<OnChangeRequestAfterCreateTopicParams>(\n \"apw.onChangeRequestAfterCreate\"\n );\n // update\n const onChangeRequestBeforeUpdate = createTopic<OnChangeRequestBeforeUpdateTopicParams>(\n \"apw.onChangeRequestBeforeUpdate\"\n );\n const onChangeRequestAfterUpdate = createTopic<OnChangeRequestAfterUpdateTopicParams>(\n \"apw.onChangeRequestAfterUpdate\"\n );\n // delete\n const onChangeRequestBeforeDelete = createTopic<OnChangeRequestBeforeDeleteTopicParams>(\n \"apw.onChangeRequestBeforeDelete\"\n );\n const onChangeRequestAfterDelete = createTopic<OnChangeRequestAfterDeleteTopicParams>(\n \"apw.onChangeRequestAfterDelete\"\n );\n\n return {\n async get(id) {\n return storageOperations.getChangeRequest({ id });\n },\n async list(params) {\n return storageOperations.listChangeRequests(params);\n },\n async create(data) {\n await onChangeRequestBeforeCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onChangeRequestAfterCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onChangeRequestAfterUpdate.publish({\n original,\n input: { id, data },\n changeRequest\n });\n\n return changeRequest;\n },\n async delete(id: string) {\n const changeRequest = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onChangeRequestAfterDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate,\n onChangeRequestAfterCreate,\n onChangeRequestBeforeUpdate,\n onChangeRequestAfterUpdate,\n onChangeRequestBeforeDelete,\n onChangeRequestAfterDelete\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYO,SAASC,0BAA0BA,CAAC;EACvCC;AACa,CAAC,EAAwB;EACtC;EACA,MAAMC,2BAA2B,GAAG,IAAAC,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMC,0BAA0B,GAAG,IAAAD,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMG,0BAA0B,GAAG,IAAAH,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMK,0BAA0B,GAAG,IAAAL,mBAAW,EAC1C,gCACJ,CAAC;EAED,OAAO;IACH,MAAMM,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOT,iBAAiB,CAACU,gBAAgB,CAAC;QAAED;MAAG,CAAC,CAAC;IACrD,CAAC;IACD,MAAME,IAAIA,CAACC,MAAM,EAAE;MACf,OAAOZ,iBAAiB,CAACa,kBAAkB,CAACD,MAAM,CAAC;IACvD,CAAC;IACD,MAAME,MAAMA,CAACC,IAAI,EAAE;MACf,MAAM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B;IAC3BC;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["_pubsub","require","createChangeRequestMethods","storageOperations","onChangeRequestBeforeCreate","createTopic","onChangeRequestAfterCreate","onChangeRequestBeforeUpdate","onChangeRequestAfterUpdate","onChangeRequestBeforeDelete","onChangeRequestAfterDelete","get","id","getChangeRequest","list","params","listChangeRequests","create","data","publish","input","changeRequest","createChangeRequest","update","original","updateChangeRequest","delete","deleteChangeRequest"],"sources":["createChangeRequestMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwChangeRequestCrud,\n CreateApwParams,\n OnChangeRequestAfterCreateTopicParams,\n OnChangeRequestAfterDeleteTopicParams,\n OnChangeRequestAfterUpdateTopicParams,\n OnChangeRequestBeforeCreateTopicParams,\n OnChangeRequestBeforeDeleteTopicParams,\n OnChangeRequestBeforeUpdateTopicParams\n} from \"~/types\";\n\nexport function createChangeRequestMethods({\n storageOperations\n}: CreateApwParams): ApwChangeRequestCrud {\n // create\n const onChangeRequestBeforeCreate = createTopic<OnChangeRequestBeforeCreateTopicParams>(\n \"apw.onChangeRequestBeforeCreate\"\n );\n const onChangeRequestAfterCreate = createTopic<OnChangeRequestAfterCreateTopicParams>(\n \"apw.onChangeRequestAfterCreate\"\n );\n // update\n const onChangeRequestBeforeUpdate = createTopic<OnChangeRequestBeforeUpdateTopicParams>(\n \"apw.onChangeRequestBeforeUpdate\"\n );\n const onChangeRequestAfterUpdate = createTopic<OnChangeRequestAfterUpdateTopicParams>(\n \"apw.onChangeRequestAfterUpdate\"\n );\n // delete\n const onChangeRequestBeforeDelete = createTopic<OnChangeRequestBeforeDeleteTopicParams>(\n \"apw.onChangeRequestBeforeDelete\"\n );\n const onChangeRequestAfterDelete = createTopic<OnChangeRequestAfterDeleteTopicParams>(\n \"apw.onChangeRequestAfterDelete\"\n );\n\n return {\n async get(id) {\n return storageOperations.getChangeRequest({ id });\n },\n async list(params) {\n return storageOperations.listChangeRequests(params);\n },\n async create(data) {\n await onChangeRequestBeforeCreate.publish({ input: data });\n\n const changeRequest = await storageOperations.createChangeRequest({ data });\n\n await onChangeRequestAfterCreate.publish({ changeRequest });\n\n return changeRequest;\n },\n async update(id, data) {\n const original = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeUpdate.publish({ original, input: { id, data } });\n\n const changeRequest = await storageOperations.updateChangeRequest({ id, data });\n\n await onChangeRequestAfterUpdate.publish({\n original,\n input: { id, data },\n changeRequest\n });\n\n return changeRequest;\n },\n async delete(id: string) {\n const changeRequest = await storageOperations.getChangeRequest({ id });\n\n await onChangeRequestBeforeDelete.publish({ changeRequest });\n\n await storageOperations.deleteChangeRequest({ id });\n\n await onChangeRequestAfterDelete.publish({ changeRequest });\n\n return true;\n },\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate,\n onChangeRequestAfterCreate,\n onChangeRequestBeforeUpdate,\n onChangeRequestAfterUpdate,\n onChangeRequestBeforeDelete,\n onChangeRequestAfterDelete\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYO,SAASC,0BAA0BA,CAAC;EACvCC;AACa,CAAC,EAAwB;EACtC;EACA,MAAMC,2BAA2B,GAAG,IAAAC,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMC,0BAA0B,GAAG,IAAAD,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMG,0BAA0B,GAAG,IAAAH,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMK,0BAA0B,GAAG,IAAAL,mBAAW,EAC1C,gCACJ,CAAC;EAED,OAAO;IACH,MAAMM,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOT,iBAAiB,CAACU,gBAAgB,CAAC;QAAED;MAAG,CAAC,CAAC;IACrD,CAAC;IACD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;MAAc,CAAC,CAAC;MAE3D,OAAO,IAAI;IACf,CAAC;IACD;AACR;AACA;IACQjB,2BAA2B;IAC3BE,0BAA0B;IAC1BC,2BAA2B;IAC3BC,0BAA0B;IAC1BC,2BAA2B;IAC3BC;EACJ,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_pubsub","require","createCommentMethods","storageOperations","onCommentBeforeCreate","createTopic","onCommentAfterCreate","onCommentBeforeUpdate","onCommentAfterUpdate","onCommentBeforeDelete","onCommentAfterDelete","get","id","getComment","list","params","listComments","create","data","publish","input","comment","createComment","update","original","updateComment","delete","deleteComment"],"sources":["createCommentMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwCommentCrud,\n CreateApwParams,\n OnCommentBeforeCreateTopicParams,\n OnCommentAfterCreateTopicParams,\n OnCommentBeforeUpdateTopicParams,\n OnCommentAfterUpdateTopicParams,\n OnCommentBeforeDeleteTopicParams,\n OnCommentAfterDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n // create\n const onCommentBeforeCreate = createTopic<OnCommentBeforeCreateTopicParams>(\n \"apw.onCommentBeforeCreate\"\n );\n const onCommentAfterCreate = createTopic<OnCommentAfterCreateTopicParams>(\n \"apw.onCommentAfterCreate\"\n );\n // update\n const onCommentBeforeUpdate = createTopic<OnCommentBeforeUpdateTopicParams>(\n \"apw.onCommentBeforeUpdate\"\n );\n const onCommentAfterUpdate = createTopic<OnCommentAfterUpdateTopicParams>(\n \"apw.onCommentAfterUpdate\"\n );\n // delete\n const onCommentBeforeDelete = createTopic<OnCommentBeforeDeleteTopicParams>(\n \"apw.onCommentBeforeDelete\"\n );\n const onCommentAfterDelete = createTopic<OnCommentAfterDeleteTopicParams>(\n \"apw.onCommentAfterDelete\"\n );\n\n return {\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate,\n onCommentAfterCreate,\n onCommentBeforeUpdate,\n onCommentAfterUpdate,\n onCommentBeforeDelete,\n onCommentAfterDelete,\n async get(id) {\n return storageOperations.getComment({ id });\n },\n async list(params) {\n return storageOperations.listComments(params);\n },\n async create(data) {\n await onCommentBeforeCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onCommentAfterCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onCommentBeforeUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onCommentAfterUpdate.publish({ original, comment, input: { id, data } });\n\n return comment;\n },\n async delete(id: string) {\n const comment = await storageOperations.getComment({ id });\n\n await onCommentBeforeDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onCommentAfterDelete.publish({ comment });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYO,SAASC,oBAAoBA,CAAC;EAAEC;AAAmC,CAAC,EAAkB;EACzF;EACA,MAAMC,qBAAqB,GAAG,IAAAC,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMC,oBAAoB,GAAG,IAAAD,mBAAW,EACpC,0BACJ,CAAC;EACD;EACA,MAAME,qBAAqB,GAAG,IAAAF,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMG,oBAAoB,GAAG,IAAAH,mBAAW,EACpC,0BACJ,CAAC;EACD;EACA,MAAMI,qBAAqB,GAAG,IAAAJ,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMK,oBAAoB,GAAG,IAAAL,mBAAW,EACpC,0BACJ,CAAC;EAED,OAAO;IACH;AACR;AACA;IACQD,qBAAqB;IACrBE,oBAAoB;IACpBC,qBAAqB;IACrBC,oBAAoB;IACpBC,qBAAqB;IACrBC,oBAAoB;IACpB,MAAMC,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOT,iBAAiB,CAACU,UAAU,CAAC;QAAED;MAAG,CAAC,CAAC;IAC/C,CAAC;IACD,M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AC;MAE/C,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["_pubsub","require","createCommentMethods","storageOperations","onCommentBeforeCreate","createTopic","onCommentAfterCreate","onCommentBeforeUpdate","onCommentAfterUpdate","onCommentBeforeDelete","onCommentAfterDelete","get","id","getComment","list","params","listComments","create","data","publish","input","comment","createComment","update","original","updateComment","delete","deleteComment"],"sources":["createCommentMethods.ts"],"sourcesContent":["import { createTopic } from \"@webiny/pubsub\";\nimport {\n ApwCommentCrud,\n CreateApwParams,\n OnCommentBeforeCreateTopicParams,\n OnCommentAfterCreateTopicParams,\n OnCommentBeforeUpdateTopicParams,\n OnCommentAfterUpdateTopicParams,\n OnCommentBeforeDeleteTopicParams,\n OnCommentAfterDeleteTopicParams\n} from \"~/types\";\n\nexport function createCommentMethods({ storageOperations }: CreateApwParams): ApwCommentCrud {\n // create\n const onCommentBeforeCreate = createTopic<OnCommentBeforeCreateTopicParams>(\n \"apw.onCommentBeforeCreate\"\n );\n const onCommentAfterCreate = createTopic<OnCommentAfterCreateTopicParams>(\n \"apw.onCommentAfterCreate\"\n );\n // update\n const onCommentBeforeUpdate = createTopic<OnCommentBeforeUpdateTopicParams>(\n \"apw.onCommentBeforeUpdate\"\n );\n const onCommentAfterUpdate = createTopic<OnCommentAfterUpdateTopicParams>(\n \"apw.onCommentAfterUpdate\"\n );\n // delete\n const onCommentBeforeDelete = createTopic<OnCommentBeforeDeleteTopicParams>(\n \"apw.onCommentBeforeDelete\"\n );\n const onCommentAfterDelete = createTopic<OnCommentAfterDeleteTopicParams>(\n \"apw.onCommentAfterDelete\"\n );\n\n return {\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate,\n onCommentAfterCreate,\n onCommentBeforeUpdate,\n onCommentAfterUpdate,\n onCommentBeforeDelete,\n onCommentAfterDelete,\n async get(id) {\n return storageOperations.getComment({ id });\n },\n async list(params) {\n return storageOperations.listComments(params);\n },\n async create(data) {\n await onCommentBeforeCreate.publish({ input: data });\n\n const comment = await storageOperations.createComment({\n data\n });\n await onCommentAfterCreate.publish({ comment });\n\n return comment;\n },\n async update(id, data) {\n const original = await storageOperations.getComment({ id });\n\n await onCommentBeforeUpdate.publish({ original, input: { id, data } });\n\n const comment = await storageOperations.updateComment({ id, data });\n\n await onCommentAfterUpdate.publish({ original, comment, input: { id, data } });\n\n return comment;\n },\n async delete(id: string) {\n const comment = await storageOperations.getComment({ id });\n\n await onCommentBeforeDelete.publish({ comment });\n\n await storageOperations.deleteComment({ id });\n\n await onCommentAfterDelete.publish({ comment });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAYO,SAASC,oBAAoBA,CAAC;EAAEC;AAAmC,CAAC,EAAkB;EACzF;EACA,MAAMC,qBAAqB,GAAG,IAAAC,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMC,oBAAoB,GAAG,IAAAD,mBAAW,EACpC,0BACJ,CAAC;EACD;EACA,MAAME,qBAAqB,GAAG,IAAAF,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMG,oBAAoB,GAAG,IAAAH,mBAAW,EACpC,0BACJ,CAAC;EACD;EACA,MAAMI,qBAAqB,GAAG,IAAAJ,mBAAW,EACrC,2BACJ,CAAC;EACD,MAAMK,oBAAoB,GAAG,IAAAL,mBAAW,EACpC,0BACJ,CAAC;EAED,OAAO;IACH;AACR;AACA;IACQD,qBAAqB;IACrBE,oBAAoB;IACpBC,qBAAqB;IACrBC,oBAAoB;IACpBC,qBAAqB;IACrBC,oBAAoB;IACpB,MAAMC,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOT,iBAAiB,CAACU,UAAU,CAAC;QAAED;MAAG,CAAC,CAAC;IAC/C,CAAC;IACD,MAAME,IAAIA,CAACC,MAAM,EAAE;MACf,OAAOZ,iBAAiB,CAACa,YAAY,CAACD,MAAM,CAAC;IACjD,CAAC;IACD,MAAME,MAAMA,CAACC,IAAI,EAAE;MACf,MAAMd,qBAAqB,CAACe,OAAO,CAAC;QAAEC,KAAK,EAAEF;MAAK,CAAC,CAAC;MAEpD,MAAMG,OAAO,GAAG,MAAMlB,iBAAiB,CAACmB,aAAa,CAAC;QAClDJ;MACJ,CAAC,CAAC;MACF,MAAMZ,oBAAoB,CAACa,OAAO,CAAC;QAAEE;MAAQ,CAAC,CAAC;MAE/C,OAAOA,OAAO;IAClB,CAAC;IACD,MAAME,MAAMA,CAACX,EAAE,EAAEM,IAAI,EAAE;MACnB,MAAMM,QAAQ,GAAG,MAAMrB,iBAAiB,CAACU,UAAU,CAAC;QAAED;MAAG,CAAC,CAAC;MAE3D,MAAML,qBAAqB,CAACY,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK;MAAE,CAAC,CAAC;MAEtE,MAAMG,OAAO,GAAG,MAAMlB,iBAAiB,CAACsB,aAAa,CAAC;QAAEb,EAAE;QAAEM;MAAK,CAAC,CAAC;MAEnE,MAAMV,oBAAoB,CAACW,OAAO,CAAC;QAAEK,QAAQ;QAAEH,OAAO;QAAED,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK;MAAE,CAAC,CAAC;MAE9E,OAAOG,OAAO;IAClB,CAAC;IACD,MAAMK,MAAMA,CAACd,EAAU,EAAE;MACrB,MAAMS,OAAO,GAAG,MAAMlB,iBAAiB,CAACU,UAAU,CAAC;QAAED;MAAG,CAAC,CAAC;MAE1D,MAAMH,qBAAqB,CAACU,OAAO,CAAC;QAAEE;MAAQ,CAAC,CAAC;MAEhD,MAAMlB,iBAAiB,CAACwB,aAAa,CAAC;QAAEf;MAAG,CAAC,CAAC;MAE7C,MAAMF,oBAAoB,CAACS,OAAO,CAAC;QAAEE;MAAQ,CAAC,CAAC;MAE/C,OAAO,IAAI;IACf;EACJ,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_get","_interopRequireDefault","require","_pubsub","_error","_types","_utils","_errors","_types2","_utils2","_contentApwSettingsPlugin","createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","onContentReviewBeforeList","get","id","getContentReview","list","where","publish","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","content","NoSignOffProvidedError","scheduledActionId","scheduledOn","scheduledBy","isReviewRequired","contentGetter","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduleAction","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeListTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n // list\n const onContentReviewBeforeList = createTopic<OnContentReviewBeforeListTopicParams>(\n \"apw.onContentReviewBeforeList\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n onContentReviewBeforeList,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n const where = params.where || {};\n\n await onContentReviewBeforeList.publish({\n where\n });\n\n if (where.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: {\n ...params,\n where\n },\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews({\n ...params,\n where\n });\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const contentReview = await this.get(id);\n const { steps, reviewStatus, content } = contentReview;\n\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n /**\n * We need to delete the scheduled action if one was created.\n */\n const scheduledActionId = contentReview.content?.scheduledActionId;\n if (!!scheduledActionId) {\n await scheduler.delete(scheduledActionId);\n }\n\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n },\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n }\n });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAoBA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAOA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAMA,IAAAQ,yBAAA,GAAAR,OAAA;AAWO,SAASS,0BAA0BA,CACtCC,MAAwC,EACpB;EACpB,MAAM;IACFC,WAAW;IACXC,iBAAiB;IACjBC,WAAW;IACXC,gBAAgB;IAChBC,mBAAmB;IACnBC,qBAAqB;IACrBC,SAAS;IACTC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC;EACJ,CAAC,GAAGX,MAAM;;EAEV;EACA,MAAMY,2BAA2B,GAAG,IAAAC,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMC,0BAA0B,GAAG,IAAAD,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAME,2BAA2B,GAAG,IAAAF,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMG,0BAA0B,GAAG,IAAAH,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAMI,2BAA2B,GAAG,IAAAJ,mBAAW,EAC3C,iCACJ,CAAC;EACD,MAAMK,0BAA0B,GAAG,IAAAL,mBAAW,EAC1C,gCACJ,CAAC;EACD;EACA,MAAMM,yBAAyB,GAAG,I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E,qBAAqB;UAC3BpE,IAAI,EAAE;YACFV;UACJ;QACJ,CAAC,CAAC;MACN;MACA;AACZ;AACA;MACY,MAAMd,SAAS,CAACiC,MAAM,CAAC2C,iBAAiB,CAAC;;MAEzC;AACZ;AACA;MACY,MAAM,IAAI,CAAC9C,MAAM,CAAChB,EAAE,EAAE;QAClB4D,OAAO,EAAE;UACL,GAAG9C,aAAa,CAAC8C,OAAO;UACxB,GAAG6C;QACP;MACJ,CAAC,CAAC;MAEF,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["_get","_interopRequireDefault","require","_pubsub","_error","_types","_utils","_errors","_types2","_utils2","_contentApwSettingsPlugin","createContentReviewMethods","params","getIdentity","storageOperations","getReviewer","getContentGetter","getContentPublisher","getContentUnPublisher","scheduler","handlerClient","getTenant","getLocale","plugins","onContentReviewBeforeCreate","createTopic","onContentReviewAfterCreate","onContentReviewBeforeUpdate","onContentReviewAfterUpdate","onContentReviewBeforeDelete","onContentReviewAfterDelete","onContentReviewBeforeList","get","id","getContentReview","list","where","publish","reviewStatus","filterContentReviewsByRequiresMyAttention","listParams","listContentReviews","create","data","input","ApwContentReviewStatus","UNDER_REVIEW","contentReview","createContentReview","update","original","updateContentReview","delete","deleteContentReview","provideSignOff","stepId","entry","steps","stepIndex","findIndex","step","currentStep","previousStep","identity","hasPermission","hasReviewer","NotAuthorizedError","status","ApwContentReviewStepStatus","DONE","type","ApwWorkflowStepTypes","MANDATORY_BLOCKING","StepMissingError","pendingChangeRequests","PendingChangeRequestsError","ACTIVE","StepInActiveError","previousStepStatus","updatedSteps","map","index","signOffProvidedOn","Date","toISOString","signOffProvidedBy","getNextStepStatus","newStatus","pendingRequiredSteps","getPendingRequiredSteps","length","READY_TO_BE_PUBLISHED","retractSignOff","content","NoSignOffProvidedError","scheduledActionId","scheduledOn","scheduledBy","isReviewRequired","contentGetter","settings","contentReviewId","contentApwSettingsPlugin","getContentApwSettingsPlugin","getContentReviewId","workflowId","getWorkflowId","publishContent","datetime","Error","message","code","checkValidDateTime","contentPublisher","action","ApwScheduleActionTypes","PUBLISH","entryId","modelId","scheduleAction","unpublishContent","PUBLISHED","contentUnPublisher","UNPUBLISH","scheduledAction","process","env","NODE_ENV","invoke","name","String","APW_SCHEDULER_SCHEDULE_ACTION_HANDLER","payload","tenant","locale","await","description","deleteScheduledAction","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META"],"sources":["createContentReviewMethods.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport Error from \"@webiny/error\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentReview,\n ApwContentReviewCrud,\n ApwContentReviewStatus,\n ApwContentReviewStepStatus,\n ApwReviewerCrud,\n ApwScheduleActionData,\n ApwWorkflowStepTypes,\n CreateApwContentReviewParams,\n CreateApwParams,\n OnContentReviewAfterCreateTopicParams,\n OnContentReviewAfterDeleteTopicParams,\n OnContentReviewAfterUpdateTopicParams,\n OnContentReviewBeforeCreateTopicParams,\n OnContentReviewBeforeDeleteTopicParams,\n OnContentReviewBeforeListTopicParams,\n OnContentReviewBeforeUpdateTopicParams,\n UpdateApwContentReviewParams\n} from \"~/types\";\nimport { getNextStepStatus, hasReviewer } from \"~/plugins/utils\";\nimport {\n NoSignOffProvidedError,\n NotAuthorizedError,\n PendingChangeRequestsError,\n StepInActiveError,\n StepMissingError\n} from \"~/utils/errors\";\nimport { ApwScheduleActionTypes } from \"~/scheduler/types\";\nimport {\n checkValidDateTime,\n filterContentReviewsByRequiresMyAttention,\n getPendingRequiredSteps,\n INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n} from \"./utils\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\nimport { PluginsContainer } from \"@webiny/plugins\";\n\nexport interface CreateContentReviewMethodsParams extends CreateApwParams {\n getReviewer: ApwReviewerCrud[\"get\"];\n getContentGetter: AdvancedPublishingWorkflow[\"getContentGetter\"];\n getContentPublisher: AdvancedPublishingWorkflow[\"getContentPublisher\"];\n getContentUnPublisher: AdvancedPublishingWorkflow[\"getContentUnPublisher\"];\n plugins: PluginsContainer;\n}\n\nexport function createContentReviewMethods(\n params: CreateContentReviewMethodsParams\n): ApwContentReviewCrud {\n const {\n getIdentity,\n storageOperations,\n getReviewer,\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher,\n scheduler,\n handlerClient,\n getTenant,\n getLocale,\n plugins\n } = params;\n\n // create\n const onContentReviewBeforeCreate = createTopic<OnContentReviewBeforeCreateTopicParams>(\n \"apw.onContentReviewBeforeCreate\"\n );\n const onContentReviewAfterCreate = createTopic<OnContentReviewAfterCreateTopicParams>(\n \"apw.onContentReviewAfterCreate\"\n );\n // update\n const onContentReviewBeforeUpdate = createTopic<OnContentReviewBeforeUpdateTopicParams>(\n \"apw.onContentReviewBeforeUpdate\"\n );\n const onContentReviewAfterUpdate = createTopic<OnContentReviewAfterUpdateTopicParams>(\n \"apw.onContentReviewAfterUpdate\"\n );\n // delete\n const onContentReviewBeforeDelete = createTopic<OnContentReviewBeforeDeleteTopicParams>(\n \"apw.onContentReviewBeforeDelete\"\n );\n const onContentReviewAfterDelete = createTopic<OnContentReviewAfterDeleteTopicParams>(\n \"apw.onContentReviewAfterDelete\"\n );\n // list\n const onContentReviewBeforeList = createTopic<OnContentReviewBeforeListTopicParams>(\n \"apw.onContentReviewBeforeList\"\n );\n return {\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate,\n onContentReviewAfterCreate,\n onContentReviewBeforeUpdate,\n onContentReviewAfterUpdate,\n onContentReviewBeforeDelete,\n onContentReviewAfterDelete,\n onContentReviewBeforeList,\n async get(id) {\n return storageOperations.getContentReview({ id });\n },\n async list(params) {\n const where = params.where || {};\n\n await onContentReviewBeforeList.publish({\n where\n });\n\n if (where.reviewStatus === \"requiresMyAttention\") {\n return filterContentReviewsByRequiresMyAttention({\n listParams: {\n ...params,\n where\n },\n listContentReviews: storageOperations.listContentReviews,\n getReviewer,\n getIdentity\n });\n }\n\n return storageOperations.listContentReviews({\n ...params,\n where\n });\n },\n async create(data: Omit<CreateApwContentReviewParams, \"reviewStatus\">) {\n const input: CreateApwContentReviewParams = {\n ...data,\n reviewStatus: ApwContentReviewStatus.UNDER_REVIEW\n };\n await onContentReviewBeforeCreate.publish({ input });\n\n const contentReview = await storageOperations.createContentReview({\n data: input\n });\n\n await onContentReviewAfterCreate.publish({ contentReview });\n\n return contentReview;\n },\n async update(id, data: UpdateApwContentReviewParams) {\n const original = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeUpdate.publish({ original, input: { id, data } });\n\n const contentReview = await storageOperations.updateContentReview({\n id,\n data\n });\n\n await onContentReviewAfterUpdate.publish({\n original,\n input: { id, data },\n contentReview\n });\n\n return contentReview;\n },\n async delete(id) {\n const contentReview = await storageOperations.getContentReview({ id });\n\n await onContentReviewBeforeDelete.publish({ contentReview });\n\n await storageOperations.deleteContentReview({ id });\n\n await onContentReviewAfterDelete.publish({ contentReview });\n\n return true;\n },\n async provideSignOff(this: ApwContentReviewCrud, id, stepId) {\n const entry: ApwContentReview = await this.get(id);\n const { steps, reviewStatus } = entry;\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n const previousStep = steps[stepIndex - 1];\n\n const identity = getIdentity();\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if previous step is of \"mandatory_blocking\" type and undone.\n */\n if (\n previousStep &&\n previousStep.status !== ApwContentReviewStepStatus.DONE &&\n previousStep.type === ApwWorkflowStepTypes.MANDATORY_BLOCKING\n ) {\n throw new StepMissingError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if there are pending change requests.\n */\n if (currentStep.pendingChangeRequests > 0) {\n throw new PendingChangeRequestsError({ entry, input: { id, step: stepId } });\n }\n /**\n * Don't allow sign off, if current step is not in \"active\" state.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.ACTIVE) {\n throw new StepInActiveError({ entry, input: { id, step: stepId } });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n /*\n * Provide sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.DONE;\n return {\n ...step,\n status: ApwContentReviewStepStatus.DONE,\n signOffProvidedOn: new Date().toISOString(),\n signOffProvidedBy: identity\n };\n }\n /**\n * Update next steps status based on type.\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => typeof step.signOffProvidedOn !== \"string\"\n );\n\n /**\n * If there are no required steps that are pending, set the status to \"READY_TO_BE_PUBLISHED\".\n */\n if (pendingRequiredSteps.length === 0) {\n newStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n /**\n * Save updated steps.\n */\n await this.update(id, {\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async retractSignOff(this: ApwContentReviewCrud, id, stepId) {\n const contentReview = await this.get(id);\n const { steps, reviewStatus, content } = contentReview;\n\n const stepIndex = steps.findIndex(step => step.id === stepId);\n const currentStep = steps[stepIndex];\n\n const identity = getIdentity();\n\n const hasPermission = await hasReviewer({\n getReviewer,\n identity,\n step: currentStep\n });\n\n /**\n * Check whether the retract sign-off is requested by a reviewer.\n */\n if (!hasPermission) {\n throw new NotAuthorizedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n /**\n * Don't allow, if step in not \"done\" i.e. no sign-off was provided for it.\n */\n if (currentStep.status !== ApwContentReviewStepStatus.DONE) {\n throw new NoSignOffProvidedError({\n entry: contentReview,\n input: {\n id,\n step: stepId\n }\n });\n }\n let previousStepStatus: ApwContentReviewStepStatus;\n\n /*\n * Retract sign-off for give step.\n */\n const updatedSteps = steps.map((step, index) => {\n if (index === stepIndex) {\n previousStepStatus = ApwContentReviewStepStatus.ACTIVE;\n return {\n ...step,\n status: previousStepStatus,\n signOffProvidedOn: null,\n signOffProvidedBy: null\n };\n }\n /**\n * Set next step status as \"inactive\".\n */\n if (index > stepIndex) {\n const previousStep = steps[index - 1];\n\n previousStepStatus = getNextStepStatus(previousStep.type, previousStepStatus);\n\n return {\n ...step,\n status: previousStepStatus\n };\n }\n\n return step;\n });\n\n /**\n * Check for pending steps\n */\n let newStatus = reviewStatus;\n const pendingRequiredSteps = getPendingRequiredSteps(\n updatedSteps,\n step => step.signOffProvidedOn === null\n );\n /**\n * If there are required steps that are pending, set the status to \"UNDER_REVIEW\".\n */\n if (pendingRequiredSteps.length !== 0) {\n newStatus = ApwContentReviewStatus.UNDER_REVIEW;\n }\n\n /**\n * We need to delete the scheduled action if one was created.\n */\n const scheduledActionId = contentReview.content?.scheduledActionId;\n if (!!scheduledActionId) {\n await scheduler.delete(scheduledActionId);\n }\n\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n },\n steps: updatedSteps,\n reviewStatus: newStatus\n });\n return true;\n },\n async isReviewRequired(data) {\n const contentGetter = getContentGetter(data.type);\n const content = await contentGetter(data.id, data.settings);\n\n let isReviewRequired = false;\n let contentReviewId: string | null = null;\n\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type: data.type\n });\n\n if (contentApwSettingsPlugin) {\n contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n if (workflowId) {\n isReviewRequired = true;\n }\n }\n\n return {\n isReviewRequired,\n contentReviewId\n };\n },\n async publishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {\n throw new Error({\n message: `Cannot publish content because it is not yet ready to be published.`,\n code: \"NOT_READY_TO_BE_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * And if not, we are publishing immediately.\n */\n if (!datetime) {\n const contentPublisher = getContentPublisher(content.type);\n\n await contentPublisher(content.id, content.settings);\n\n return true;\n }\n\n const data: ApwScheduleActionData = {\n action: ApwScheduleActionTypes.PUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n };\n const scheduledActionId = await this.scheduleAction(data);\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async unpublishContent(this: ApwContentReviewCrud, id: string, datetime) {\n const { content, reviewStatus } = await this.get(id);\n const identity = getIdentity();\n\n if (reviewStatus !== ApwContentReviewStatus.PUBLISHED) {\n throw new Error({\n message: `Cannot unpublish content because it is not yet published.`,\n code: \"NOT_YET_PUBLISHED\",\n data: {\n id,\n status: reviewStatus,\n content\n }\n });\n }\n checkValidDateTime(datetime);\n\n /**\n * If datetime is present it means we're scheduling this action.\n * If not, we are unpublishing immediately.\n */\n if (!datetime) {\n const contentUnPublisher = getContentUnPublisher(content.type);\n\n await contentUnPublisher(content.id, content.settings);\n\n return true;\n }\n\n const scheduledActionId = await this.scheduleAction({\n action: ApwScheduleActionTypes.UNPUBLISH,\n type: content.type,\n entryId: content.id,\n modelId: content.settings?.modelId,\n datetime\n });\n /**\n * Update scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...content,\n scheduledOn: datetime,\n scheduledBy: identity.id,\n scheduledActionId\n }\n });\n\n return true;\n },\n async scheduleAction(data) {\n // Save input in DB\n const scheduledAction = await scheduler.create(data);\n /**\n * This function contains logic of lambda invocation.\n * Current we're not mocking it, therefore, we're just returning true.\n */\n if (process.env.NODE_ENV === \"test\") {\n return scheduledAction.id;\n }\n // Invoke handler\n await handlerClient.invoke({\n name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),\n payload: {\n tenant: getTenant().id,\n locale: getLocale().code\n },\n await: false,\n description: \"APW scheduler handler\"\n });\n return scheduledAction.id;\n },\n async deleteScheduledAction(id) {\n const contentReview = await this.get(id);\n const scheduledActionId = get(contentReview, \"content.scheduledActionId\");\n\n /**\n * Check if there is any action scheduled for this \"content review\".\n */\n if (!scheduledActionId) {\n throw new Error({\n message: `There is no action scheduled for content review.`,\n code: \"NO_ACTION_SCHEDULED\",\n data: {\n id\n }\n });\n }\n /**\n * Delete scheduled action.\n */\n await scheduler.delete(scheduledActionId);\n\n /**\n * Reset scheduled related meta data.\n */\n await this.update(id, {\n content: {\n ...contentReview.content,\n ...INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META\n }\n });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAoBA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAOA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAMA,IAAAQ,yBAAA,GAAAR,OAAA;AAWO,SAASS,0BAA0BA,CACtCC,MAAwC,EACpB;EACpB,MAAM;IACFC,WAAW;IACXC,iBAAiB;IACjBC,WAAW;IACXC,gBAAgB;IAChBC,mBAAmB;IACnBC,qBAAqB;IACrBC,SAAS;IACTC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC;EACJ,CAAC,GAAGX,MA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ACDwB,KAAK,EAAE,KAAK;QACZC,WAAW,EAAE;MACjB,CAAC,CAAC;MACF,OAAOZ,eAAe,CAAC3F,EAAE;IAC7B,CAAC;IACD,MAAMwG,qBAAqBA,CAACxG,EAAE,EAAE;MAC5B,MAAMc,aAAa,GAAG,MAAM,IAAI,CAACf,GAAG,CAACC,EAAE,CAAC;MACxC,MAAM8D,iBAAiB,GAAG,IAAA/D,YAAG,EAACe,aAAa,EAAE,2BAA2B,CAAC;;MAEzE;AACZ;AACA;MACY,IAAI,CAACgD,iBAAiB,EAAE;QACpB,MAAM,IAAIc,cAAK,CAAC;UACZC,OAAO,EAAG,kDAAiD;UAC3DC,IAAI,EAAE,qBAAqB;UAC3BpE,IAAI,EAAE;YACFV;UACJ;QACJ,CAAC,CAAC;MACN;MACA;AACZ;AACA;MACY,MAAMd,SAAS,CAACiC,MAAM,CAAC2C,iBAAiB,CAAC;;MAEzC;AACZ;AACA;MACY,MAAM,IAAI,CAAC9C,MAAM,CAAChB,EAAE,EAAE;QAClB4D,OAAO,EAAE;UACL,GAAG9C,aAAa,CAAC8C,OAAO;UACxB,GAAG6C;QACP;MACJ,CAAC,CAAC;MAEF,OAAO,IAAI;IACf;EACJ,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_pubsub","require","createReviewerMethods","storageOperations","onReviewerBeforeCreate","createTopic","onReviewerAfterCreate","onReviewerBeforeUpdate","onReviewerAfterUpdate","onReviewerBeforeDelete","onReviewerAfterDelete","get","id","getReviewer","list","params","listReviewers","create","data","publish","input","reviewer","createReviewer","update","original","updateReviewer","delete","deleteReviewer"],"sources":["createReviewerMethods.ts"],"sourcesContent":["import {\n ApwReviewerCrud,\n CreateApwParams,\n OnReviewerAfterCreateTopicParams,\n OnReviewerAfterDeleteTopicParams,\n OnReviewerAfterUpdateTopicParams,\n OnReviewerBeforeCreateTopicParams,\n OnReviewerBeforeDeleteTopicParams,\n OnReviewerBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\n\nexport function createReviewerMethods({ storageOperations }: CreateApwParams): ApwReviewerCrud {\n // create\n const onReviewerBeforeCreate = createTopic<OnReviewerBeforeCreateTopicParams>(\n \"apw.onReviewerBeforeCreate\"\n );\n const onReviewerAfterCreate = createTopic<OnReviewerAfterCreateTopicParams>(\n \"apw.onReviewerAfterCreate\"\n );\n // update\n const onReviewerBeforeUpdate = createTopic<OnReviewerBeforeUpdateTopicParams>(\n \"apw.onReviewerBeforeUpdate\"\n );\n const onReviewerAfterUpdate = createTopic<OnReviewerAfterUpdateTopicParams>(\n \"apw.onReviewerAfterUpdate\"\n );\n // delete\n const onReviewerBeforeDelete = createTopic<OnReviewerBeforeDeleteTopicParams>(\n \"apw.onReviewerBeforeDelete\"\n );\n const onReviewerAfterDelete = createTopic<OnReviewerAfterDeleteTopicParams>(\n \"apw.onReviewerAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate,\n onReviewerAfterCreate,\n onReviewerBeforeUpdate,\n onReviewerAfterUpdate,\n onReviewerBeforeDelete,\n onReviewerAfterDelete,\n async get(id) {\n return storageOperations.getReviewer({ id });\n },\n async list(params) {\n return storageOperations.listReviewers(params);\n },\n async create(data) {\n await onReviewerBeforeCreate.publish({ input: data });\n\n const reviewer = await storageOperations.createReviewer({ data });\n\n await onReviewerAfterCreate.publish({ reviewer });\n\n return reviewer;\n },\n async update(id, data) {\n const original = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeUpdate.publish({ original, input: { id, data } });\n\n const reviewer = await storageOperations.updateReviewer({ id, data });\n\n await onReviewerAfterUpdate.publish({ original, input: { id, data }, reviewer });\n\n return reviewer;\n },\n async delete(id: string) {\n const reviewer = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeDelete.publish({ reviewer });\n\n await storageOperations.deleteReviewer({ id });\n\n await onReviewerAfterDelete.publish({ reviewer });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAUA,IAA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MAAML,sBAAsB,CAACY,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK;MAAE,CAAC,CAAC;MAEvE,MAAMG,QAAQ,GAAG,MAAMlB,iBAAiB,CAACsB,cAAc,CAAC;QAAEb,EAAE;QAAEM;MAAK,CAAC,CAAC;MAErE,MAAMV,qBAAqB,CAACW,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK,CAAC;QAAEG;MAAS,CAAC,CAAC;MAEhF,OAAOA,QAAQ;IACnB,CAAC;IACD,MAAMK,MAAMA,CAACd,EAAU,EAAE;MACrB,MAAMS,QAAQ,GAAG,MAAMlB,iBAAiB,CAACU,WAAW,CAAC;QAAED;MAAG,CAAC,CAAC;MAE5D,MAAMH,sBAAsB,CAACU,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAElD,MAAMlB,iBAAiB,CAACwB,cAAc,CAAC;QAAEf;MAAG,CAAC,CAAC;MAE9C,MAAMF,qBAAqB,CAACS,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAEjD,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["_pubsub","require","createReviewerMethods","storageOperations","onReviewerBeforeCreate","createTopic","onReviewerAfterCreate","onReviewerBeforeUpdate","onReviewerAfterUpdate","onReviewerBeforeDelete","onReviewerAfterDelete","get","id","getReviewer","list","params","listReviewers","create","data","publish","input","reviewer","createReviewer","update","original","updateReviewer","delete","deleteReviewer"],"sources":["createReviewerMethods.ts"],"sourcesContent":["import {\n ApwReviewerCrud,\n CreateApwParams,\n OnReviewerAfterCreateTopicParams,\n OnReviewerAfterDeleteTopicParams,\n OnReviewerAfterUpdateTopicParams,\n OnReviewerBeforeCreateTopicParams,\n OnReviewerBeforeDeleteTopicParams,\n OnReviewerBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\n\nexport function createReviewerMethods({ storageOperations }: CreateApwParams): ApwReviewerCrud {\n // create\n const onReviewerBeforeCreate = createTopic<OnReviewerBeforeCreateTopicParams>(\n \"apw.onReviewerBeforeCreate\"\n );\n const onReviewerAfterCreate = createTopic<OnReviewerAfterCreateTopicParams>(\n \"apw.onReviewerAfterCreate\"\n );\n // update\n const onReviewerBeforeUpdate = createTopic<OnReviewerBeforeUpdateTopicParams>(\n \"apw.onReviewerBeforeUpdate\"\n );\n const onReviewerAfterUpdate = createTopic<OnReviewerAfterUpdateTopicParams>(\n \"apw.onReviewerAfterUpdate\"\n );\n // delete\n const onReviewerBeforeDelete = createTopic<OnReviewerBeforeDeleteTopicParams>(\n \"apw.onReviewerBeforeDelete\"\n );\n const onReviewerAfterDelete = createTopic<OnReviewerAfterDeleteTopicParams>(\n \"apw.onReviewerAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate,\n onReviewerAfterCreate,\n onReviewerBeforeUpdate,\n onReviewerAfterUpdate,\n onReviewerBeforeDelete,\n onReviewerAfterDelete,\n async get(id) {\n return storageOperations.getReviewer({ id });\n },\n async list(params) {\n return storageOperations.listReviewers(params);\n },\n async create(data) {\n await onReviewerBeforeCreate.publish({ input: data });\n\n const reviewer = await storageOperations.createReviewer({ data });\n\n await onReviewerAfterCreate.publish({ reviewer });\n\n return reviewer;\n },\n async update(id, data) {\n const original = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeUpdate.publish({ original, input: { id, data } });\n\n const reviewer = await storageOperations.updateReviewer({ id, data });\n\n await onReviewerAfterUpdate.publish({ original, input: { id, data }, reviewer });\n\n return reviewer;\n },\n async delete(id: string) {\n const reviewer = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeDelete.publish({ reviewer });\n\n await storageOperations.deleteReviewer({ id });\n\n await onReviewerAfterDelete.publish({ reviewer });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,qBAAq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AAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK;MAAE,CAAC,CAAC;MAEvE,MAAMG,QAAQ,GAAG,MAAMlB,iBAAiB,CAACsB,cAAc,CAAC;QAAEb,EAAE;QAAEM;MAAK,CAAC,CAAC;MAErE,MAAMV,qBAAqB,CAACW,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK,CAAC;QAAEG;MAAS,CAAC,CAAC;MAEhF,OAAOA,QAAQ;IACnB,CAAC;IACD,MAAMK,MAAMA,CAACd,EAAU,EAAE;MACrB,MAAMS,QAAQ,GAAG,MAAMlB,iBAAiB,CAACU,WAAW,CAAC;QAAED;MAAG,CAAC,CAAC;MAE5D,MAAMH,sBAAsB,CAACU,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAElD,MAAMlB,iBAAiB,CAACwB,cAAc,CAAC;QAAEf;MAAG,CAAC,CAAC;MAE9C,MAAMF,qBAAqB,CAACS,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAEjD,OAAO,IAAI;IACf;EACJ,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_pubsub","require","_apiSecurity","createWorkflowMethods","storageOperations","getPermission","onWorkflowBeforeCreate","createTopic","onWorkflowAfterCreate","onWorkflowBeforeUpdate","onWorkflowAfterUpdate","onWorkflowBeforeDelete","onWorkflowAfterDelete","validateAccess","permission","NotAuthorizedError","message","get","id","getWorkflow","list","params","listWorkflows","create","data","publish","input","workflow","createWorkflow","update","original","updateWorkflow","delete","deleteWorkflow"],"sources":["createWorkflowMethods.ts"],"sourcesContent":["import {\n ApwWorkflowCrud,\n CreateApwParams,\n OnWorkflowAfterCreateTopicParams,\n OnWorkflowAfterDeleteTopicParams,\n OnWorkflowAfterUpdateTopicParams,\n OnWorkflowBeforeCreateTopicParams,\n OnWorkflowBeforeDeleteTopicParams,\n OnWorkflowBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport function createWorkflowMethods({\n storageOperations,\n getPermission\n}: CreateApwParams): ApwWorkflowCrud {\n // create\n const onWorkflowBeforeCreate = createTopic<OnWorkflowBeforeCreateTopicParams>(\n \"apw.onWorkflowBeforeCreate\"\n );\n const onWorkflowAfterCreate = createTopic<OnWorkflowAfterCreateTopicParams>(\n \"apw.onWorkflowAfterCreate\"\n );\n // update\n const onWorkflowBeforeUpdate = createTopic<OnWorkflowBeforeUpdateTopicParams>(\n \"apw.onWorkflowBeforeUpdate\"\n );\n const onWorkflowAfterUpdate = createTopic<OnWorkflowAfterUpdateTopicParams>(\n \"apw.onWorkflowAfterUpdate\"\n );\n // delete\n const onWorkflowBeforeDelete = createTopic<OnWorkflowBeforeDeleteTopicParams>(\n \"apw.onWorkflowBeforeDelete\"\n );\n const onWorkflowAfterDelete = createTopic<OnWorkflowAfterDeleteTopicParams>(\n \"apw.onWorkflowAfterDelete\"\n );\n\n const validateAccess = async (): Promise<void> => {\n const permission = await getPermission(\"apw.publishingWorkflows\");\n if (!!permission) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Not authorized to access publishing workflows.\"\n });\n };\n\n return {\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate,\n onWorkflowAfterCreate,\n onWorkflowBeforeUpdate,\n onWorkflowAfterUpdate,\n onWorkflowBeforeDelete,\n onWorkflowAfterDelete,\n async get(id) {\n return storageOperations.getWorkflow({ id });\n },\n async list(params) {\n return storageOperations.listWorkflows(params || {});\n },\n async create(data) {\n await validateAccess();\n await onWorkflowBeforeCreate.publish({ input: data });\n\n const workflow = await storageOperations.createWorkflow({ data });\n\n await onWorkflowAfterCreate.publish({ workflow });\n\n return workflow;\n },\n async update(id, data) {\n await validateAccess();\n const original = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeUpdate.publish({ original, input: { id, data } });\n\n const workflow = await storageOperations.updateWorkflow({ id, data });\n\n await onWorkflowAfterUpdate.publish({ original, input: { id, data }, workflow });\n\n return workflow;\n },\n async delete(id: string) {\n await validateAccess();\n const workflow = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeDelete.publish({ workflow });\n\n await storageOperations.deleteWorkflow({ id });\n\n await onWorkflowAfterDelete.publish({ workflow });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEO,SAASE,qBAAqBA,CAAC;EAClCC,iBAAiB;EACjBC;AACa,CAAC,EAAmB;EACjC;EACA,MAAMC,sBAAsB,GAAG,IAAAC,mBAAW,EACtC,4BACJ,CAAC;EACD,MAAMC,qBAAqB,GAAG,IAAAD,mBAAW,EACrC,2BACJ,CAAC;EACD;EACA,MAAME,sBAAsB,GAAG,IAAAF,mBAAW,EACtC,4BACJ,CAAC;EACD,MAAMG,qBAAqB,GAAG,IAAAH,mBAAW,EACrC,2BACJ,CAAC;EACD;EACA,MAAMI,sBAAsB,GAAG,IAAAJ,mBAAW,EACtC,4BACJ,CAAC;EACD,MAAMK,qBAAqB,GAAG,IAAAL,mBAAW,EACrC,2BACJ,CAAC;EAED,MAAMM,cAAc,GAAG,MAAAA,CAAA,KAA2B;IAC9C,MAAMC,UAAU,GAAG,MAAMT,aAAa,CAAC,yBAAyB,CAAC;IACjE,IAAI,CAAC,CAACS,UAAU,EAAE;MACd;IACJ;IACA,MAAM,IAAIC,+BAAkB,CAAC;MACzBC,OAAO,EAAE;IACb,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACH;AACR;AACA;IACQV,sBAAsB;IACtBE,qBAAqB;IACrBC,sBAAsB;IACtBC,qBAAqB;IACrBC,sBAAsB;IACtBC,qBAAqB;IACrB,MAAMK,GAAGA,CAACC,EAAE,EAAE;MACV,OAAOd,iBAAiB,CAACe,WAAW,CAAC;QAAED;MAAG,CAAC,CAAC;IAChD,CAAC;IACD,MAAME,IAAI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AAiB,CAAC6B,cAAc,CAAC;QAAEf;MAAG,CAAC,CAAC;MAE9C,MAAMN,qBAAqB,CAACa,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAEjD,OAAO,IAAI;IACf;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["_pubsub","require","_apiSecurity","createWorkflowMethods","storageOperations","getPermission","onWorkflowBeforeCreate","createTopic","onWorkflowAfterCreate","onWorkflowBeforeUpdate","onWorkflowAfterUpdate","onWorkflowBeforeDelete","onWorkflowAfterDelete","validateAccess","permission","NotAuthorizedError","message","get","id","getWorkflow","list","params","listWorkflows","create","data","publish","input","workflow","createWorkflow","update","original","updateWorkflow","delete","deleteWorkflow"],"sources":["createWorkflowMethods.ts"],"sourcesContent":["import {\n ApwWorkflowCrud,\n CreateApwParams,\n OnWorkflowAfterCreateTopicParams,\n OnWorkflowAfterDeleteTopicParams,\n OnWorkflowAfterUpdateTopicParams,\n OnWorkflowBeforeCreateTopicParams,\n OnWorkflowBeforeDeleteTopicParams,\n OnWorkflowBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport function createWorkflowMethods({\n storageOperations,\n getPermission\n}: CreateApwParams): ApwWorkflowCrud {\n // create\n const onWorkflowBeforeCreate = createTopic<OnWorkflowBeforeCreateTopicParams>(\n \"apw.onWorkflowBeforeCreate\"\n );\n const onWorkflowAfterCreate = createTopic<OnWorkflowAfterCreateTopicParams>(\n \"apw.onWorkflowAfterCreate\"\n );\n // update\n const onWorkflowBeforeUpdate = createTopic<OnWorkflowBeforeUpdateTopicParams>(\n \"apw.onWorkflowBeforeUpdate\"\n );\n const onWorkflowAfterUpdate = createTopic<OnWorkflowAfterUpdateTopicParams>(\n \"apw.onWorkflowAfterUpdate\"\n );\n // delete\n const onWorkflowBeforeDelete = createTopic<OnWorkflowBeforeDeleteTopicParams>(\n \"apw.onWorkflowBeforeDelete\"\n );\n const onWorkflowAfterDelete = createTopic<OnWorkflowAfterDeleteTopicParams>(\n \"apw.onWorkflowAfterDelete\"\n );\n\n const validateAccess = async (): Promise<void> => {\n const permission = await getPermission(\"apw.publishingWorkflows\");\n if (!!permission) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Not authorized to access publishing workflows.\"\n });\n };\n\n return {\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate,\n onWorkflowAfterCreate,\n onWorkflowBeforeUpdate,\n onWorkflowAfterUpdate,\n onWorkflowBeforeDelete,\n onWorkflowAfterDelete,\n async get(id) {\n return storageOperations.getWorkflow({ id });\n },\n async list(params) {\n return storageOperations.listWorkflows(params || {});\n },\n async create(data) {\n await validateAccess();\n await onWorkflowBeforeCreate.publish({ input: data });\n\n const workflow = await storageOperations.createWorkflow({ data });\n\n await onWorkflowAfterCreate.publish({ workflow });\n\n return workflow;\n },\n async update(id, data) {\n await validateAccess();\n const original = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeUpdate.publish({ original, input: { id, data } });\n\n const workflow = await storageOperations.updateWorkflow({ id, data });\n\n await onWorkflowAfterUpdate.publish({ original, input: { id, data }, workflow });\n\n return workflow;\n },\n async delete(id: string) {\n await validateAccess();\n const workflow = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeDelete.publish({ workflow });\n\n await storageOperations.deleteWorkflow({ id });\n\n await onWorkflowAfterDelete.publish({ workflow });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEO,SAASE,qBAAqBA,CAAC;EAClCC,iBAAiB;EACjBC;AACa,CAAC,EAAmB;EACjC;EACA,MAAMC,sBAAsB,GAAG,IAAAC,mBAAW,EACtC,4BACJ,CAAC;EACD,MAAMC,qBAAqB,GAAG,IAAAD,mBAAW,EACrC,2BACJ,CAAC;EACD;EACA,MAAME,sBAAsB,GAAG,IAAAF,mBAAW,EACtC,4BACJ,CA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,CAACe,WAAW,CAAC;QAAED;MAAG,CAAC,CAAC;MAE5D,MAAMT,sBAAsB,CAACgB,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK;MAAE,CAAC,CAAC;MAEvE,MAAMG,QAAQ,GAAG,MAAMvB,iBAAiB,CAAC2B,cAAc,CAAC;QAAEb,EAAE;QAAEM;MAAK,CAAC,CAAC;MAErE,MAAMd,qBAAqB,CAACe,OAAO,CAAC;QAAEK,QAAQ;QAAEJ,KAAK,EAAE;UAAER,EAAE;UAAEM;QAAK,CAAC;QAAEG;MAAS,CAAC,CAAC;MAEhF,OAAOA,QAAQ;IACnB,CAAC;IACD,MAAMK,MAAMA,CAACd,EAAU,EAAE;MACrB,MAAML,cAAc,CAAC,CAAC;MACtB,MAAMc,QAAQ,GAAG,MAAMvB,iBAAiB,CAACe,WAAW,CAAC;QAAED;MAAG,CAAC,CAAC;MAE5D,MAAMP,sBAAsB,CAACc,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAElD,MAAMvB,iBAAiB,CAAC6B,cAAc,CAAC;QAAEf;MAAG,CAAC,CAAC;MAE9C,MAAMN,qBAAqB,CAACa,OAAO,CAAC;QAAEE;MAAS,CAAC,CAAC;MAEjD,OAAO,IAAI;IACf;EACJ,CAAC;AACL","ignoreList":[]}
package/crud/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_createWorkflowMethods","require","_createReviewerMethods","_createCommentMethods","_createChangeRequestMethods","_createContentReviewMethods","createApw","params","contentGetters","Map","contentPublisher","contentUnPublisher","workflowMethods","createWorkflowMethods","reviewerMethods","createReviewerMethods","changeRequestMethods","createChangeRequestMethods","getContentGetter","type","getter","get","Error","getContentUnPublisher","getContentPublisher","addContentPublisher","func","set","addContentGetter","addContentUnPublisher","workflow","reviewer","changeRequest","comment","createCommentMethods","contentReview","createContentReviewMethods","getReviewer","bind","scheduleAction","scheduler","exports"],"sources":["index.ts"],"sourcesContent":["import { createWorkflowMethods } from \"./createWorkflowMethods\";\nimport { createReviewerMethods } from \"./createReviewerMethods\";\nimport { createCommentMethods } from \"./createCommentMethods\";\nimport { createChangeRequestMethods } from \"./createChangeRequestMethods\";\nimport { createContentReviewMethods } from \"./createContentReviewMethods\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentTypes,\n ContentGetter,\n ContentPublisher,\n ContentUnPublisher,\n CreateApwParams\n} from \"~/types\";\n\nexport const createApw = (params: CreateApwParams): AdvancedPublishingWorkflow => {\n const contentGetters = new Map<ApwContentTypes, ContentGetter>();\n const contentPublisher = new Map<ApwContentTypes, ContentPublisher>();\n const contentUnPublisher = new Map<ApwContentTypes, ContentUnPublisher>();\n\n const workflowMethods = createWorkflowMethods(params);\n const reviewerMethods = createReviewerMethods(params);\n const changeRequestMethods = createChangeRequestMethods(params);\n\n function getContentGetter(type: ApwContentTypes) {\n const getter = contentGetters.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentGetter\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentUnPublisher(type: ApwContentTypes) {\n const getter = contentUnPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"Content UnPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentPublisher(type: ApwContentTypes) {\n const getter = contentPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n return {\n addContentPublisher(type, func) {\n contentPublisher.set(type, func);\n },\n getContentPublisher,\n addContentGetter(type, func) {\n contentGetters.set(type, func);\n },\n getContentGetter,\n addContentUnPublisher(type, func) {\n contentUnPublisher.set(type, func);\n },\n getContentUnPublisher,\n workflow: workflowMethods,\n reviewer: reviewerMethods,\n changeRequest: changeRequestMethods,\n comment: createCommentMethods(params),\n contentReview: createContentReviewMethods({\n ...params,\n getReviewer: reviewerMethods.get.bind(reviewerMethods),\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher\n }),\n /**\n * Add scheduler to context so that we can access it later. For example, during testing.\n */\n scheduleAction: params.scheduler\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AAUO,MAAMK,SAAS,GAAIC,MAAuB,IAAiC;EAC9E,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAAiC,CAAC;EAChE,MAAMC,gBAAgB,GAAG,IAAID,GAAG,CAAoC,CAAC;EACrE,MAAME,kBAAkB,GAAG,IAAIF,GAAG,CAAsC,CAAC;EAEzE,MAAMG,eAAe,GAAG,IAAAC,4CAAqB,EAACN,MAAM,CAAC;EACrD,MAAMO,eAAe,GAAG,IAAAC,4CAAqB,EAACR,MAAM,CAAC;EACrD,MAAMS,oBAAoB,GAAG,IAAAC,sDAA0B,EAACV,MAAM,CAAC;EAE/D,SAASW,gBAAgBA,CAACC,IAAqB,EAAE;IAC7C,MAAMC,MAAM,GAAGZ,cAAc,CAACa,GAAG,CAACF,IAAI,CAAC;IACvC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,8CAA6CH,IAAK,8BACvD,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,SAASG,qBAAqBA,CAACJ,IAAqB,EAAE;IAClD,MAAMC,MAAM,GAAGT,kBAAkB,CAACU,GAAG,CAACF,IAAI,CAAC;IAC3C,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,oDAAmDH,IAAK,8BAC7D,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,SAASI,mBAAmBA,CAACL,IAAqB,EAAE;IAChD,MAAMC,MAAM,GAAGV,gBAAgB,CAACW,GAAG,CAACF,IAAI,CAAC;IACzC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,iDAAgDH,IAAK,8BAC1D,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,OAAO;IACHK,mBAAmBA,CAACN,IAAI,EAAEO,IAAI,EAAE;MAC5BhB,gBAAgB,CAACiB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IACpC,CAAC;IACDF,mBAAmB;IACnBI,gBAAgBA,CAACT,IAAI,EAAEO,IAAI,EAAE;MACzBlB,cAAc,CAACmB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IAClC,CAAC;IACDR,gBAAgB;IAChBW,qBAAqBA,CAACV,IAAI,EAAEO,IAAI,EAAE;MAC9Bf,kBAAkB,CAACgB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IACtC,CAAC;IACDH,qBAAqB;IACrBO,QAAQ,EAAElB,eAAe;IACzBmB,QAAQ,EAAEjB,eAAe;IACzBkB,aAAa,EAAEhB,oBAAoB;IACnCiB,OAAO,EAAE,IAAAC,0CAAoB,EAAC3B,MAAM,CAAC;IACrC4B,aAAa,EAAE,IAAAC,sDAA0B,EAAC;MACtC,GAAG7B,MAAM;MACT8B,WAAW,EAAEvB,eAAe,CAACO,GAAG,CAACiB,IAAI,CAACxB,eAAe,CAAC;MACtDI,gBAAgB;MAChBM,mBAAmB;MACnBD;IACJ,CAAC,CAAC;IACF;AACR;AACA;IACQgB,cAAc,EAAEhC,MAAM,CAACiC;EAC3B,CAAC;AACL,CAAC;AAACC,OAAA,CAAAnC,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_createWorkflowMethods","require","_createReviewerMethods","_createCommentMethods","_createChangeRequestMethods","_createContentReviewMethods","createApw","params","contentGetters","Map","contentPublisher","contentUnPublisher","workflowMethods","createWorkflowMethods","reviewerMethods","createReviewerMethods","changeRequestMethods","createChangeRequestMethods","getContentGetter","type","getter","get","Error","getContentUnPublisher","getContentPublisher","addContentPublisher","func","set","addContentGetter","addContentUnPublisher","workflow","reviewer","changeRequest","comment","createCommentMethods","contentReview","createContentReviewMethods","getReviewer","bind","scheduleAction","scheduler","exports"],"sources":["index.ts"],"sourcesContent":["import { createWorkflowMethods } from \"./createWorkflowMethods\";\nimport { createReviewerMethods } from \"./createReviewerMethods\";\nimport { createCommentMethods } from \"./createCommentMethods\";\nimport { createChangeRequestMethods } from \"./createChangeRequestMethods\";\nimport { createContentReviewMethods } from \"./createContentReviewMethods\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentTypes,\n ContentGetter,\n ContentPublisher,\n ContentUnPublisher,\n CreateApwParams\n} from \"~/types\";\n\nexport const createApw = (params: CreateApwParams): AdvancedPublishingWorkflow => {\n const contentGetters = new Map<ApwContentTypes, ContentGetter>();\n const contentPublisher = new Map<ApwContentTypes, ContentPublisher>();\n const contentUnPublisher = new Map<ApwContentTypes, ContentUnPublisher>();\n\n const workflowMethods = createWorkflowMethods(params);\n const reviewerMethods = createReviewerMethods(params);\n const changeRequestMethods = createChangeRequestMethods(params);\n\n function getContentGetter(type: ApwContentTypes) {\n const getter = contentGetters.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentGetter\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentUnPublisher(type: ApwContentTypes) {\n const getter = contentUnPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"Content UnPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentPublisher(type: ApwContentTypes) {\n const getter = contentPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n return {\n addContentPublisher(type, func) {\n contentPublisher.set(type, func);\n },\n getContentPublisher,\n addContentGetter(type, func) {\n contentGetters.set(type, func);\n },\n getContentGetter,\n addContentUnPublisher(type, func) {\n contentUnPublisher.set(type, func);\n },\n getContentUnPublisher,\n workflow: workflowMethods,\n reviewer: reviewerMethods,\n changeRequest: changeRequestMethods,\n comment: createCommentMethods(params),\n contentReview: createContentReviewMethods({\n ...params,\n getReviewer: reviewerMethods.get.bind(reviewerMethods),\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher\n }),\n /**\n * Add scheduler to context so that we can access it later. For example, during testing.\n */\n scheduleAction: params.scheduler\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AAUO,MAAMK,SAAS,GAAIC,MAAuB,IAAiC;EAC9E,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAAiC,CAAC;EAChE,MAAMC,gBAAgB,GAAG,IAAID,GAAG,CAAoC,CAAC;EACrE,MAAME,kBAAkB,GAAG,IAAIF,GAAG,CAAsC,CAAC;EAEzE,MAAMG,eAAe,GAAG,IAAAC,4CAAqB,EAACN,MAAM,CAAC;EACrD,MAAMO,eAAe,GAAG,IAAAC,4CAAqB,EAACR,MAAM,CAAC;EACrD,MAAMS,oBAAoB,GAAG,IAAAC,sDAA0B,EAACV,MAAM,CAAC;EAE/D,SAASW,gBAAgBA,CAACC,IAAqB,EAAE;IAC7C,MAAMC,MAAM,GAAGZ,cAAc,CAACa,GAAG,CAACF,IAAI,CAAC;IACvC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,8CAA6CH,IAAK,8BACvD,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,SAASG,qBAAqBA,CAACJ,IAAqB,EAAE;IAClD,MAAMC,MAAM,GAAGT,kBAAkB,CAACU,GAAG,CAACF,IAAI,CAAC;IAC3C,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,oDAAmDH,IAAK,8BAC7D,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,SAASI,mBAAmBA,CAACL,IAAqB,EAAE;IAChD,MAAMC,MAAM,GAAGV,gBAAgB,CAACW,GAAG,CAACF,IAAI,CAAC;IACzC,IAAI,CAACC,MAAM,EAAE;MACT,MAAM,IAAIE,KAAK,CACV,iDAAgDH,IAAK,8BAC1D,CAAC;IACL;IACA,OAAOC,MAAM;EACjB;EAEA,OAAO;IACHK,mBAAmBA,CAACN,IAAI,EAAEO,IAAI,EAAE;MAC5BhB,gBAAgB,CAACiB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IACpC,CAAC;IACDF,mBAAmB;IACnBI,gBAAgBA,CAACT,IAAI,EAAEO,IAAI,EAAE;MACzBlB,cAAc,CAACmB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IAClC,CAAC;IACDR,gBAAgB;IAChBW,qBAAqBA,CAACV,IAAI,EAAEO,IAAI,EAAE;MAC9Bf,kBAAkB,CAACgB,GAAG,CAACR,IAAI,EAAEO,IAAI,CAAC;IACtC,CAAC;IACDH,qBAAqB;IACrBO,QAAQ,EAAElB,eAAe;IACzBmB,QAAQ,EAAEjB,eAAe;IACzBkB,aAAa,EAAEhB,oBAAoB;IACnCiB,OAAO,EAAE,IAAAC,0CAAoB,EAAC3B,MAAM,CAAC;IACrC4B,aAAa,EAAE,IAAAC,sDAA0B,EAAC;MACtC,GAAG7B,MAAM;MACT8B,WAAW,EAAEvB,eAAe,CAACO,GAAG,CAACiB,IAAI,CAACxB,eAAe,CAAC;MACtDI,gBAAgB;MAChBM,mBAAmB;MACnBD;IACJ,CAAC,CAAC;IACF;AACR;AACA;IACQgB,cAAc,EAAEhC,MAAM,CAACiC;EAC3B,CAAC;AACL,CAAC;AAACC,OAAA,CAAAnC,SAAA,GAAAA,SAAA","ignoreList":[]}
package/crud/utils.js CHANGED
@@ -47,12 +47,11 @@ const getPendingRequiredSteps = (steps, predicate) => {
47
47
  });
48
48
  };
49
49
  exports.getPendingRequiredSteps = getPendingRequiredSteps;
50
- const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
50
+ const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
51
51
  scheduledOn: null,
52
52
  scheduledBy: null,
53
53
  scheduledActionId: null
54
54
  };
55
- exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META;
56
55
  /**
57
56
  * Filter "content reviews" that are "underReview" and current user is a reviewer for the active step.
58
57
  * That is the user is able to provide sign-off or comment.
package/crud/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_dayjs","_utc","_set","_types","dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","exports","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","structuredClone","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n structuredClone(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAWAK,cAAK,CAACC,MAAM,CAACC,YAAG,CAAC;AAEV,SAASC,kBAAkBA,CAACC,QAA4B,EAAQ;EACnE,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAE;IAC9B;EACJ;EAEA,IAAI,CAAC,IAAAJ,cAAK,EAACI,QAAQ,CAAC,CAACC,OAAO,CAAC,CAAC,EAAE;IAC5B,MAAM,IAAIC,cAAK,CAAC;MACZC,OAAO,EAAG,mDAAkD;MAC5DC,IAAI,EAAE,yBAAyB;MAC/BC,IAAI,EAAE;QACFL;MACJ;IACJ,CAAC,CAAC;EACN;EACA,MAAMM,KAAK,GAAGV,cAAK,CAACE,GAAG,CAAC,CAAC;EAEzB,IAAI,IAAAF,cAAK,EAACI,QAAQ,CAAC,CAACO,QAAQ,CAACD,KAAK,CAAC,EAAE;IACjC,MAAM,IAAIJ,cAAK,CAAC;MACZC,OAAO,EAAG,wCA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AAME,aAAa,GAAGN,cAAc,CAACI,CAAC,CAAC;IAEvC,MAAMG,UAAU,GAAGD,aAAa,CAAChC,KAAK,CAACkC,IAAI,CACvC/B,IAAI,IAAIA,IAAI,CAACgC,MAAM,KAAKC,iCAA0B,CAACC,MACvD,CAAC;IAED,IAAI,CAACJ,UAAU,EAAE;MACb;IACJ;IAEA,IAAIK,mBAAmB,GAAG,KAAK;IAE/B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,UAAU,CAACO,SAAS,CAACT,MAAM,EAAEQ,CAAC,EAAE,EAAE;MAClD,MAAM;QAAEE;MAAG,CAAC,GAAGR,UAAU,CAACO,SAAS,CAACD,CAAC,CAAC;MACtC;AACZ;AACA;MACY,MAAMG,QAAQ,GAAG,MAAMtB,WAAW,CAACqB,EAAE,CAAC;MACtC;AACZ;AACA;MACY,IAAIC,QAAQ,CAACC,UAAU,KAAKf,QAAQ,CAACa,EAAE,EAAE;QACrCH,mBAAmB,GAAG,IAAI;QAC1B;MACJ;IACJ;IAEA,IAAIA,mBAAmB,EAAE;MACrBT,aAAa,CAACe,IAAI,CAACZ,aAAa,CAAC;IACrC;EACJ;EAEA,OAAO,CACHH,aAAa,EACb;IACI,GAAGF,IAAI;IACPkB,UAAU,EAAEhB,aAAa,CAACE;EAC9B,CAAC,CACJ;AACL,CAAC;AAACrB,OAAA,CAAAK,yCAAA,GAAAA,yCAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_dayjs","_utc","_set","_types","dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","exports","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","structuredClone","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n structuredClone(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAWAK,cAAK,CAACC,MAAM,CAACC,YAAG,CAAC;AAEV,SAASC,kBAAkBA,CAACC,Q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;IACI,GAAGF,IAAI;IACPkB,UAAU,EAAEhB,aAAa,CAACE;EAC9B,CAAC,CACJ;AACL,CAAC;AAACrB,OAAA,CAAAK,yCAAA,GAAAA,yCAAA","ignoreList":[]}
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_graphql","_interopRequireDefault","require","_context","_apiMailer","_apiAdminSettings","createApwPageBuilderContext","params","createAdminSettingsContext","createMailerContext","createMailerGraphQL","createPageBuilder","exports","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport { createApwPageBuilderContext as createPageBuilder } from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AARA;AACA;AACA;AACA;;AAOO,MAAMI,2BAA2B,GAAIC,MAA8B,IAAK;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAA0B,EAAC,CAAC,EAC/B,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EACxB,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EACxB,IAAAC,oCAAiB,EAACJ,MAAM,CAAC,CAC5B;AACL,CAAC;AAACK,OAAA,CAAAN,2BAAA,GAAAA,2BAAA;AAEK,MAAMO,gBAAgB,GAAGA,CAAA,KAAM;EAClC,OAAO,CAAC,IAAAC,gBAAO,EAAC,CAAC,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_graphql","_interopRequireDefault","require","_context","_apiMailer","_apiAdminSettings","createApwPageBuilderContext","params","createAdminSettingsContext","createMailerContext","createMailerGraphQL","createPageBuilder","exports","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport { createApwPageBuilderContext as createPageBuilder } from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AARA;AACA;AACA;AACA;;AAOO,MAAMI,2BAA2B,GAAIC,MAA8B,IAAK;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAA0B,EAAC,CAAC,EAC/B,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EACxB,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EACxB,IAAAC,oCAAiB,EAACJ,MAAM,CAAC,CAC5B;AACL,CAAC;AAACK,OAAA,CAAAN,2BAAA,GAAAA,2BAAA;AAEK,MAAMO,gBAAgB,GAAGA,CAAA,KAAM;EAClC,OAAO,CAAC,IAAAC,gBAAO,EAAC,CAAC,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-apw",
3
- "version": "5.40.0-beta.2",
3
+ "version": "5.40.0-beta.3",
4
4
  "keywords": [
5
5
  "apw:base"
6
6
  ],
@@ -14,45 +14,45 @@
14
14
  "author": "Webiny Ltd",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@babel/runtime": "7.22.6",
17
+ "@babel/runtime": "7.24.1",
18
18
  "@commodo/fields": "1.1.2-beta.20",
19
- "@webiny/api": "5.40.0-beta.2",
20
- "@webiny/api-admin-settings": "5.40.0-beta.2",
21
- "@webiny/api-headless-cms": "5.40.0-beta.2",
22
- "@webiny/api-i18n": "5.40.0-beta.2",
23
- "@webiny/api-mailer": "5.40.0-beta.2",
24
- "@webiny/api-page-builder": "5.40.0-beta.2",
25
- "@webiny/api-security": "5.40.0-beta.2",
26
- "@webiny/api-tenancy": "5.40.0-beta.2",
27
- "@webiny/api-wcp": "5.40.0-beta.2",
28
- "@webiny/aws-sdk": "5.40.0-beta.2",
29
- "@webiny/db-dynamodb": "5.40.0-beta.2",
30
- "@webiny/error": "5.40.0-beta.2",
31
- "@webiny/handler": "5.40.0-beta.2",
32
- "@webiny/handler-client": "5.40.0-beta.2",
33
- "@webiny/handler-db": "5.40.0-beta.2",
34
- "@webiny/handler-graphql": "5.40.0-beta.2",
35
- "@webiny/handler-logs": "5.40.0-beta.2",
36
- "@webiny/plugins": "5.40.0-beta.2",
37
- "@webiny/pubsub": "5.40.0-beta.2",
38
- "@webiny/utils": "5.40.0-beta.2",
39
- "@webiny/validation": "5.40.0-beta.2",
19
+ "@webiny/api": "5.40.0-beta.3",
20
+ "@webiny/api-admin-settings": "5.40.0-beta.3",
21
+ "@webiny/api-headless-cms": "5.40.0-beta.3",
22
+ "@webiny/api-i18n": "5.40.0-beta.3",
23
+ "@webiny/api-mailer": "5.40.0-beta.3",
24
+ "@webiny/api-page-builder": "5.40.0-beta.3",
25
+ "@webiny/api-security": "5.40.0-beta.3",
26
+ "@webiny/api-tenancy": "5.40.0-beta.3",
27
+ "@webiny/api-wcp": "5.40.0-beta.3",
28
+ "@webiny/aws-sdk": "5.40.0-beta.3",
29
+ "@webiny/db-dynamodb": "5.40.0-beta.3",
30
+ "@webiny/error": "5.40.0-beta.3",
31
+ "@webiny/handler": "5.40.0-beta.3",
32
+ "@webiny/handler-client": "5.40.0-beta.3",
33
+ "@webiny/handler-db": "5.40.0-beta.3",
34
+ "@webiny/handler-graphql": "5.40.0-beta.3",
35
+ "@webiny/handler-logs": "5.40.0-beta.3",
36
+ "@webiny/plugins": "5.40.0-beta.3",
37
+ "@webiny/pubsub": "5.40.0-beta.3",
38
+ "@webiny/utils": "5.40.0-beta.3",
39
+ "@webiny/validation": "5.40.0-beta.3",
40
40
  "dayjs": "1.11.7",
41
41
  "lodash": "4.17.21"
42
42
  },
43
43
  "devDependencies": {
44
- "@babel/cli": "7.22.6",
45
- "@babel/core": "7.22.8",
46
- "@babel/preset-env": "7.22.7",
47
- "@webiny/cli": "5.40.0-beta.2",
48
- "@webiny/handler-aws": "5.40.0-beta.2",
49
- "@webiny/project-utils": "5.40.0-beta.2",
50
- "@webiny/wcp": "5.40.0-beta.2",
44
+ "@babel/cli": "7.24.1",
45
+ "@babel/core": "7.24.3",
46
+ "@babel/preset-env": "7.24.3",
47
+ "@webiny/cli": "5.40.0-beta.3",
48
+ "@webiny/handler-aws": "5.40.0-beta.3",
49
+ "@webiny/project-utils": "5.40.0-beta.3",
50
+ "@webiny/wcp": "5.40.0-beta.3",
51
51
  "get-yarn-workspaces": "1.0.2",
52
52
  "graphql": "15.8.0",
53
- "jest": "29.5.0",
53
+ "jest": "29.7.0",
54
54
  "prettier": "2.8.8",
55
- "rimraf": "3.0.2",
55
+ "rimraf": "5.0.5",
56
56
  "sinon": "9.2.4",
57
57
  "ttypescript": "1.5.15",
58
58
  "typescript": "4.7.4"
@@ -65,5 +65,5 @@
65
65
  "build": "yarn webiny run build",
66
66
  "watch": "yarn webiny run watch"
67
67
  },
68
- "gitHead": "15e414a228687140ce2f30bd2f55763368e99827"
68
+ "gitHead": "638d8b84063906cd1aa979ed6e0487ad26fbcf2f"
69
69
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","CmsEntryApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","CMS_ENTRY","setWorkflowId","entry","id","meta","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId","exports"],"sources":["CmsEntryApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { ApwContentTypes } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class CmsEntryApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.CMS_ENTRY;\n }\n\n public override setWorkflowId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.workflowId || null;\n }\n\n public override setContentReviewId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", id);\n }\n public override getContentReviewId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.contentReviewId || null;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEO,MAAMI,+BAA+B,SAASC,kDAAwB,CAAC;EAC1DC,MAAMA,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,SAAS;EAC7C;EAEgBC,aAAaA,CAACC,KAAe,EAAEC,EAAiB,EAAE;IAC9DD,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAC5D;EAEgBG,aAAaA,CAACJ,KAAe,EAAiB;IAC1D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEC,UAAU,IAAI,IAAI;EAC7C;EAEgBC,kBAAkBA,CAACP,KAAe,EAAEC,EAAiB,EAAE;IACnED,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACjE;EACgBO,kBAAkBA,CAACR,KAAe,EAAiB;IAC/D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEI,eAAe,IAAI,IAAI;EAClD;AACJ;AAACC,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA"}
1
+ {"version":3,"names":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","CmsEntryApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","CMS_ENTRY","setWorkflowId","entry","id","meta","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId","exports"],"sources":["CmsEntryApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { ApwContentTypes } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class CmsEntryApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.CMS_ENTRY;\n }\n\n public override setWorkflowId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.workflowId || null;\n }\n\n public override setContentReviewId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", id);\n }\n public override getContentReviewId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.contentReviewId || null;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEO,MAAMI,+BAA+B,SAASC,kDAAwB,CAAC;EAC1DC,MAAMA,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,SAAS;EAC7C;EAEgBC,aAAaA,CAACC,KAAe,EAAEC,EAAiB,EAAE;IAC9DD,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAC5D;EAEgBG,aAAaA,CAACJ,KAAe,EAAiB;IAC1D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEC,UAAU,IAAI,IAAI;EAC7C;EAEgBC,kBAAkBA,CAACP,KAAe,EAAEC,EAAiB,EAAE;IACnED,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACjE;EACgBO,kBAAkBA,CAACR,KAAe,EAAiB;IAC/D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEI,eAAe,IAAI,IAAI;EAClD;AACJ;AAACC,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -13,7 +13,16 @@ const apwEntryPlugins = params => {
13
13
  } = params;
14
14
  apw.addContentGetter(_types.ApwContentTypes.CMS_ENTRY, async (id, settings) => {
15
15
  const model = await (0, _utils.fetchModel)(cms, id, settings);
16
- const item = await cms.getEntryById(model, id);
16
+ const item = await cms.getEntry(model, {
17
+ where: {
18
+ OR: [{
19
+ id
20
+ }, {
21
+ entryId: id
22
+ }],
23
+ latest: true
24
+ }
25
+ });
17
26
  if (!item) {
18
27
  return null;
19
28
  }