@strapi/review-workflows 0.0.0-experimental.fdacf4285d1cada9d94ab4dcd756c5362cba1b54 → 0.0.0-next.20afc21f5d54593dc724202ebca562df76601077

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 (61) hide show
  1. package/dist/_chunks/{Layout-COeOgRsc.js → Layout-8i0EXRRs.js} +3 -3
  2. package/dist/_chunks/Layout-8i0EXRRs.js.map +1 -0
  3. package/dist/_chunks/{Layout-CefL-rfa.mjs → Layout-C9m07iTY.mjs} +3 -3
  4. package/dist/_chunks/Layout-C9m07iTY.mjs.map +1 -0
  5. package/dist/_chunks/{en-D9dxziEb.mjs → en-D9ZrQAV6.mjs} +2 -5
  6. package/dist/_chunks/en-D9ZrQAV6.mjs.map +1 -0
  7. package/dist/_chunks/{en-CYgjfSep.js → en-xcewH2pC.js} +2 -5
  8. package/dist/_chunks/en-xcewH2pC.js.map +1 -0
  9. package/dist/_chunks/{_id-PmPKIqUm.js → id-CmtaTf1x.js} +12 -73
  10. package/dist/_chunks/id-CmtaTf1x.js.map +1 -0
  11. package/dist/_chunks/{_id-Dt2oEiro.mjs → id-DV0Ndeav.mjs} +12 -73
  12. package/dist/_chunks/id-DV0Ndeav.mjs.map +1 -0
  13. package/dist/_chunks/{index-p25R0AkB.js → index-B8WmHbCU.js} +3 -3
  14. package/dist/_chunks/{index-p25R0AkB.js.map → index-B8WmHbCU.js.map} +1 -1
  15. package/dist/_chunks/{index-DiWo3Pu2.js → index-BCUO98DV.js} +3 -6
  16. package/dist/_chunks/{index-DiWo3Pu2.js.map → index-BCUO98DV.js.map} +1 -1
  17. package/dist/_chunks/{index-DJtnx2X1.mjs → index-CA5Axcoc.mjs} +3 -3
  18. package/dist/_chunks/{index-DJtnx2X1.mjs.map → index-CA5Axcoc.mjs.map} +1 -1
  19. package/dist/_chunks/{index-IZXxuQ4h.mjs → index-CqYVkW3E.mjs} +3 -6
  20. package/dist/_chunks/{index-IZXxuQ4h.mjs.map → index-CqYVkW3E.mjs.map} +1 -1
  21. package/dist/_chunks/{router-C8mPPFJk.js → router-BOXlNnrU.js} +3 -3
  22. package/dist/_chunks/router-BOXlNnrU.js.map +1 -0
  23. package/dist/_chunks/{router-DJCVv74P.mjs → router-Jdt6SbIA.mjs} +3 -3
  24. package/dist/_chunks/router-Jdt6SbIA.mjs.map +1 -0
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +1 -1
  27. package/dist/admin/src/services/settings.d.ts +3 -7
  28. package/dist/server/index.js +22 -72
  29. package/dist/server/index.js.map +1 -1
  30. package/dist/server/index.mjs +22 -72
  31. package/dist/server/index.mjs.map +1 -1
  32. package/dist/server/src/bootstrap.d.ts.map +1 -1
  33. package/dist/server/src/constants/workflows.d.ts +0 -1
  34. package/dist/server/src/constants/workflows.d.ts.map +1 -1
  35. package/dist/server/src/content-types/index.d.ts +0 -6
  36. package/dist/server/src/content-types/index.d.ts.map +1 -1
  37. package/dist/server/src/content-types/workflow/index.d.ts +0 -6
  38. package/dist/server/src/content-types/workflow/index.d.ts.map +1 -1
  39. package/dist/server/src/index.d.ts +0 -13
  40. package/dist/server/src/index.d.ts.map +1 -1
  41. package/dist/server/src/services/document-service-middleware.d.ts +0 -1
  42. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  43. package/dist/server/src/services/index.d.ts +0 -1
  44. package/dist/server/src/services/index.d.ts.map +1 -1
  45. package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
  46. package/dist/server/src/services/stages.d.ts.map +1 -1
  47. package/dist/server/src/services/workflows.d.ts.map +1 -1
  48. package/dist/server/src/validation/review-workflows.d.ts +0 -4
  49. package/dist/server/src/validation/review-workflows.d.ts.map +1 -1
  50. package/dist/shared/contracts/review-workflows.d.ts +3 -8
  51. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  52. package/package.json +7 -7
  53. package/dist/_chunks/Layout-COeOgRsc.js.map +0 -1
  54. package/dist/_chunks/Layout-CefL-rfa.mjs.map +0 -1
  55. package/dist/_chunks/_id-Dt2oEiro.mjs.map +0 -1
  56. package/dist/_chunks/_id-PmPKIqUm.js.map +0 -1
  57. package/dist/_chunks/en-CYgjfSep.js.map +0 -1
  58. package/dist/_chunks/en-D9dxziEb.mjs.map +0 -1
  59. package/dist/_chunks/router-C8mPPFJk.js.map +0 -1
  60. package/dist/_chunks/router-DJCVv74P.mjs.map +0 -1
  61. /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
