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

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":["_apiHeadlessCms","require","_utils","bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","exports","createChangeRequestModel","createPrivateModel","modelId","titleFieldId","fields"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst bodyField = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"changeRequest\"\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"changeRequest\"\n });\n\nconst resolvedField = () =>\n createModelField({\n label: \"Resolved\",\n type: \"boolean\",\n parent: \"changeRequest\"\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"changeRequest\"\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"changeRequest\",\n validation: [\n {\n message: \"`step` field value is required in changeRequest.\",\n name: \"required\"\n }\n ]\n });\n\nexport const CHANGE_REQUEST_MODEL_ID = \"apwChangeRequestModelDefinition\";\n\nexport const createChangeRequestModel = () => {\n return createPrivateModel({\n name: \"APW - Change Request\",\n modelId: CHANGE_REQUEST_MODEL_ID,\n titleFieldId: \"title\",\n fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAJ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAME,aAAa,GAAGA,CAAA,KAClB,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAN,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMI,SAAS,GAAGA,CAAA,KACd,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,eAAe;EACvBK,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,kDAAkD;IAC3DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,uBAAuB,GAAG,iCAAiC;AAACC,OAAA,CAAAD,uBAAA,GAAAA,uBAAA;AAElE,MAAME,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO,IAAAC,kCAAkB,EAAC;IACtBJ,IAAI,EAAE,sBAAsB;IAC5BK,OAAO,EAAEJ,uBAAuB;IAChCK,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE,CAAClB,SAAS,CAAC,CAAC,EAAEK,UAAU,CAAC,CAAC,EAAEC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC;EAClF,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAC,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","exports","createChangeRequestModel","createPrivateModel","modelId","titleFieldId","fields"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst bodyField = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"changeRequest\"\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"changeRequest\"\n });\n\nconst resolvedField = () =>\n createModelField({\n label: \"Resolved\",\n type: \"boolean\",\n parent: \"changeRequest\"\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"changeRequest\"\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"changeRequest\",\n validation: [\n {\n message: \"`step` field value is required in changeRequest.\",\n name: \"required\"\n }\n ]\n });\n\nexport const CHANGE_REQUEST_MODEL_ID = \"apwChangeRequestModelDefinition\";\n\nexport const createChangeRequestModel = () => {\n return createPrivateModel({\n name: \"APW - Change Request\",\n modelId: CHANGE_REQUEST_MODEL_ID,\n titleFieldId: \"title\",\n fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAJ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAME,aAAa,GAAGA,CAAA,KAClB,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAN,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMI,SAAS,GAAGA,CAAA,KACd,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,eAAe;EACvBK,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,kDAAkD;IAC3DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,iCAAiC;AAEjE,MAAME,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO,IAAAC,kCAAkB,EAAC;IACtBJ,IAAI,EAAE,sBAAsB;IAC5BK,OAAO,EAAEJ,uBAAuB;IAChCK,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE,CAAClB,SAAS,CAAC,CAAC,EAAEK,UAAU,CAAC,CAAC,EAAEC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC;EAClF,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -35,8 +35,7 @@ const mediaField = () => (0, _utils.createModelField)({
35
35
  type: "file",
36
36
  parent: "comment"
37
37
  });
38
- const COMMENT_MODEL_ID = "apwCommentModelDefinition";
39
- exports.COMMENT_MODEL_ID = COMMENT_MODEL_ID;
38
+ const COMMENT_MODEL_ID = exports.COMMENT_MODEL_ID = "apwCommentModelDefinition";
40
39
  const createCommentModel = ({
41
40
  modelId
42
41
  }) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_apiHeadlessCms","require","_utils","commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","exports","createCommentModel","createPrivateModel","titleFieldId","fields"],"sources":["comment.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst commentBody = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"comment\"\n });\n\nconst changeRequestRef = (modelId: string) =>\n createModelField({\n label: \"Change Request\",\n type: \"ref\",\n parent: \"comment\",\n settings: {\n models: [\n {\n modelId\n }\n ]\n }\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"comment\",\n validation: [\n {\n message: \"`step` field value is required in comment.\",\n name: \"required\"\n }\n ]\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"comment\"\n });\n\ninterface CreateCommentModelDefinitionParams {\n modelId: string;\n}\n\nexport const COMMENT_MODEL_ID = \"apwCommentModelDefinition\";\n\nexport const createCommentModel = ({ modelId }: CreateCommentModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Comment\",\n modelId: COMMENT_MODEL_ID,\n titleFieldId: \"step\",\n fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,WAAW,GAAGA,CAAA,KAChB,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,gBAAgB,GAAIC,OAAe,IACrC,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,gBAAgB;EACvBC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,SAAS;EACjBG,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ;MACIF;IACJ,CAAC;EAET;AACJ,CAAC,CAAC;AAEN,MAAMG,SAAS,GAAGA,CAAA,KACd,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,SAAS;EACjBM,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,4CAA4C;IACrDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAZ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAMC,MAAMU,gBAAgB,GAAG,2BAA2B;AAACC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AAErD,MAAME,kBAAkB,GAAGA,CAAC;EAAEV;AAA4C,CAAC,KAAK;EACnF,OAAO,IAAAW,kCAAkB,EAAC;IACtBL,IAAI,EAAE,eAAe;IACrBN,OAAO,EAAEQ,gBAAgB;IACzBI,YAAY,EAAE,MAAM;IACpBC,MAAM,EAAE,CAACnB,WAAW,CAAC,CAAC,EAAEK,gBAAgB,CAACC,OAAO,CAAC,EAAEG,SAAS,CAAC,CAAC,EAAEI,UAAU,CAAC,CAAC;EAChF,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAC,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","exports","createCommentModel","createPrivateModel","titleFieldId","fields"],"sources":["comment.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst commentBody = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"comment\"\n });\n\nconst changeRequestRef = (modelId: string) =>\n createModelField({\n label: \"Change Request\",\n type: \"ref\",\n parent: \"comment\",\n settings: {\n models: [\n {\n modelId\n }\n ]\n }\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"comment\",\n validation: [\n {\n message: \"`step` field value is required in comment.\",\n name: \"required\"\n }\n ]\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"comment\"\n });\n\ninterface CreateCommentModelDefinitionParams {\n modelId: string;\n}\n\nexport const COMMENT_MODEL_ID = \"apwCommentModelDefinition\";\n\nexport const createCommentModel = ({ modelId }: CreateCommentModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Comment\",\n modelId: COMMENT_MODEL_ID,\n titleFieldId: \"step\",\n fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD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217
217
  enabled: false
218
218
  }
219
219
  });