@@ -4,10 +4,10 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactRouterDom = require("react-router-dom");
6
6
  const ProtectedListPage = React.lazy(
7
- () => Promise.resolve().then(() => require("./index-p25R0AkB.js")).then((mod) => ({ default: mod.ProtectedListPage }))
7
+ () => Promise.resolve().then(() => require("./index-B8WmHbCU.js")).then((mod) => ({ default: mod.ProtectedListPage }))
8
8
  );
9
9
  const ProtectedEditPage = React.lazy(
10
- () => Promise.resolve().then(() => require("./_id-PmPKIqUm.js")).then((mod) => ({ default: mod.ProtectedEditPage }))
10
+ () => Promise.resolve().then(() => require("./id-CmtaTf1x.js")).then((mod) => ({ default: mod.ProtectedEditPage }))
11
11
  );
12
12
  const routes = [
13
13
  {
@@ -21,4 +21,4 @@ const routes = [
21
21
  ];
22
22
  const Router = () => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Routes, { children: routes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { ...route }, route.path)) });
23
23
  exports.Router = Router;
24
- //# sourceMappingURL=router-C8mPPFJk.js.map
24
+ //# sourceMappingURL=router-BOXlNnrU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-BOXlNnrU.js","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":["lazy","jsx","Routes","Route"],"mappings":";;;;;AAKA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,qBAAmB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoBA,MAAA;AAAA,EAAK,MAC7B,QAAO,QAAA,EAAA,KAAA,MAAA,QAAA,kBAAsB,GAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACnF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZC,2BAAAA,IAAAC,eAAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACXD,2BAAA,IAACE,wBAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;;"}
@@ -2,10 +2,10 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { lazy } from "react";
3
3
  import { Routes, Route } from "react-router-dom";
4
4
  const ProtectedListPage = lazy(
5
- () => import("./index-DJtnx2X1.mjs").then((mod) => ({ default: mod.ProtectedListPage }))
5
+ () => import("./index-CA5Axcoc.mjs").then((mod) => ({ default: mod.ProtectedListPage }))
6
6
  );
7
7
  const ProtectedEditPage = lazy(
8
- () => import("./_id-Dt2oEiro.mjs").then((mod) => ({ default: mod.ProtectedEditPage }))
8
+ () => import("./id-DV0Ndeav.mjs").then((mod) => ({ default: mod.ProtectedEditPage }))
9
9
  );
10
10
  const routes = [
11
11
  {
@@ -21,4 +21,4 @@ const Router = () => /* @__PURE__ */ jsx(Routes, { children: routes.map((route)
21
21
  export {
22
22
  Router
23
23
  };
24
- //# sourceMappingURL=router-DJCVv74P.mjs.map
24
+ //# sourceMappingURL=router-Jdt6SbIA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router-Jdt6SbIA.mjs","sources":["../../admin/src/router.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { lazy } from 'react';\n\nimport { Routes, Route, PathRouteProps } from 'react-router-dom';\n\nconst ProtectedListPage = lazy(() =>\n import('./routes/settings').then((mod) => ({ default: mod.ProtectedListPage }))\n);\nconst ProtectedEditPage = lazy(() =>\n import('./routes/settings/id').then((mod) => ({ default: mod.ProtectedEditPage }))\n);\n\nconst routes: PathRouteProps[] = [\n {\n path: '/',\n Component: ProtectedListPage,\n },\n {\n path: ':id',\n Component: ProtectedEditPage,\n },\n];\n\nconst Router = () => (\n <Routes>\n {routes.map((route) => (\n <Route key={route.path} {...route} />\n ))}\n </Routes>\n);\n\nexport { Router };\n"],"names":[],"mappings":";;;AAKA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,sBAAmB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AAChF;AACA,MAAM,oBAAoB;AAAA,EAAK,MAC7B,OAAO,mBAAsB,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,IAAI,kBAAA,EAAoB;AACnF;AAEA,MAAM,SAA2B;AAAA,EAC/B;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF;AAEA,MAAM,SAAS,MACZ,oBAAA,QAAA,EACE,iBAAO,IAAI,CAAC,UACX,oBAAC,SAAwB,GAAG,MAAA,GAAhB,MAAM,IAAiB,CACpC,EACH,CAAA;"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-DiWo3Pu2.js");
2
+ const index = require("../_chunks/index-BCUO98DV.js");
3
3
  module.exports = index.admin;
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { h } from "../_chunks/index-IZXxuQ4h.mjs";
1
+ import { h } from "../_chunks/index-CqYVkW3E.mjs";
2
2
  export {
3
3
  h as default
4
4
  };
@@ -1727,17 +1727,13 @@ declare const useGetWorkflowsQuery: import("@reduxjs/toolkit/dist/query/react/bu
1727
1727
  }) | undefined;
1728
1728
  } & import("@strapi/types/dist/modules/entity-service/params/filters").AbstractAttributesFiltering<"admin::review-workflow">) | undefined;
1729
1729
  } & {
1730
- populate?: import("@strapi/types/dist/modules/entity-service/params/populate").ArrayNotation<"admin::review-workflow"> | undefined;
1730
+ populate?: string | undefined;
1731
1731
  }), import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ReviewWorkflow" | "ReviewWorkflowStages" | "Document" | "ContentTypeSettings", {
1732
1732
  workflows: GetAll.Response['data'];
1733
1733
  meta?: GetAll.Response['meta'];
1734
1734
  }, "adminApi">>, useCreateWorkflowMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<{
1735
- data: Omit<import("../../../shared/contracts/review-workflows").Workflow, "id" | "createdAt" | "updatedAt"> & {
1736
- stageRequiredToPublishName?: string | null | undefined;
1737
- };
1735
+ data: Omit<import("../../../shared/contracts/review-workflows").Workflow, "id" | "createdAt" | "updatedAt">;
1738
1736
  }, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ReviewWorkflow" | "ReviewWorkflowStages" | "Document" | "ContentTypeSettings", import("../../../shared/contracts/review-workflows").Workflow, "adminApi">>, useDeleteWorkflowMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<Delete.Params, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ReviewWorkflow" | "ReviewWorkflowStages" | "Document" | "ContentTypeSettings", import("../../../shared/contracts/review-workflows").Workflow, "adminApi">>, useUpdateWorkflowMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<{
1739
- data: Partial<Omit<import("../../../shared/contracts/review-workflows").Workflow, "stageRequiredToPublish">> & {
1740
- stageRequiredToPublishName?: string | null | undefined;
1741
- };
1737
+ data: Partial<import("../../../shared/contracts/review-workflows").Workflow>;
1742
1738
  } & Update.Params, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ReviewWorkflow" | "ReviewWorkflowStages" | "Document" | "ContentTypeSettings", import("../../../shared/contracts/review-workflows").Workflow, "adminApi">>;
1743
1739
  export { useGetWorkflowsQuery, useCreateWorkflowMutation, useDeleteWorkflowMutation, useUpdateWorkflowMutation, type GetWorkflowsParams, };
@@ -6387,8 +6387,7 @@ const WORKFLOW_POPULATE = {
6387
6387
  }
6388
6388
  }
6389
6389
  }
6390
- },
6391
- stageRequiredToPublish: true
6390
+ }
6392
6391
  };