220
- const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
221
- exports.CONTENT_REVIEW_MODEL_ID = CONTENT_REVIEW_MODEL_ID;
220
+ const CONTENT_REVIEW_MODEL_ID = exports.CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
222
221
  const createContentReviewModel = ({
223
222
  reviewerModelId
224
223
  }) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OA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;AACJ,CAAC,CAAC;AAMK,MAAM6B,uBAAuB,GAAG,iCAAiC;AAACC,OAAA,CAAAD,uBAAA,GAAAA,uBAAA;AAElE,MAAME,wBAAwB,GAAGA,CAAC;EACrCC;AACsC,CAAC,KAAK;EAC5C,OAAO,IAAAC,kCAAkB,EAAC;IACtBrC,IAAI,EAAE,sBAAsB;IAC5BsC,OAAO,EAAEL,uBAAuB;IAChCM,YAAY,EAAE,SAAS;IACvBhD,MAAM,EAAE,CACJgB,UAAU,CAAC,CAAC,EACZjB,YAAY,CAAC,CACTkB,cAAc,CAAC,CAAC,EAChBE,gBAAgB,CAAC,CAAC,EAClBC,oBAAoB,CAAC,CAACC,2BAA2B,CAAC,CAAC,CAAC,CAAC,EACrDE,uBAAuB,CAAC,CAAC,EACzBC,uBAAuB,CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,cAAc;EACvBR,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,MAAM;EACZQ,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;MACIZ,KAAK,EAAE,cAAc;MACrBa,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,uBAAuB;MAC9Ba,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,WAAW;MAClBa,KAAK,EAAE;IACX,CAAC;EAET,CAAC;EACDR,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,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2B,CAAC,CAAC,CAAC,CAAC,EACrDE,uBAAuB,CAAC,CAAC,EACzBC,uBAAuB,CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_workflow","_contentReview","_reviewer","_comment","_changeRequest","_utils","createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","changeRequestModelDefinition","createChangeRequestModel","reviewerModelDefinition","createReviewerModel","workflowModelDefinition","createWorkflowModel","reviewerModelId","modelId","commentModelDefinition","createCommentModel","contentReviewModelDefinition","createContentReviewModel","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","createCmsModel","contentModel","titleFieldId","push","plugins","register","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { createWorkflowModel } from \"./workflow.model\";\nimport { createContentReviewModel } from \"./contentReview.model\";\nimport { createReviewerModel } from \"./reviewer.model\";\nimport { createCommentModel } from \"./comment.model\";\nimport { createChangeRequestModel } from \"./changeRequest.model\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModel();\n const reviewerModelDefinition = createReviewerModel();\n const workflowModelDefinition = createWorkflowModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModel({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = createCmsModel(modelDefinition);\n /**\n * We want \"title\" field as the title field for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register(...cmsModelPlugins);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA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MC,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,cAAc,GAAG,IAAAC,8BAAc,EAACF,eAAe,CAAC;IACtD;AACR;AACA;AACA;IACQ,IAAIC,cAAc,CAACE,YAAY,CAACV,OAAO,KAAK,iCAAiC,EAAE;MAC3EQ,cAAc,CAACE,YAAY,CAACC,YAAY,GAAG,OAAO;IACtD;IACAL,eAAe,CAACM,IAAI,CAACJ,cAAc,CAAC;EACxC;;EAEA;AACJ;AACA;EACIzB,OAAO,CAAC8B,OAAO,CAACC,QAAQ,CAAC,GAAGR,eAAe,CAAC;AAChD,CAAC;AAACS,OAAA,CAAAjC,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_workflow","_contentReview","_reviewer","_comment","_changeRequest","_utils","createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","changeRequestModelDefinition","createChangeRequestModel","reviewerModelDefinition","createReviewerModel","workflowModelDefinition","createWorkflowModel","reviewerModelId","modelId","commentModelDefinition","createCommentModel","contentReviewModelDefinition","createContentReviewModel","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","createCmsModel","contentModel","titleFieldId","push","plugins","register","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { createWorkflowModel } from \"./workflow.model\";\nimport { createContentReviewModel } from \"./contentReview.model\";\nimport { createReviewerModel } from \"./reviewer.model\";\nimport { createCommentModel } from \"./comment.model\";\nimport { createChangeRequestModel } from \"./changeRequest.model\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModel();\n const reviewerModelDefinition = createReviewerModel();\n const workflowModelDefinition = createWorkflowModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModel({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = createCmsModel(modelDefinition);\n /**\n * We want \"title\" field as the title field for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register(...cmsModelPlugins);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAEO,MAAMQ,eAAe,GAAIC,OAAmB,IAAK;EACpD;AACJ;AACA;AACA;EACI,IAAI,CAACA,OAAO,CAACC,GAAG,EAAE;IACd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c,CAAC;EACxC;;EAEA;AACJ;AACA;EACIzB,OAAO,CAAC8B,OAAO,CAACC,QAAQ,CAAC,GAAGR,eAAe,CAAC;AAChD,CAAC;AAACS,OAAA,CAAAjC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -48,8 +48,7 @@ const emailField = () => (0, _utils.createModelField)({
48
48
  }
49
49
  }]
50
50
  });
51
- const REVIEWER_MODEL_ID = "apwReviewerModelDefinition";
52
- exports.REVIEWER_MODEL_ID = REVIEWER_MODEL_ID;
51
+ const REVIEWER_MODEL_ID = exports.REVIEWER_MODEL_ID = "apwReviewerModelDefinition";
53
52
  const createReviewerModel = () => {
54
53
  return (0, _apiHeadlessCms.createPrivateModel)({
55
54
  name: "APW - Reviewer",
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_apiHeadlessCms","idField","createModelField","label","type","parent","validation","message","name","displayNameField","typeField","emailField","fieldId","settings","preset","regex","flags","REVIEWER_MODEL_ID","exports","createReviewerModel","createPrivateModel","titleFieldId","modelId","fields"],"sources":["reviewer.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { createPrivateModel } from \"@webiny/api-headless-cms\";\n\nconst idField = () =>\n createModelField({\n label: \"Identity Id\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`identityId` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst displayNameField = () =>\n createModelField({\n label: \"Display Name\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`displayName` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst typeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`type` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst emailField = () =>\n createModelField({\n label: \"E-mail\",\n fieldId: \"email\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`email` field value in reviewer accepts only e-mails.\",\n name: \"pattern\",\n settings: {\n preset: \"email\",\n regex: null,\n flags: null\n }\n }\n ]\n });\n\nexport const REVIEWER_MODEL_ID = \"apwReviewerModelDefinition\";\n\nexport const createReviewerModel = () => {\n return createPrivateModel({\n name: \"APW - Reviewer\",\n titleFieldId: \"displayName\",\n modelId: REVIEWER_MODEL_ID,\n fields: [idField(), displayNameField(), typeField(), emailField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,MAAME,OAAO,GAAGA,CAAA,KACZ,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,mDAAmD;IAC5DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,gBAAgB,GAAGA,CAAA,KACrB,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,oDAAoD;IAC7DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,6CAA6C;IACtDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,OAAO;EAChBR,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,uDAAuD;IAChEC,IAAI,EAAE,SAAS;IACfK,QAAQ,EAAE;MACNC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAE,IAAI;MACXC,KAAK,EAAE;IACX;EACJ,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,iBAAiB,GAAG,4BAA4B;AAACC,OAAA,CAAAD,iBAAA,GAAAA,iBAAA;AAEvD,MAAME,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO,IAAAC,kCAAkB,EAAC;IACtBZ,IAAI,EAAE,gBAAgB;IACtBa,YAAY,EAAE,aAAa;IAC3BC,OAAO,EAAEL,iBAAiB;IAC1BM,MAAM,EAAE,CAACtB,OAAO,CAAC,CAAC,EAAEQ,gBAAgB,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;EACrE,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAC,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_utils","require","_apiHeadlessCms","idField","createModelField","label","type","parent","validation","message","name","displayNameField","typeField","emailField","fieldId","settings","preset","regex","flags","REVIEWER_MODEL_ID","exports","createReviewerModel","createPrivateModel","titleFieldId","modelId","fields"],"sources":["reviewer.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { createPrivateModel } from \"@webiny/api-headless-cms\";\n\nconst idField = () =>\n createModelField({\n label: \"Identity Id\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`identityId` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst displayNameField = () =>\n createModelField({\n label: \"Display Name\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`displayName` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst typeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`type` field value is required in reviewer.\",\n name: \"required\"\n }\n ]\n });\n\nconst emailField = () =>\n createModelField({\n label: \"E-mail\",\n fieldId: \"email\",\n type: \"text\",\n parent: \"reviewer\",\n validation: [\n {\n message: \"`email` field value in reviewer accepts only e-mails.\",\n name: \"pattern\",\n settings: {\n preset: \"email\",\n regex: null,\n flags: null\n }\n }\n ]\n });\n\nexport const REVIEWER_MODEL_ID = \"apwReviewerModelDefinition\";\n\nexport const createReviewerModel = () => {\n return createPrivateModel({\n name: \"APW - Reviewer\",\n titleFieldId: \"displayName\",\n modelId: REVIEWER_MODEL_ID,\n fields: [idField(), displayNameField(), typeField(), emailField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,MAAME,OAAO,GAAGA,CAAA,KACZ,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,mDAAmD;IAC5DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,gBAAgB,GAAGA,CAAA,KACrB,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,cAAc;EACrBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,oDAAoD;IAC7DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,6CAA6C;IACtDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,OAAO;EAChBR,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,uDAAuD;IAChEC,IAAI,EAAE,SAAS;IACfK,QAAQ,EAAE;MACNC,MAAM,EAAE,OAAO;MACfC,KAAK,EAAE,IAAI;MACXC,KAAK,EAAE;IACX;EACJ,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,4BAA4B;AAEtD,MAAME,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO,IAAAC,kCAAkB,EAAC;IACtBZ,IAAI,EAAE,gBAAgB;IACtBa,YAAY,EAAE,aAAa;IAC3BC,OAAO,EAAEL,iBAAiB;IAC1BM,MAAM,EAAE,CAACtB,OAAO,CAAC,CAAC,EAAEQ,gBAAgB,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC;EACrE,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAC,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","label","fieldId","initialFieldId","type","parent","camelCase","id","storageId","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","exports"],"sources":["utils.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { CreateModelFieldParams } from \"~/plugins/utils\";\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const { label, fieldId: initialFieldId, type, parent } = params;\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n return {\n id: `${camelCase(parent)}_${fieldId}`,\n storageId: fieldId,\n fieldId,\n label,\n type,\n settings: params.settings || {},\n listValidation: params.listValidation || [],\n validation: params.validation || [],\n multipleValues: params.multipleValues || false,\n predefinedValues: params.predefinedValues || {\n values: [],\n enabled: false\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC,OAAO,EAAEC,cAAc;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGL,MAAM;EAC/D,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAG,kBAAS,EAACH,cAAc,CAAC,GAAG,IAAAG,kBAAS,EAACL,KAAK,CAAC;EAC7E,OAAO;IACHM,EAAE,EAAG,GAAE,IAAAD,kBAAS,EAACD,MAAM,CAAE,IAAGH,OAAQ,EAAC;IACrCM,SAAS,EAAEN,OAAO;IAClBA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJK,QAAQ,EAAET,MAAM,CAACS,QAAQ,IAAI,CAAC,CAAC;IAC/BC,cAAc,EAAEV,MAAM,CAACU,cAAc,IAAI,EAAE;IAC3CC,UAAU,EAAEX,MAAM,CAACW,UAAU,IAAI,EAAE;IACnCC,cAAc,EAAEZ,MAAM,CAACY,cAAc,IAAI,KAAK;IAC9CC,gBAAgB,EAAEb,MAAM,CAACa,gBAAgB,IAAI;MACzCC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","label","fieldId","initialFieldId","type","parent","camelCase","id","storageId","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","exports"],"sources":["utils.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { CreateModelFieldParams } from \"~/plugins/utils\";\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const { label, fieldId: initialFieldId, type, parent } = params;\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n return {\n id: `${camelCase(parent)}_${fieldId}`,\n storageId: fieldId,\n fieldId,\n label,\n type,\n settings: params.settings || {},\n listValidation: params.listValidation || [],\n validation: params.validation || [],\n multipleValues: params.multipleValues || false,\n predefinedValues: params.predefinedValues || {\n values: [],\n enabled: false\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC,OAAO,EAAEC,cAAc;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGL,MAAM;EAC/D,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAG,kBAAS,EAACH,cAAc,CAAC,GAAG,IAAAG,kBAAS,EAACL,KAAK,CAAC;EAC7E,OAAO;IACHM,EAAE,EAAG,GAAE,IAAAD,kBAAS,EAACD,MAAM,CAAE,IAAGH,OAAQ,EAAC;IACrCM,SAAS,EAAEN,OAAO;IAClBA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJK,QAAQ,EAAET,MAAM,CAACS,QAAQ,IAAI,CAAC,CAAC;IAC/BC,cAAc,EAAEV,MAAM,CAACU,cAAc,IAAI,EAAE;IAC3CC,UAAU,EAAEX,MAAM,CAACW,UAAU,IAAI,EAAE;IACnCC,cAAc,EAAEZ,MAAM,CAACY,cAAc,IAAI,KAAK;IAC9CC,gBAAgB,EAAEb,MAAM,CAACa,gBAAgB,IAAI;MACzCC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -165,8 +165,7 @@ const applicationField = () => (0, _utils.createModelField)({
165
165
  }]
166
166
  }
167
167
  });