6393
6392
  function checkVersionThreshold(startVersion, currentVersion, thresholdVersion) {
6394
6393
  return semver$1.gte(currentVersion, thresholdVersion) && semver$1.lt(startVersion, thresholdVersion);
@@ -6609,12 +6608,6 @@ const workflow = {
6609
6608
  relation: "oneToMany",
6610
6609
  mappedBy: "workflow"
6611
6610
  },
6612
- stageRequiredToPublish: {
6613
- type: "relation",
6614
- target: "plugin::review-workflows.workflow-stage",
6615
- relation: "oneToOne",
6616
- required: false
6617
- },
6618
6611
  contentTypes: {
6619
6612
  type: "json",
6620
6613
  required: true,
@@ -6764,7 +6757,6 @@ const bootstrap = async (args) => {
6764
6757
  const docsMiddlewares = getService("document-service-middlewares");
6765
6758
  strapi.documents.use(docsMiddlewares.assignStageOnCreate);
6766
6759
  strapi.documents.use(docsMiddlewares.handleStageOnUpdate);
6767
- strapi.documents.use(docsMiddlewares.checkStageBeforePublish);
6768
6760
  };
6769
6761
  const destroy = async ({ strapi: strapi2 }) => {
6770
6762
  };
@@ -6997,9 +6989,9 @@ const processFilters = ({ strapi: strapi2 }, filters = {}) => {
6997
6989
  };
6998
6990
  const processPopulate = (populate) => {
6999
6991
  if (!populate) {
7000
- return WORKFLOW_POPULATE;
6992
+ return populate;
7001
6993
  }
7002
- return populate;
6994
+ return WORKFLOW_POPULATE;
7003
6995
  };
7004
6996
  const workflows$1 = ({ strapi: strapi2 }) => {
7005
6997
  const workflowsContentTypes = workflowsContentTypesFactory({ strapi: strapi2 });
@@ -7050,15 +7042,6 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7050
7042
  const stages2 = await getService("stages", { strapi: strapi2 }).createMany(opts.data.stages);
7051
7043
  const mapIds = fp.map(fp.get("id"));
7052
7044
  createOpts = fp.set("data.stages", mapIds(stages2), createOpts);
7053
- if (opts.data.stageRequiredToPublishName) {
7054
- const stageRequiredToPublish = stages2.find(
7055
- (stage) => stage.name === opts.data.stageRequiredToPublishName
7056
- );
7057
- if (!stageRequiredToPublish) {
7058
- throw new utils.errors.ApplicationError("Stage required to publish does not exist");
7059
- }
7060
- createOpts = fp.set("data.stageRequiredToPublish", stageRequiredToPublish.id, createOpts);
7061
- }
7062
7045
  if (opts.data.contentTypes) {
7063
7046
  await workflowsContentTypes.migrate({
7064
7047
  destContentTypes: opts.data.contentTypes,
@@ -7079,7 +7062,6 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7079
7062
  async update(workflow2, opts) {
7080
7063
  const stageService = getService("stages", { strapi: strapi2 });
7081
7064
  let updateOpts = { ...opts, populate: { ...WORKFLOW_POPULATE } };
7082
- let updatedStages = [];
7083
7065
  let updatedStageIds;
7084
7066
  await workflowValidator.validateWorkflowCount();
7085
7067
  return strapi2.db.transaction(async () => {
@@ -7088,28 +7070,9 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7088
7070
  opts.data.stages.forEach(
7089
7071
  (stage) => this.assertStageBelongsToWorkflow(stage.id, workflow2)
7090
7072
  );
7091
- updatedStages = await stageService.replaceStages(
7092
- workflow2.stages,
7093
- opts.data.stages,
7094
- workflow2.contentTypes
7095
- );
7096
- updatedStageIds = updatedStages.map((stage) => stage.id);
7073
+ updatedStageIds = await stageService.replaceStages(workflow2.stages, opts.data.stages, workflow2.contentTypes).then((stages2) => stages2.map((stage) => stage.id));
7097
7074
  updateOpts = fp.set("data.stages", updatedStageIds, updateOpts);
7098
7075
  }
7099
- if (opts.data.stageRequiredToPublishName !== void 0) {
7100
- const stages2 = updatedStages ?? workflow2.stages;
7101
- if (opts.data.stageRequiredToPublishName === null) {
7102
- updateOpts = fp.set("data.stageRequiredToPublish", null, updateOpts);
7103
- } else {
7104
- const stageRequiredToPublish = stages2.find(
7105
- (stage) => stage.name === opts.data.stageRequiredToPublishName
7106
- );
7107
- if (!stageRequiredToPublish) {
7108
- throw new utils.errors.ApplicationError("Stage required to publish does not exist");
7109
- }
7110
- updateOpts = fp.set("data.stageRequiredToPublish", stageRequiredToPublish.id, updateOpts);
7111
- }
7112
- }
7113
7076
  if (opts.data.contentTypes) {
7114
7077
  await workflowsContentTypes.migrate({
7115
7078
  srcContentTypes: workflow2.contentTypes,
@@ -7369,7 +7332,9 @@ const stages$1 = ({ strapi: strapi2 }) => {
7369
7332
  const entity = await strapi2.documents(model).update({
7370
7333
  documentId,
7371
7334
  locale,
7372
- data: { [ENTITY_STAGE_ATTRIBUTE]: stage },
7335
+ // Stage doesn't have DP or i18n enabled, connecting it through the `id`
7336
+ // will be safer than relying on the `documentId` + `locale` + `status` transformation
7337
+ data: { [ENTITY_STAGE_ATTRIBUTE]: fp.pick(["id"], stage) },
7373
7338
  populate: [ENTITY_STAGE_ATTRIBUTE]
7374
7339
  });
7375
7340
  metrics.sendDidChangeEntryStage();
@@ -7645,13 +7610,13 @@ const reviewWorkflowsMetrics = {
7645
7610
  sendDidSendReviewWorkflowPropertiesOnceAWeek,
7646
7611
  sendDidEditAssignee
7647
7612
  };
7648
- function _typeof(obj) {
7613
+ function _typeof(o) {
7649
7614
  "@babel/helpers - typeof";
7650
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
7651
- return typeof obj2;
7652
- } : function(obj2) {
7653
- return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
7654
- }, _typeof(obj);
7615
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
7616
+ return typeof o2;
7617
+ } : function(o2) {
7618
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
7619
+ }, _typeof(o);
7655
7620
  }
7656
7621
  function toInteger(dirtyNumber) {
7657
7622
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
@@ -7786,7 +7751,12 @@ const reviewWorkflowsWeeklyMetrics = ({ strapi: strapi2 }) => {
7786
7751
  },
7787
7752
  async registerCron() {
7788
7753
  const weeklySchedule = await this.ensureWeeklyStoredCronSchedule();
7789
- strapi2.cron.add({ [weeklySchedule]: this.sendMetrics.bind(this) });
7754
+ strapi2.cron.add({
7755
+ reviewWorkflowsWeekly: {
7756
+ task: this.sendMetrics.bind(this),
7757
+ options: weeklySchedule
7758
+ }
7759
+ });
7790
7760
  }
7791
7761
  };
7792
7762
  };
@@ -7868,27 +7838,9 @@ const handleStageOnUpdate = async (ctx, next) => {
7868
7838
  }
7869
7839
  return next();
7870
7840
  };
7871
- const checkStageBeforePublish = async (ctx, next) => {
7872
- if (ctx.action !== "publish") {
7873
- return next();
7874
- }
7875
- const workflow2 = await getService("workflows").getAssignedWorkflow(ctx.contentType.uid, {
7876
- populate: "stageRequiredToPublish"
7877
- });
7878
- if (!workflow2 || !workflow2.stageRequiredToPublish) {
7879
- return next();
7880
- }
7881
- const { documentId } = ctx.params;
7882
- const entryStage = await getEntityStage(ctx.contentType.uid, documentId, ctx.params);
7883
- if (entryStage.id !== workflow2.stageRequiredToPublish.id) {
7884
- throw new utils.errors.ValidationError("Entry is not at the required stage to publish");
7885
- }
7886
- return next();
7887
- };
7888
7841
  const documentServiceMiddleware = () => ({
7889
7842
  assignStageOnCreate,
7890
- handleStageOnUpdate,
7891
- checkStageBeforePublish
7843
+ handleStageOnUpdate
7892
7844
  });
7893
7845
  const services = {
7894
7846
  workflows: workflows$1,
@@ -7938,14 +7890,12 @@ const validateContentTypes = utils.yup.array().of(
7938
7890
  const validateWorkflowCreateSchema = utils.yup.object().shape({
7939
7891
  name: utils.yup.string().max(255).min(1, "Workflow name can not be empty").required(),
7940
7892
  stages: utils.yup.array().of(stageObject).uniqueProperty("name", "Stage name must be unique").min(1, "Can not create a workflow without stages").max(200, "Can not have more than 200 stages").required("Can not create a workflow without stages"),
7941
- contentTypes: validateContentTypes,
7942
- stageRequiredToPublishName: utils.yup.string().min(1).nullable()
7893
+ contentTypes: validateContentTypes
7943
7894
  });
7944
7895
  const validateWorkflowUpdateSchema = utils.yup.object().shape({
7945
7896
  name: utils.yup.string().max(255).min(1, "Workflow name can not be empty"),
7946
7897
  stages: utils.yup.array().of(stageObject).uniqueProperty("name", "Stage name must be unique").min(1, "Can not update a workflow without stages").max(200, "Can not have more than 200 stages"),
7947
- contentTypes: validateContentTypes,
7948
- stageRequiredToPublishName: utils.yup.string().min(1).nullable()
7898
+ contentTypes: validateContentTypes
7949
7899
  });
7950
7900
  const validateUpdateAssigneeOnEntitySchema = utils.yup.object().shape({
7951
7901
  id: utils.yup.number().integer().min(1).nullable()