168
- const WORKFLOW_MODEL_ID = "apwWorkflowModelDefinition";
169
- exports.WORKFLOW_MODEL_ID = WORKFLOW_MODEL_ID;
168
+ const WORKFLOW_MODEL_ID = exports.WORKFLOW_MODEL_ID = "apwWorkflowModelDefinition";
170
169
  const createWorkflowModel = ({
171
170
  reviewerModelId
172
171
  }) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_apiHeadlessCms","require","_utils","_types","titleField","createModelField","label","type","parent","validation","message","name","stepsField","fields","settings","multipleValues","stepTitleField","exports","stepTypeField","predefinedValues","enabled","values","value","stepIdField","stepReviewersField","reviewerModelId","models","modelId","listValidation","scopeField","scopeTypeField","WorkflowScopeTypes","DEFAULT","CUSTOM","scopeDataField","scopeDataPbCategories","scopeDataPbPages","scopeDataCmsModels","scopeDataCmsEntries","applicationField","WORKFLOW_MODEL_ID","createWorkflowModel","createPrivateModel","titleFieldId"],"sources":["workflow.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { WorkflowScopeTypes } from \"~/types\";\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow\",\n validation: [\n {\n message: \"`title` field value is required in workflow.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Steps\",\n type: \"object\",\n parent: \"workflow\",\n settings: {\n fields\n },\n multipleValues: true\n });\n\nexport const stepTitleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`title` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"workflow steps\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"mandatoryBlocking\",\n label: \"Mandatory, blocking - An approval from a reviewer is required before being able to move to the next step and publish the content. \"\n },\n {\n value: \"mandatoryNonBlocking\",\n label: \"Mandatory, non-blocking - An approval from a reviewer is to publish the content, but the next step in the review workflow is not blocked. \"\n },\n {\n value: \"notMandatory\",\n label: \"Not mandatory - This is an optional review step. The content can be published regardless if an approval is provided or not.\"\n }\n ]\n },\n validation: [\n {\n name: \"required\",\n message: \"`type` field value is required in workflow steps.\"\n }\n ]\n });\n\nexport const stepIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`id` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepReviewersField = (reviewerModelId: string) =>\n createModelField({\n label: \"Reviewers\",\n type: \"ref\",\n parent: \"workflow steps\",\n multipleValues: true,\n settings: {\n models: [\n {\n modelId: reviewerModelId\n }\n ]\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"Value is too short.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst scopeField = (fields: CmsModelField[]) =>\n createModelField({\n type: \"object\",\n label: \"Scope\",\n parent: \"workflow\",\n settings: {\n fields\n }\n });\n\nconst scopeTypeField = () =>\n createModelField({\n label: \"Type\",\n parent: \"workflow scope\",\n type: \"text\",\n validation: [\n {\n message: \"`type` field value is required in workflow scope.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: WorkflowScopeTypes.DEFAULT,\n label: \"Default - Catch all scope that applies to all content that's being published.\"\n },\n {\n value: WorkflowScopeTypes.CUSTOM,\n label: \"Custom - The workflow will be applied to all selected content.\"\n }\n ]\n }\n });\n\nconst scopeDataField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Data\",\n parent: \"workflow scope\",\n type: \"object\",\n settings: {\n fields\n }\n });\n\nconst scopeDataPbCategories = () =>\n createModelField({\n label: \"Categories\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataPbPages = () =>\n createModelField({\n label: \"Pages\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsModels = () =>\n createModelField({\n label: \"Models\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsEntries = () =>\n createModelField({\n label: \"Entries\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\n\nconst applicationField = () =>\n createModelField({\n parent: \"workflow\",\n type: \"text\",\n label: \"App\",\n validation: [\n {\n message: \"`app` field value is required in workflow.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n { label: \"Page Builder\", value: \"pageBuilder\" },\n { label: \"Headless CMS\", value: \"cms\" }\n ]\n }\n });\n\ninterface CreateWorkflowModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const WORKFLOW_MODEL_ID = \"apwWorkflowModelDefinition\";\n\nexport const createWorkflowModel = ({ reviewerModelId }: CreateWorkflowModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Workflow\",\n /**\n * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.\n */\n modelId: WORKFLOW_MODEL_ID,\n titleFieldId: \"title\",\n fields: [\n titleField(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId)\n ]),\n scopeField([\n scopeTypeField(),\n scopeDataField([\n scopeDataPbCategories(),\n scopeDataPbPages(),\n scopeDataCmsModels(),\n scopeDataCmsEntries()\n ])\n ]),\n applicationField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,8CAA8C;IACvDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAIC,MAAuB,IACvC,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,UAAU;EAClBM,QAAQ,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EAAEhB;AAAqD,CAAC,KAAK;EAC7F,OAAO,IAAAiB,kCAAkB,EAAC;IACtB/B,IAAI,EAAE,gBAAgB;IACtB;AACR;AACA;IACQgB,OAAO,EAAEa,iBAAiB;IAC1BG,YAAY,EAAE,OAAO;IACrB9B,MAAM,EAAE,CACJT,UAAU,CAAC,CAAC,EACZQ,UAAU,CAAC,CACPI,cAAc,CAAC,CAAC,EAChBE,aAAa,CAAC,CAAC,EACfK,WAAW,CAAC,CAAC,EACbC,kBAAkB,CAACC,eAAe,CAAC,CACtC,CAAC,EACFI,UAAU,CAAC,CACPC,cAAc,CAAC,CAAC,EAChBI,cAAc,CAAC,CACXC,qBAAqB,CAAC,CAAC,EACvBC,gBAAgB,CAAC,CAAC,EAClBC,kBAAkB,CAAC,CAAC,EACpBC,mBAAmB,CAAC,CAAC,CACxB,CAAC,CACL,CAAC,EACFC,gBAAgB,CAAC,CAAC;EAE1B,CAAC,CAAC;AACN,CAAC;AAACtB,OAAA,CAAAwB,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","_types","titleField","createModelField","label","type","parent","validation","message","name","stepsField","fields","settings","multipleValues","stepTitleField","exports","stepTypeField","predefinedValues","enabled","values","value","stepIdField","stepReviewersField","reviewerModelId","models","modelId","listValidation","scopeField","scopeTypeField","WorkflowScopeTypes","DEFAULT","CUSTOM","scopeDataField","scopeDataPbCategories","scopeDataPbPages","scopeDataCmsModels","scopeDataCmsEntries","applicationField","WORKFLOW_MODEL_ID","createWorkflowModel","createPrivateModel","titleFieldId"],"sources":["workflow.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { WorkflowScopeTypes } from \"~/types\";\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow\",\n validation: [\n {\n message: \"`title` field value is required in workflow.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Steps\",\n type: \"object\",\n parent: \"workflow\",\n settings: {\n fields\n },\n multipleValues: true\n });\n\nexport const stepTitleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`title` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"workflow steps\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"mandatoryBlocking\",\n label: \"Mandatory, blocking - An approval from a reviewer is required before being able to move to the next step and publish the content. \"\n },\n {\n value: \"mandatoryNonBlocking\",\n label: \"Mandatory, non-blocking - An approval from a reviewer is to publish the content, but the next step in the review workflow is not blocked. \"\n },\n {\n value: \"notMandatory\",\n label: \"Not mandatory - This is an optional review step. The content can be published regardless if an approval is provided or not.\"\n }\n ]\n },\n validation: [\n {\n name: \"required\",\n message: \"`type` field value is required in workflow steps.\"\n }\n ]\n });\n\nexport const stepIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`id` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepReviewersField = (reviewerModelId: string) =>\n createModelField({\n label: \"Reviewers\",\n type: \"ref\",\n parent: \"workflow steps\",\n multipleValues: true,\n settings: {\n models: [\n {\n modelId: reviewerModelId\n }\n ]\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"Value is too short.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst scopeField = (fields: CmsModelField[]) =>\n createModelField({\n type: \"object\",\n label: \"Scope\",\n parent: \"workflow\",\n settings: {\n fields\n }\n });\n\nconst scopeTypeField = () =>\n createModelField({\n label: \"Type\",\n parent: \"workflow scope\",\n type: \"text\",\n validation: [\n {\n message: \"`type` field value is required in workflow scope.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: WorkflowScopeTypes.DEFAULT,\n label: \"Default - Catch all scope that applies to all content that's being published.\"\n },\n {\n value: WorkflowScopeTypes.CUSTOM,\n label: \"Custom - The workflow will be applied to all selected content.\"\n }\n ]\n }\n });\n\nconst scopeDataField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Data\",\n parent: \"workflow scope\",\n type: \"object\",\n settings: {\n fields\n }\n });\n\nconst scopeDataPbCategories = () =>\n createModelField({\n label: \"Categories\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataPbPages = () =>\n createModelField({\n label: \"Pages\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsModels = () =>\n createModelField({\n label: \"Models\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsEntries = () =>\n createModelField({\n label: \"Entries\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\n\nconst applicationField = () =>\n createModelField({\n parent: \"workflow\",\n type: \"text\",\n label: \"App\",\n validation: [\n {\n message: \"`app` field value is required in workflow.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n { label: \"Page Builder\", value: \"pageBuilder\" },\n { label: \"Headless CMS\", value: \"cms\" }\n ]\n }\n });\n\ninterface CreateWorkflowModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const WORKFLOW_MODEL_ID = \"apwWorkflowModelDefinition\";\n\nexport const createWorkflowModel = ({ reviewerModelId }: CreateWorkflowModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Workflow\",\n /**\n * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.\n */\n modelId: WORKFLOW_MODEL_ID,\n titleFieldId: \"title\",\n fields: [\n titleField(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId)\n ]),\n scopeField([\n scopeTypeField(),\n scopeDataField([\n scopeDataPbCategories(),\n scopeDataPbPages(),\n scopeDataCmsModels(),\n scopeDataCmsEntries()\n ])\n ]),\n applicationField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,8CAA8C;IACvDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAIC,MAAuB,IACvC,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,UAAU;EAClBM,QAAQ,EAAE;IACND;EACJ,CAAC;EACDE,cAAc,EAAE;AACpB,CAAC,CAAC;AAEC,MAAMC,cAAc,GAAGA,CAAA,KAC1B,IAAAX,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,gBAAgB;EACxBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,oDAAoD;IAC7DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAACM,OAAA,CAAAD,cAAA,GAAAA,cAAA;AAEA,MAAME,aAAa,GAAGA,CAAA,KACzB,IAAAb,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,gBAAgB;EACxBW,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;MACIC,KAAK,EAAE,mBAAmB;MAC1BhB,KAAK,EAAE;IACX,CAAC,EACD;MACIgB,KAAK,EAAE,sBAAsB;MAC7BhB,KAAK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-1 +1 @@
1
- {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","getReviewerModel","model","getModel","WebinyError","getReviewer","id","entry","getEntryById","pickEntryFieldValues","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","savedOn","Date","deleteReviewer","deleteEntry","exports"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import { ApwReviewerStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { ApwReviewer } from \"~/types\";\n\nexport const createReviewerStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await cms.getModel(\"apwReviewerModelDefinition\");\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwReviewer>), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model = await getReviewerModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGO,MAAMG,+BAA+B,GAAGA,CAAC;EAC5CC;AAC8B,CAAC,KAAmC;EAClE,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAAC,4BAA4B,CAAC;IAC9D,IAAI,CAACD,KAAK,EAAE;MACR,MAAM,IAAIE,cAAW,CACjB,oDAAoD,EACpD,uBACJ,CAAC;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMG,WAAwD,GAAG,MAAAA,CAAO;IAAEC;EAAG,CAAC,KAAK;IAC/E,MAAMJ,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;IAEtC,MAAMM,KAAK,GAAG,MAAMP,GAAG,CAACQ,YAAY,CAACN,KAAK,EAAEI,EAAE,CAAC;IAC/C,OAAO,IAAAG,0CAAoB,EAACF,KAAK,CAAC;EACtC,CAAC;EACD,OAAO;IACHN,gBAAgB;IAChBI,WAAW;IACX,MAAMK,aAAaA,CAACC,MAAM,EAAE;MACxB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAM,CAACW,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMb,GAAG,CAACc,iBAAiB,CAACZ,KAAK,EAAE;QACvD,GAAGS,MAAM;QACTI,KAAK,EAAE;UACH,GAAGJ,MAAM,CAACI;QACd;MACJ,CAAC,CAAC;MACF,OAAO,CAACH,OAAO,CAACI,GAAG,CAACP,0CAAiC,CAAC,EAAEI,IAAI,CAAC;IACjE,CAAC;IACD,MAAMI,cAAcA,CAACN,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC,MAAMM,KAAK,GAAG,MAAMP,GAAG,CAACkB,WAAW,CAAChB,KAAK,EAAES,MAAM,CAACQ,IAAI,CAAC;MACvD,OAAO,IAAAV,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMa,cAAcA,CAACT,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC;AACZ;AACA;AACA;MACY,MAAMoB,aAAa,GAAG,MAAMhB,WAAW,CAAC;QAAEC,EAAE,EAAEK,MAAM,CAACL;MAAG,CAAC,CAAC;MAE1D,MAAMC,KAAK,GAAG,MAAMP,GAAG,CAACsB,WAAW,CAACpB,KAAK,EAAES,MAAM,CAACL,EAAE,EAAE;QAClD,GAAGe,aAAa;QAChB,GAAGV,MAAM,CAACQ,IAAI;QACdI,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAACd,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAES,MAAM,CAACL,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","getReviewerModel","model","getModel","WebinyError","getReviewer","id","entry","getEntryById","pickEntryFieldValues","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","savedOn","Date","deleteReviewer","deleteEntry","exports"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import { ApwReviewerStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { ApwReviewer } from \"~/types\";\n\nexport const createReviewerStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await cms.getModel(\"apwReviewerModelDefinition\");\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwReviewer>), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model = await getReviewerModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGO,MAAMG,+BAA+B,GAAGA,CAAC;EAC5CC;AAC8B,CAAC,KAAmC;EAClE,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CA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AACL;MAAG,CAAC,CAAC;MAE1D,MAAMC,KAAK,GAAG,MAAMP,GAAG,CAACsB,WAAW,CAACpB,KAAK,EAAES,MAAM,CAACL,EAAE,EAAE;QAClD,GAAGe,aAAa;QAChB,GAAGV,MAAM,CAACQ,IAAI;QACdI,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAACd,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAES,MAAM,CAACL,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","getWorkflowModel","model","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","pickEntryFieldValues","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","savedOn","Date","updateEntry","deleteWorkflow","deleteEntry","exports"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import { ApwWorkflow, CreateApwWorkflowParams } from \"~/types\";\nimport { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations/index\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\ntype ReviewersRefInput = CreateApwWorkflowParams<{ modelId: string; id: string }>;\n\nconst formatReviewersForRefInput = (\n data: CreateApwWorkflowParams,\n modelId: string\n): ReviewersRefInput => {\n return {\n ...data,\n steps: data.steps.map(step => ({\n ...step,\n reviewers: step.reviewers.map(id => ({\n id,\n modelId\n }))\n }))\n };\n};\n\nexport const createWorkflowStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwWorkflowStorageOperations => {\n const { cms } = params;\n const getWorkflowModel = async () => {\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwWorkflow>), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await cms.createEntry(model, data);\n\n return pickEntryFieldValues(entry);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await cms.updateEntry(model, params.id, data);\n\n return pickEntryFieldValues(entry);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,MAAMI,0BAA0B,GAAGA,CAC/BC,IAA6B,EAC7BC,OAAe,KACK;EACpB,OAAO;IACH,GAAGD,IAAI;IACPE,KAAK,EAAEF,IAAI,CAACE,KAAK,CAACC,GAAG,CAACC,IAAI,KAAK;MAC3B,GAAGA,IAAI;MACPC,SAAS,EAAED,IAAI,CAACC,SAAS,CAACF,GAAG,CAACG,EAAE,KAAK;QACjCA,EAAE;QACFL;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAEM,MAAMM,+BAA+B,GACxCC,MAAwC,IACT;EAC/B,MAAM;IAAEC;EAAI,CAAC,GAAGD,MAAM;EACtB,MAAME,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAA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CAAC;IACD,MAAMY,cAAcA,CAA6BpB,MAAM,EAAE;MACrD,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC,MAAMe,aAAa,GAAG,MAAM,IAAI,CAACC,gBAAgB,CAAC,CAAC;MACnD;AACZ;AACA;AACA;MACY,MAAMG,aAAa,GAAG,MAAMd,WAAW,CAAC;QAAET,EAAE,EAAEE,MAAM,CAACF;MAAG,CAAC,CAAC;MAC1D,MAAMwB,KAAK,GAAG;QACV,GAAGD,aAAa;QAChB,GAAGrB,MAAM,CAACR,IAAI;QACd+B,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC;MACD,MAAMhC,IAAI,GAAGD,0BAA0B,CACnC+B,KAAK,EACLL,aAAa,CAACxB,OAClB,CAAC;MAED,MAAMe,KAAK,GAAG,MAAMP,GAAG,CAACwB,WAAW,CAACtB,KAAK,EAAEH,MAAM,CAACF,EAAE,EAAEN,IAAI,CAAC;MAE3D,OAAO,IAAAkB,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAAC1B,MAAM,EAAE;MACzB,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAEH,MAAM,CAACF,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC8B,OAAA,CAAA7B,+BAAA,GAAAA,+BAAA"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","getWorkflowModel","model","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","pickEntryFieldValues","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","savedOn","Date","updateEntry","deleteWorkflow","deleteEntry","exports"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import { ApwWorkflow, CreateApwWorkflowParams } from \"~/types\";\nimport { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations/index\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\ntype ReviewersRefInput = CreateApwWorkflowParams<{ modelId: string; id: string }>;\n\nconst formatReviewersForRefInput = (\n data: CreateApwWorkflowParams,\n modelId: string\n): ReviewersRefInput => {\n return {\n ...data,\n steps: data.steps.map(step => ({\n ...step,\n reviewers: step.reviewers.map(id => ({\n id,\n modelId\n }))\n }))\n };\n};\n\nexport const createWorkflowStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwWorkflowStorageOperations => {\n const { cms } = params;\n const getWorkflowModel = async () => {\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwWorkflow>), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await cms.createEntry(model, data);\n\n return pickEntryFieldValues(entry);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await cms.updateEntry(model, params.id, data);\n\n return pickEntryFieldValues(entry);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,MAAMI,0BAA0B,GAAGA,CAC/BC,IAA6B,EAC7BC,OAAe,KACK;EACpB,OAAO;IACH,GAAGD,IAAI;IACPE,KAAK,EAAEF,IAAI,CAACE,KAAK,CAACC,GAAG,CAACC,IAAI,KAAK;MAC3B,GAAGA,IAAI;MACPC,SAAS,EAAED,IAAI,CAACC,SAAS,CAACF,GAAG,CAACG,EAAE,KAAK;QACjCA,EAAE;QACFL;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAEM,MAAMM,+BAA+B,GACxCC,MAAwC,IACT;EAC/B,MAAM;IAAEC;EAAI,CAAC,GAAGD,MAAM;EACtB,MAAME,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAACC,2BAAiB,CAAC;IACnD,IAAI,CAACF,KAAK,EAAE;MACR,MAAM,IAAIG,cAAW,CAChB,mBAAkBD,2BAAkB,UAAS,EAC9C,uBACJ,CAAC;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMI,WAAwD,GAAG,MAAAA,CAAO;IAAET;EAAG,CAAC,KAAK;I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,MAAM,CAACF;MAAG,CAAC,CAAC;MAC1D,MAAMwB,KAAK,GAAG;QACV,GAAGD,aAAa;QAChB,GAAGrB,MAAM,CAACR,IAAI;QACd+B,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC;MACD,MAAMhC,IAAI,GAAGD,0BAA0B,CACnC+B,KAAK,EACLL,aAAa,CAACxB,OAClB,CAAC;MAED,MAAMe,KAAK,GAAG,MAAMP,GAAG,CAACwB,WAAW,CAACtB,KAAK,EAAEH,MAAM,CAACF,EAAE,EAAEN,IAAI,CAAC;MAE3D,OAAO,IAAAkB,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAAC1B,MAAM,EAAE;MACzB,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAEH,MAAM,CAACF,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC8B,OAAA,CAAA7B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
package/types.js CHANGED
@@ -4,26 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.WorkflowScopeTypes = exports.ApwWorkflowStepTypes = exports.ApwWorkflowApplications = exports.ApwContentTypes = exports.ApwContentReviewStepStatus = exports.ApwContentReviewStatus = void 0;
7
- let ApwContentTypes = /*#__PURE__*/function (ApwContentTypes) {
7
+ let ApwContentTypes = exports.ApwContentTypes = /*#__PURE__*/function (ApwContentTypes) {
8
8
  ApwContentTypes["PAGE"] = "page";
9
9
  ApwContentTypes["CMS_ENTRY"] = "cms_entry";
10
10
  return ApwContentTypes;
11
11
  }({});
12
- exports.ApwContentTypes = ApwContentTypes;
13
- let WorkflowScopeTypes = /*#__PURE__*/function (WorkflowScopeTypes) {
12
+ let WorkflowScopeTypes = exports.WorkflowScopeTypes = /*#__PURE__*/function (WorkflowScopeTypes) {
14
13
  WorkflowScopeTypes["DEFAULT"] = "default";
15
14
  WorkflowScopeTypes["CUSTOM"] = "custom";
16
15
  return WorkflowScopeTypes;
17
16
  }({});
18
- exports.WorkflowScopeTypes = WorkflowScopeTypes;
19
- let ApwContentReviewStepStatus = /*#__PURE__*/function (ApwContentReviewStepStatus) {
17
+ let ApwContentReviewStepStatus = exports.ApwContentReviewStepStatus = /*#__PURE__*/function (ApwContentReviewStepStatus) {
20
18
  ApwContentReviewStepStatus["DONE"] = "done";
21
19
  ApwContentReviewStepStatus["ACTIVE"] = "active";
22
20
  ApwContentReviewStepStatus["INACTIVE"] = "inactive";
23
21
  return ApwContentReviewStepStatus;
24
22
  }({});
25
- exports.ApwContentReviewStepStatus = ApwContentReviewStepStatus;
26
- let ApwWorkflowApplications = /*#__PURE__*/function (ApwWorkflowApplications) {
23
+ let ApwWorkflowApplications = exports.ApwWorkflowApplications = /*#__PURE__*/function (ApwWorkflowApplications) {
27
24
  ApwWorkflowApplications["PB"] = "pageBuilder";
28
25
  ApwWorkflowApplications["CMS"] = "cms";
29
26
  return ApwWorkflowApplications;
@@ -33,21 +30,18 @@ let ApwWorkflowApplications = /*#__PURE__*/function (ApwWorkflowApplications) {
33
30
  *
34
31
  * @category General
35
32
  */
36
- exports.ApwWorkflowApplications = ApwWorkflowApplications;
37
- let ApwWorkflowStepTypes = /*#__PURE__*/function (ApwWorkflowStepTypes) {
33
+ let ApwWorkflowStepTypes = exports.ApwWorkflowStepTypes = /*#__PURE__*/function (ApwWorkflowStepTypes) {
38
34
  ApwWorkflowStepTypes["MANDATORY_BLOCKING"] = "mandatoryBlocking";
39
35
  ApwWorkflowStepTypes["MANDATORY_NON_BLOCKING"] = "mandatoryNonBlocking";
40
36
  ApwWorkflowStepTypes["NON_MANDATORY"] = "notMandatory";
41
37
  return ApwWorkflowStepTypes;
42
38
  }({});
43
- exports.ApwWorkflowStepTypes = ApwWorkflowStepTypes;
44
- let ApwContentReviewStatus = /*#__PURE__*/function (ApwContentReviewStatus) {
39
+ let ApwContentReviewStatus = exports.ApwContentReviewStatus = /*#__PURE__*/function (ApwContentReviewStatus) {
45
40
  ApwContentReviewStatus["UNDER_REVIEW"] = "underReview";
46
41
  ApwContentReviewStatus["READY_TO_BE_PUBLISHED"] = "readyToBePublished";
47
42
  ApwContentReviewStatus["PUBLISHED"] = "published";
48
43
  return ApwContentReviewStatus;
49
44
  }({});
50
- exports.ApwContentReviewStatus = ApwContentReviewStatus;
51
45
  var ApwScheduleActionTypes = /*#__PURE__*/function (ApwScheduleActionTypes) {
52
46
  ApwScheduleActionTypes["PUBLISH"] = "publish";
53
47
  ApwScheduleActionTypes["UNPUBLISH"] = "unpublish";
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ApwContentTypes","exports","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsEntry as BaseCmsEntry,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnPageBeforeCreateTopicParams,\n OnPageBeforeCreateFromTopicParams,\n OnPageBeforeUpdateTopicParams,\n OnPageBeforePublishTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { ApwScheduleActionCrud, ScheduleActionContext } from \"~/scheduler/types\";\nimport HandlerClient from \"@webiny/handler-client/HandlerClient\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { WcpContextObject } from \"@webiny/api-wcp/types\";\nimport { MailerContext } from \"@webiny/api-mailer/types\";\nimport { AdminSettingsContext } from \"@webiny/api-admin-settings/types\";\n\nexport interface ApwCmsEntry extends BaseCmsEntry {\n title: string;\n meta: {\n apw?: {\n contentReviewId?: string | null;\n workflowId?: string | null;\n };\n };\n}\n\nexport interface ApwFile {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n}\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where?: ListWhere;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport interface PageSettingsWithWorkflow extends PageSettings {\n apw: {\n workflowId: string;\n contentReviewId: string | null;\n };\n}\n\nexport interface PageWithWorkflow extends Page {\n settings: PageSettingsWithWorkflow;\n}\n\nexport type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeCreateFromTopicParams =\n OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<PageWithWorkflow>;\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n CUSTOM = \"custom\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface ApwIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n entryId: string;\n\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n createdBy: ApwIdentity;\n modifiedBy: ApwIdentity;\n savedBy: ApwIdentity;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string;\n}\n\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n totalComments: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: ApwIdentity | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: ApwWorkflowApplications;\n}\n\ninterface ApwWorkflowScopeCmsEntry {\n id: string;\n modelId: string;\n}\n\nexport interface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: ApwWorkflowScopeCmsEntry[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport type ApwContentReviewListFilter = ApwContentReviewStatus | \"requiresMyAttention\";\n\nexport interface ApwWorkflowStep<TReviewer = ApwReviewer> {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: TReviewer[];\n id: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\nexport interface CreateApwWorkflowParams<TReviewer = string> {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface UpdateApwWorkflowParams<TReviewer = string> {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where?: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n step: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nenum ApwScheduleActionTypes {\n PUBLISH = \"publish\",\n UNPUBLISH = \"unpublish\"\n}\n\nexport interface ApwScheduleActionData {\n action: ApwScheduleActionTypes;\n type: ApwContentTypes;\n datetime: string;\n entryId: string;\n /**\n * We will add modelId to the data for now.\n * TODO extract in separate package?\n */\n modelId?: string;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: {\n modelId?: string;\n };\n scheduledOn?: string | null;\n scheduledBy?: string | null;\n scheduledActionId?: string | null;\n publishedBy?: string | null;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: ApwContentReviewStatus;\n content?: ApwContentReviewContent;\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params?: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<boolean>;\n\n retractSignOff(id: string, step: string): Promise<boolean>;\n\n isReviewRequired(data: ApwContentReviewContent): Promise<{\n isReviewRequired: boolean;\n contentReviewId?: string | null;\n }>;\n\n publishContent(id: string, datetime?: string): Promise<boolean>;\n\n unpublishContent(id: string, datetime?: string): Promise<boolean>;\n\n scheduleAction(data: ApwScheduleActionData): Promise<string>;\n\n deleteScheduledAction(id: string): Promise<boolean>;\n\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\n}\n\nexport type ContentGetter = (\n id: string,\n settings: { modelId?: string }\n) => Promise<PageWithWorkflow | ApwCmsEntry | null>;\n\nexport type ContentPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport type ContentUnPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;\n getContentGetter: (type: ApwContentTypes) => ContentGetter;\n addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;\n getContentPublisher: (type: ApwContentTypes) => ContentPublisher;\n addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;\n getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface ApwContext extends Context, MailerContext, AdminSettingsContext {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n wcp: WcpContextObject;\n scheduleAction: ScheduleActionContext[\"scheduleAction\"];\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n scheduler: ApwScheduleActionCrud;\n handlerClient: HandlerClient;\n plugins: PluginsContainer;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\n\nexport interface ApwContentReviewListParams extends ListParams {\n where: ListWhere & {\n reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: string[];\n };\n}\n\ntype StorageOperationsListContentReviewsParams = ApwContentReviewListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * Headless CMS\n */\nexport interface OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterUnpublishTopicParams\n extends Omit<OnEntryAfterUnpublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n"],"mappings":";;;;;;IAoFYA,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAAAC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAAA,IAyBfE,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAAD,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAAA,IAKlBC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAAAF,OAAA,CAAAE,0BAAA,GAAAA,0BAAA;AAAA,IAM1BC,uBAAuB,0BAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAKnC;AACA;AACA;AACA;AACA;AAJAH,OAAA,CAAAG,uBAAA,GAAAA,uBAAA;AAAA,IAqGYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAAJ,OAAA,CAAAI,oBAAA,GAAAA,oBAAA;AAAA,IAMpBC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAAL,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAAA,IAiE7BC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA,EAAtBA,sBAAsB;AA6a3B;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA"}
1
+ {"version":3,"names":["ApwContentTypes","exports","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsEntry as BaseCmsEntry,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnPageBeforeCreateTopicParams,\n OnPageBeforeCreateFromTopicParams,\n OnPageBeforeUpdateTopicParams,\n OnPageBeforePublishTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { ApwScheduleActionCrud, ScheduleActionContext } from \"~/scheduler/types\";\nimport HandlerClient from \"@webiny/handler-client/HandlerClient\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { WcpContextObject } from \"@webiny/api-wcp/types\";\nimport { MailerContext } from \"@webiny/api-mailer/types\";\nimport { AdminSettingsContext } from \"@webiny/api-admin-settings/types\";\n\nexport interface ApwCmsEntry extends BaseCmsEntry {\n title: string;\n meta: {\n apw?: {\n contentReviewId?: string | null;\n workflowId?: string | null;\n };\n };\n}\n\nexport interface ApwFile {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n}\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where?: ListWhere;\n sort?: string[];\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport interface PageSettingsWithWorkflow extends PageSettings {\n apw: {\n workflowId: string;\n contentReviewId: string | null;\n };\n}\n\nexport interface PageWithWorkflow extends Page {\n settings: PageSettingsWithWorkflow;\n}\n\nexport type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeCreateFromTopicParams =\n OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<PageWithWorkflow>;\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n CUSTOM = \"custom\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface ApwIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n entryId: string;\n\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n createdBy: ApwIdentity;\n modifiedBy: ApwIdentity;\n savedBy: ApwIdentity;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string;\n}\n\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n totalComments: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: ApwIdentity | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: ApwWorkflowApplications;\n}\n\ninterface ApwWorkflowScopeCmsEntry {\n id: string;\n modelId: string;\n}\n\nexport interface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: ApwWorkflowScopeCmsEntry[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport type ApwContentReviewListFilter = ApwContentReviewStatus | \"requiresMyAttention\";\n\nexport interface ApwWorkflowStep<TReviewer = ApwReviewer> {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: TReviewer[];\n id: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\nexport interface CreateApwWorkflowParams<TReviewer = string> {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface UpdateApwWorkflowParams<TReviewer = string> {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where?: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n step: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nenum ApwScheduleActionTypes {\n PUBLISH = \"publish\",\n UNPUBLISH = \"unpublish\"\n}\n\nexport interface ApwScheduleActionData {\n action: ApwScheduleActionTypes;\n type: ApwContentTypes;\n datetime: string;\n entryId: string;\n /**\n * We will add modelId to the data for now.\n * TODO extract in separate package?\n */\n modelId?: string;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: {\n modelId?: string;\n };\n scheduledOn?: string | null;\n scheduledBy?: string | null;\n scheduledActionId?: string | null;\n publishedBy?: string | null;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: ApwContentReviewStatus;\n content?: ApwContentReviewContent;\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params?: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<boolean>;\n\n retractSignOff(id: string, step: string): Promise<boolean>;\n\n isReviewRequired(data: ApwContentReviewContent): Promise<{\n isReviewRequired: boolean;\n contentReviewId?: string | null;\n }>;\n\n publishContent(id: string, datetime?: string): Promise<boolean>;\n\n unpublishContent(id: string, datetime?: string): Promise<boolean>;\n\n scheduleAction(data: ApwScheduleActionData): Promise<string>;\n\n deleteScheduledAction(id: string): Promise<boolean>;\n\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\n}\n\nexport type ContentGetter = (\n id: string,\n settings: { modelId?: string }\n) => Promise<PageWithWorkflow | ApwCmsEntry | null>;\n\nexport type ContentPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport type ContentUnPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;\n getContentGetter: (type: ApwContentTypes) => ContentGetter;\n addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;\n getContentPublisher: (type: ApwContentTypes) => ContentPublisher;\n addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;\n getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface ApwContext extends Context, MailerContext, AdminSettingsContext {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n wcp: WcpContextObject;\n scheduleAction: ScheduleActionContext[\"scheduleAction\"];\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n scheduler: ApwScheduleActionCrud;\n handlerClient: HandlerClient;\n plugins: PluginsContainer;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\n\nexport interface ApwContentReviewListParams extends ListParams {\n where: ListWhere & {\n reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: string[];\n };\n}\n\ntype StorageOperationsListContentReviewsParams = ApwContentReviewListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * Headless CMS\n */\nexport interface OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterUnpublishTopicParams\n extends Omit<OnEntryAfterUnpublish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A;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_ContentApwSettingsPlugin","require","_handlerGraphql","getContentApwSettingsPlugin","params","type","plugins","plugin","byType","ContentApwSettingsPlugin","find","p","canUse","NotFoundError","exports"],"sources":["contentApwSettingsPlugin.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\n\ninterface GetContentApwSettingsPluginParams {\n type: ApwContentTypes;\n plugins: PluginsContainer;\n}\nexport const getContentApwSettingsPlugin = <\n T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin\n>(\n params: GetContentApwSettingsPluginParams\n): T => {\n const { type, plugins } = params;\n const plugin = plugins.byType<T>(ContentApwSettingsPlugin.type).find(p => p.canUse(type));\n if (plugin) {\n return plugin;\n }\n throw new NotFoundError(`Could not find a \"ContentApwSettingsPlugin\" for \"${type}\".`);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAMO,MAAME,2BAA2B,GAGpCC,MAAyC,IACrC;EACJ,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAChC,MAAMG,MAAM,GAAGD,OAAO,CAACE,MAAM,CAAIC,kDAAwB,CAACJ,IAAI,CAAC,CAACK,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACP,IAAI,CAAC,CAAC;EACzF,IAAIE,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;EACA,MAAM,IAAIM,6BAAa,CAAE,oDAAmDR,IAAK,IAAG,CAAC;AACzF,CAAC;AAACS,OAAA,CAAAX,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"names":["_ContentApwSettingsPlugin","require","_handlerGraphql","getContentApwSettingsPlugin","params","type","plugins","plugin","byType","ContentApwSettingsPlugin","find","p","canUse","NotFoundError","exports"],"sources":["contentApwSettingsPlugin.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\n\ninterface GetContentApwSettingsPluginParams {\n type: ApwContentTypes;\n plugins: PluginsContainer;\n}\nexport const getContentApwSettingsPlugin = <\n T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin\n>(\n params: GetContentApwSettingsPluginParams\n): T => {\n const { type, plugins } = params;\n const plugin = plugins.byType<T>(ContentApwSettingsPlugin.type).find(p => p.canUse(type));\n if (plugin) {\n return plugin;\n }\n throw new NotFoundError(`Could not find a \"ContentApwSettingsPlugin\" for \"${type}\".`);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAMO,MAAME,2BAA2B,GAGpCC,MAAyC,IACrC;EACJ,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAChC,MAAMG,MAAM,GAAGD,OAAO,CAACE,MAAM,CAAIC,kDAAwB,CAACJ,IAAI,CAAC,CAACK,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACP,IAAI,CAAC,CAAC;EACzF,IAAIE,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;EACA,MAAM,IAAIM,6BAAa,CAAE,oDAAmDR,IAAK,IAAG,CAAC;AACzF,CAAC;AAACS,OAAA,CAAAX,2BAAA,GAAAA,2BAAA","ignoreList":[]}