@strapi/review-workflows 5.57.0 → 5.58.0

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.
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var workflows = require('./constants/workflows.js');
4
+ var reviewWorkflows = require('./utils/review-workflows.js');
5
+
6
+ const optionsOf = (feature)=>typeof feature === 'object' ? feature.options : undefined;
7
+ /**
8
+ * Exposes the clamped workflow limits to the Plan card and the debug dump. Registered whatever
9
+ * the boot-time license says, so a lapsed or later-renewed license still resolves.
10
+ */ const registerReviewWorkflowsEntitlements = (strapi)=>{
11
+ strapi.ee.entitlements.register({
12
+ feature: 'review-workflows',
13
+ limits: [
14
+ {
15
+ key: 'numberOfWorkflows',
16
+ unit: 'count',
17
+ get: (feature)=>reviewWorkflows.clampMaxWorkflows(Number(optionsOf(feature)?.numberOfWorkflows) || workflows.MAX_WORKFLOWS)
18
+ },
19
+ {
20
+ key: 'stagesPerWorkflow',
21
+ unit: 'count',
22
+ get: (feature)=>reviewWorkflows.clampMaxStagesPerWorkflow(Number(optionsOf(feature)?.stagesPerWorkflow) || workflows.MAX_STAGES_PER_WORKFLOW)
23
+ }
24
+ ]
25
+ });
26
+ };
27
+
28
+ exports.registerReviewWorkflowsEntitlements = registerReviewWorkflowsEntitlements;
29
+ //# sourceMappingURL=entitlements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.js","sources":["../../server/src/entitlements.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { MAX_WORKFLOWS, MAX_STAGES_PER_WORKFLOW } from './constants/workflows';\nimport { clampMaxWorkflows, clampMaxStagesPerWorkflow } from './utils/review-workflows';\n\ntype Feature = Parameters<\n Parameters<Core.Strapi['ee']['entitlements']['register']>[0]['limits'][number]['get']\n>[0];\n\nconst optionsOf = (feature: Feature) => (typeof feature === 'object' ? feature.options : undefined);\n\n/**\n * Exposes the clamped workflow limits to the Plan card and the debug dump. Registered whatever\n * the boot-time license says, so a lapsed or later-renewed license still resolves.\n */\nexport const registerReviewWorkflowsEntitlements = (strapi: Core.Strapi) => {\n strapi.ee.entitlements.register({\n feature: 'review-workflows',\n limits: [\n {\n key: 'numberOfWorkflows',\n unit: 'count',\n get: (feature) =>\n clampMaxWorkflows(Number(optionsOf(feature)?.numberOfWorkflows) || MAX_WORKFLOWS),\n },\n {\n key: 'stagesPerWorkflow',\n unit: 'count',\n get: (feature) =>\n clampMaxStagesPerWorkflow(\n Number(optionsOf(feature)?.stagesPerWorkflow) || MAX_STAGES_PER_WORKFLOW\n ),\n },\n ],\n });\n};\n"],"names":["optionsOf","feature","options","undefined","registerReviewWorkflowsEntitlements","strapi","ee","entitlements","register","limits","key","unit","get","clampMaxWorkflows","Number","numberOfWorkflows","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","stagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;;;AASA,MAAMA,SAAAA,GAAY,CAACC,OAAAA,GAAsB,OAAOA,YAAY,QAAA,GAAWA,OAAAA,CAAQC,OAAO,GAAGC,SAAAA;AAEzF;;;IAIO,MAAMC,mCAAAA,GAAsC,CAACC,MAAAA,GAAAA;AAClDA,IAAAA,MAAAA,CAAOC,EAAE,CAACC,YAAY,CAACC,QAAQ,CAAC;QAC9BP,OAAAA,EAAS,kBAAA;QACTQ,MAAAA,EAAQ;AACN,YAAA;gBACEC,GAAAA,EAAK,mBAAA;gBACLC,IAAAA,EAAM,OAAA;AACNC,gBAAAA,GAAAA,EAAK,CAACX,OAAAA,GACJY,iCAAAA,CAAkBC,MAAAA,CAAOd,SAAAA,CAAUC,UAAUc,iBAAAA,CAAAA,IAAsBC,uBAAAA;AACvE,aAAA;AACA,YAAA;gBACEN,GAAAA,EAAK,mBAAA;gBACLC,IAAAA,EAAM,OAAA;AACNC,gBAAAA,GAAAA,EAAK,CAACX,OAAAA,GACJgB,yCAAAA,CACEH,MAAAA,CAAOd,SAAAA,CAAUC,UAAUiB,iBAAAA,CAAAA,IAAsBC,iCAAAA;AAEvD;AACD;AACH,KAAA,CAAA;AACF;;;;"}
@@ -0,0 +1,27 @@
1
+ import { MAX_WORKFLOWS, MAX_STAGES_PER_WORKFLOW } from './constants/workflows.mjs';
2
+ import { clampMaxWorkflows, clampMaxStagesPerWorkflow } from './utils/review-workflows.mjs';
3
+
4
+ const optionsOf = (feature)=>typeof feature === 'object' ? feature.options : undefined;
5
+ /**
6
+ * Exposes the clamped workflow limits to the Plan card and the debug dump. Registered whatever
7
+ * the boot-time license says, so a lapsed or later-renewed license still resolves.
8
+ */ const registerReviewWorkflowsEntitlements = (strapi)=>{
9
+ strapi.ee.entitlements.register({
10
+ feature: 'review-workflows',
11
+ limits: [
12
+ {
13
+ key: 'numberOfWorkflows',
14
+ unit: 'count',
15
+ get: (feature)=>clampMaxWorkflows(Number(optionsOf(feature)?.numberOfWorkflows) || MAX_WORKFLOWS)
16
+ },
17
+ {
18
+ key: 'stagesPerWorkflow',
19
+ unit: 'count',
20
+ get: (feature)=>clampMaxStagesPerWorkflow(Number(optionsOf(feature)?.stagesPerWorkflow) || MAX_STAGES_PER_WORKFLOW)
21
+ }
22
+ ]
23
+ });
24
+ };
25
+
26
+ export { registerReviewWorkflowsEntitlements };
27
+ //# sourceMappingURL=entitlements.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.mjs","sources":["../../server/src/entitlements.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { MAX_WORKFLOWS, MAX_STAGES_PER_WORKFLOW } from './constants/workflows';\nimport { clampMaxWorkflows, clampMaxStagesPerWorkflow } from './utils/review-workflows';\n\ntype Feature = Parameters<\n Parameters<Core.Strapi['ee']['entitlements']['register']>[0]['limits'][number]['get']\n>[0];\n\nconst optionsOf = (feature: Feature) => (typeof feature === 'object' ? feature.options : undefined);\n\n/**\n * Exposes the clamped workflow limits to the Plan card and the debug dump. Registered whatever\n * the boot-time license says, so a lapsed or later-renewed license still resolves.\n */\nexport const registerReviewWorkflowsEntitlements = (strapi: Core.Strapi) => {\n strapi.ee.entitlements.register({\n feature: 'review-workflows',\n limits: [\n {\n key: 'numberOfWorkflows',\n unit: 'count',\n get: (feature) =>\n clampMaxWorkflows(Number(optionsOf(feature)?.numberOfWorkflows) || MAX_WORKFLOWS),\n },\n {\n key: 'stagesPerWorkflow',\n unit: 'count',\n get: (feature) =>\n clampMaxStagesPerWorkflow(\n Number(optionsOf(feature)?.stagesPerWorkflow) || MAX_STAGES_PER_WORKFLOW\n ),\n },\n ],\n });\n};\n"],"names":["optionsOf","feature","options","undefined","registerReviewWorkflowsEntitlements","strapi","ee","entitlements","register","limits","key","unit","get","clampMaxWorkflows","Number","numberOfWorkflows","MAX_WORKFLOWS","clampMaxStagesPerWorkflow","stagesPerWorkflow","MAX_STAGES_PER_WORKFLOW"],"mappings":";;;AASA,MAAMA,SAAAA,GAAY,CAACC,OAAAA,GAAsB,OAAOA,YAAY,QAAA,GAAWA,OAAAA,CAAQC,OAAO,GAAGC,SAAAA;AAEzF;;;IAIO,MAAMC,mCAAAA,GAAsC,CAACC,MAAAA,GAAAA;AAClDA,IAAAA,MAAAA,CAAOC,EAAE,CAACC,YAAY,CAACC,QAAQ,CAAC;QAC9BP,OAAAA,EAAS,kBAAA;QACTQ,MAAAA,EAAQ;AACN,YAAA;gBACEC,GAAAA,EAAK,mBAAA;gBACLC,IAAAA,EAAM,OAAA;AACNC,gBAAAA,GAAAA,EAAK,CAACX,OAAAA,GACJY,iBAAAA,CAAkBC,MAAAA,CAAOd,SAAAA,CAAUC,UAAUc,iBAAAA,CAAAA,IAAsBC,aAAAA;AACvE,aAAA;AACA,YAAA;gBACEN,GAAAA,EAAK,mBAAA;gBACLC,IAAAA,EAAM,OAAA;AACNC,gBAAAA,GAAAA,EAAK,CAACX,OAAAA,GACJgB,yBAAAA,CACEH,MAAAA,CAAOd,SAAAA,CAAUC,UAAUiB,iBAAAA,CAAAA,IAAsBC,uBAAAA;AAEvD;AACD;AACH,KAAA,CAAA;AACF;;;;"}
@@ -7,6 +7,7 @@ var destroy = require('./destroy.js');
7
7
  var index$1 = require('./routes/index.js');
8
8
  var index$3 = require('./services/index.js');
9
9
  var index$2 = require('./controllers/index.js');
10
+ var entitlements = require('./entitlements.js');
10
11
 
11
12
  const getPlugin = ()=>{
12
13
  if (strapi.ee.features.isEnabled('review-workflows')) {
@@ -21,6 +22,10 @@ const getPlugin = ()=>{
21
22
  };
22
23
  }
23
24
  return {
25
+ // Keeps the limits resolvable for a license that lapsed before boot
26
+ register ({ strapi: strapi1 }) {
27
+ entitlements.registerReviewWorkflowsEntitlements(strapi1);
28
+ },
24
29
  // Always return contentTypes to avoid losing data when the feature is disabled
25
30
  // or downgrading the license
26
31
  contentTypes: index$4
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import register from './register';\nimport contentTypes from './content-types';\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport routes from './routes';\nimport services from './services';\nimport controllers from './controllers';\n\nconst getPlugin = () => {\n if (strapi.ee.features.isEnabled('review-workflows')) {\n return {\n register,\n bootstrap,\n destroy,\n contentTypes,\n services,\n controllers,\n routes,\n };\n }\n\n return {\n // Always return contentTypes to avoid losing data when the feature is disabled\n // or downgrading the license\n contentTypes,\n };\n};\n\nexport default getPlugin();\n"],"names":["getPlugin","strapi","ee","features","isEnabled","register","bootstrap","destroy","contentTypes","services","controllers","routes"],"mappings":";;;;;;;;;;AAQA,MAAMA,SAAAA,GAAY,IAAA;AAChB,IAAA,IAAIC,OAAOC,EAAE,CAACC,QAAQ,CAACC,SAAS,CAAC,kBAAA,CAAA,EAAqB;QACpD,OAAO;AACLC,YAAAA,QAAAA;AACAC,YAAAA,SAAAA;AACAC,YAAAA,OAAAA;AACAC,0BAAAA,OAAAA;AACAC,sBAAAA,OAAAA;AACAC,yBAAAA,OAAAA;AACAC,oBAAAA;AACF,SAAA;AACF,IAAA;IAEA,OAAO;;;AAGLH,sBAAAA;AACF,KAAA;AACF,CAAA;AAEA,YAAeR,SAAAA,EAAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport register from './register';\nimport contentTypes from './content-types';\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport routes from './routes';\nimport services from './services';\nimport controllers from './controllers';\nimport { registerReviewWorkflowsEntitlements } from './entitlements';\n\nconst getPlugin = () => {\n if (strapi.ee.features.isEnabled('review-workflows')) {\n return {\n register,\n bootstrap,\n destroy,\n contentTypes,\n services,\n controllers,\n routes,\n };\n }\n\n return {\n // Keeps the limits resolvable for a license that lapsed before boot\n register({ strapi }: { strapi: Core.Strapi }) {\n registerReviewWorkflowsEntitlements(strapi);\n },\n // Always return contentTypes to avoid losing data when the feature is disabled\n // or downgrading the license\n contentTypes,\n };\n};\n\nexport default getPlugin();\n"],"names":["getPlugin","strapi","ee","features","isEnabled","register","bootstrap","destroy","contentTypes","services","controllers","routes","registerReviewWorkflowsEntitlements"],"mappings":";;;;;;;;;;;AAWA,MAAMA,SAAAA,GAAY,IAAA;AAChB,IAAA,IAAIC,OAAOC,EAAE,CAACC,QAAQ,CAACC,SAAS,CAAC,kBAAA,CAAA,EAAqB;QACpD,OAAO;AACLC,YAAAA,QAAAA;AACAC,YAAAA,SAAAA;AACAC,YAAAA,OAAAA;AACAC,0BAAAA,OAAAA;AACAC,sBAAAA,OAAAA;AACAC,yBAAAA,OAAAA;AACAC,oBAAAA;AACF,SAAA;AACF,IAAA;IAEA,OAAO;;QAELN,QAAAA,CAAAA,CAAS,EAAEJ,MAAAA,EAAAA,OAAM,EAA2B,EAAA;YAC1CW,gDAAAA,CAAoCX,OAAAA,CAAAA;AACtC,QAAA,CAAA;;;AAGAO,sBAAAA;AACF,KAAA;AACF,CAAA;AAEA,YAAeR,SAAAA,EAAAA;;;;"}
@@ -5,6 +5,7 @@ import destroy from './destroy.mjs';
5
5
  import routes from './routes/index.mjs';
6
6
  import services from './services/index.mjs';
7
7
  import controllers from './controllers/index.mjs';
8
+ import { registerReviewWorkflowsEntitlements } from './entitlements.mjs';
8
9
 
9
10
  const getPlugin = ()=>{
10
11
  if (strapi.ee.features.isEnabled('review-workflows')) {
@@ -19,6 +20,10 @@ const getPlugin = ()=>{
19
20
  };
20
21
  }
21
22
  return {
23
+ // Keeps the limits resolvable for a license that lapsed before boot
24
+ register ({ strapi: strapi1 }) {
25
+ registerReviewWorkflowsEntitlements(strapi1);
26
+ },
22
27
  // Always return contentTypes to avoid losing data when the feature is disabled
23
28
  // or downgrading the license
24
29
  contentTypes
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import register from './register';\nimport contentTypes from './content-types';\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport routes from './routes';\nimport services from './services';\nimport controllers from './controllers';\n\nconst getPlugin = () => {\n if (strapi.ee.features.isEnabled('review-workflows')) {\n return {\n register,\n bootstrap,\n destroy,\n contentTypes,\n services,\n controllers,\n routes,\n };\n }\n\n return {\n // Always return contentTypes to avoid losing data when the feature is disabled\n // or downgrading the license\n contentTypes,\n };\n};\n\nexport default getPlugin();\n"],"names":["getPlugin","strapi","ee","features","isEnabled","register","bootstrap","destroy","contentTypes","services","controllers","routes"],"mappings":";;;;;;;;AAQA,MAAMA,SAAAA,GAAY,IAAA;AAChB,IAAA,IAAIC,OAAOC,EAAE,CAACC,QAAQ,CAACC,SAAS,CAAC,kBAAA,CAAA,EAAqB;QACpD,OAAO;AACLC,YAAAA,QAAAA;AACAC,YAAAA,SAAAA;AACAC,YAAAA,OAAAA;AACAC,YAAAA,YAAAA;AACAC,YAAAA,QAAAA;AACAC,YAAAA,WAAAA;AACAC,YAAAA;AACF,SAAA;AACF,IAAA;IAEA,OAAO;;;AAGLH,QAAAA;AACF,KAAA;AACF,CAAA;AAEA,YAAeR,SAAAA,EAAAA;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport register from './register';\nimport contentTypes from './content-types';\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport routes from './routes';\nimport services from './services';\nimport controllers from './controllers';\nimport { registerReviewWorkflowsEntitlements } from './entitlements';\n\nconst getPlugin = () => {\n if (strapi.ee.features.isEnabled('review-workflows')) {\n return {\n register,\n bootstrap,\n destroy,\n contentTypes,\n services,\n controllers,\n routes,\n };\n }\n\n return {\n // Keeps the limits resolvable for a license that lapsed before boot\n register({ strapi }: { strapi: Core.Strapi }) {\n registerReviewWorkflowsEntitlements(strapi);\n },\n // Always return contentTypes to avoid losing data when the feature is disabled\n // or downgrading the license\n contentTypes,\n };\n};\n\nexport default getPlugin();\n"],"names":["getPlugin","strapi","ee","features","isEnabled","register","bootstrap","destroy","contentTypes","services","controllers","routes","registerReviewWorkflowsEntitlements"],"mappings":";;;;;;;;;AAWA,MAAMA,SAAAA,GAAY,IAAA;AAChB,IAAA,IAAIC,OAAOC,EAAE,CAACC,QAAQ,CAACC,SAAS,CAAC,kBAAA,CAAA,EAAqB;QACpD,OAAO;AACLC,YAAAA,QAAAA;AACAC,YAAAA,SAAAA;AACAC,YAAAA,OAAAA;AACAC,YAAAA,YAAAA;AACAC,YAAAA,QAAAA;AACAC,YAAAA,WAAAA;AACAC,YAAAA;AACF,SAAA;AACF,IAAA;IAEA,OAAO;;QAELN,QAAAA,CAAAA,CAAS,EAAEJ,MAAAA,EAAAA,OAAM,EAA2B,EAAA;YAC1CW,mCAAAA,CAAoCX,OAAAA,CAAAA;AACtC,QAAA,CAAA;;;AAGAO,QAAAA;AACF,KAAA;AACF,CAAA;AAEA,YAAeR,SAAAA,EAAAA;;;;"}
@@ -10,6 +10,7 @@ var multipleWorkflows = require('./migrations/multiple-workflows.js');
10
10
  var handleDeletedCtInWorkflows = require('./migrations/handle-deleted-ct-in-workflows.js');
11
11
  var reviewWorkflows = require('./middlewares/review-workflows.js');
12
12
  var reviewWorkflows$1 = require('./utils/review-workflows.js');
13
+ var entitlements = require('./entitlements.js');
13
14
  var workflows = require('./constants/workflows.js');
14
15
 
15
16
  const setRelation = (attributeName, target, contentType)=>{
@@ -106,6 +107,7 @@ var register = (async ({ strapi })=>{
106
107
  strapi
107
108
  });
108
109
  workflowsValidationService.register(reviewWorkflowsOptions);
110
+ entitlements.registerReviewWorkflowsEntitlements(strapi);
109
111
  });
110
112
 
111
113
  module.exports = register;
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import { defaultsDeep } from 'lodash';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport { getService, getAdminService } from './utils';\nimport migrateReviewWorkflowStagesColor from './migrations/set-stages-default-color';\nimport migrateReviewWorkflowStagesRoles from './migrations/set-stages-roles';\nimport migrateReviewWorkflowStagesTransferToRoles from './migrations/setup-stage-transfer-to-roles';\nimport migrateReviewWorkflowName from './migrations/set-workflow-default-name';\nimport migrateWorkflowsContentTypes from './migrations/multiple-workflows';\nimport migrateDeletedCTInWorkflows from './migrations/handle-deleted-ct-in-workflows';\nimport reviewWorkflowsMiddlewares from './middlewares/review-workflows';\n\nimport { getVisibleContentTypesUID, hasStageAttribute } from './utils/review-workflows';\n\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n ENTITY_ASSIGNEE_ATTRIBUTE,\n STAGE_MODEL_UID,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from './constants/workflows';\n\nconst setRelation = (attributeName: any, target: any, contentType: any) => {\n Object.assign(contentType.attributes, {\n [attributeName]: {\n writable: true,\n private: false,\n configurable: false,\n visible: false,\n useJoinTable: true, // We want a join table to persist data when downgrading to CE\n type: 'relation',\n relation: 'oneToOne',\n target,\n },\n });\n\n return contentType;\n};\n\n/**\n * Add the stage and assignee attributes to content types\n */\nfunction extendReviewWorkflowContentTypes({ strapi }: { strapi: Core.Strapi }) {\n const contentTypeToExtend = getVisibleContentTypesUID(strapi.contentTypes);\n\n for (const contentTypeUID of contentTypeToExtend) {\n strapi.get('content-types').extend(contentTypeUID, (contentType: any) => {\n // Set Stage attribute\n setRelation(ENTITY_STAGE_ATTRIBUTE, STAGE_MODEL_UID, contentType);\n // Set Assignee attribute\n setRelation(ENTITY_ASSIGNEE_ATTRIBUTE, 'admin::user', contentType);\n });\n }\n}\n\n/**\n * Persist the stage & assignee attributes so they are not removed when downgrading to CE.\n *\n * TODO: V6 - Instead of persisting the join tables, always create the stage & assignee attributes, even in CE mode\n * It was decided in V4 & V5 to not expose them in CE (as they pollute the CTs) but it's not worth given the complexity this needs\n */\nfunction persistRWOnDowngrade({ strapi }: { strapi: Core.Strapi }) {\n const { removePersistedTablesWithSuffix, persistTables } = getAdminService('persist-tables');\n\n return async ({ contentTypes }: { contentTypes: Record<UID.ContentType, any> }) => {\n const getStageTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the stage join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const getAssigneeTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the assignee join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const enabledRWContentTypes = getVisibleContentTypesUID(contentTypes).filter((uid) =>\n hasStageAttribute(contentTypes[uid])\n );\n\n // Remove previously created join tables and persist the new ones\n const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_stage_lnk');\n await persistTables(stageJoinTablesToPersist);\n\n // Remove previously created join tables and persist the new ones\n const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_assignee_lnk');\n await persistTables(assigneeJoinTablesToPersist);\n };\n}\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n // Data Migrations\n strapi.hook('strapi::content-types.afterSync').register(persistRWOnDowngrade({ strapi }));\n strapi\n .hook('strapi::content-types.afterSync')\n .register(migrateReviewWorkflowStagesColor)\n .register(migrateReviewWorkflowStagesRoles)\n .register(migrateReviewWorkflowStagesTransferToRoles)\n .register(migrateReviewWorkflowName)\n .register(migrateWorkflowsContentTypes)\n .register(migrateDeletedCTInWorkflows);\n\n // Middlewares\n reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi);\n\n // Schema customization\n extendReviewWorkflowContentTypes({ strapi });\n\n // License limits\n const reviewWorkflowsOptions = defaultsDeep({}, strapi.ee.features.get('review-workflows'), {\n numberOfWorkflows: MAX_WORKFLOWS,\n stagesPerWorkflow: MAX_STAGES_PER_WORKFLOW,\n });\n const workflowsValidationService = getService('validation', { strapi });\n workflowsValidationService.register(reviewWorkflowsOptions);\n};\n"],"names":["setRelation","attributeName","target","contentType","Object","assign","attributes","writable","private","configurable","visible","useJoinTable","type","relation","extendReviewWorkflowContentTypes","strapi","contentTypeToExtend","getVisibleContentTypesUID","contentTypes","contentTypeUID","get","extend","ENTITY_STAGE_ATTRIBUTE","STAGE_MODEL_UID","ENTITY_ASSIGNEE_ATTRIBUTE","persistRWOnDowngrade","removePersistedTablesWithSuffix","persistTables","getAdminService","getStageTableToPersist","tableName","db","metadata","joinTableName","joinTable","name","dependsOn","getAssigneeTableToPersist","enabledRWContentTypes","filter","uid","hasStageAttribute","stageJoinTablesToPersist","map","assigneeJoinTablesToPersist","hook","register","migrateReviewWorkflowStagesColor","migrateReviewWorkflowStagesRoles","migrateReviewWorkflowStagesTransferToRoles","migrateReviewWorkflowName","migrateWorkflowsContentTypes","migrateDeletedCTInWorkflows","reviewWorkflowsMiddlewares","contentTypeMiddleware","reviewWorkflowsOptions","defaultsDeep","ee","features","numberOfWorkflows","MAX_W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,CAAAA;AACtB,IAAA,CAAA;AACF;AAEA,eAAe,CAAA,OAAO,EAAE7B,MAAM,EAA2B,GAAA;;AAEvDA,IAAAA,MAAAA,CAAO8B,IAAI,CAAC,iCAAA,CAAA,CAAmCC,QAAQ,CAACrB,oBAAAA,CAAqB;AAAEV,QAAAA;AAAO,KAAA,CAAA,CAAA;AACtFA,IAAAA,MAAAA,CACG8B,IAAI,CAAC,iCAAA,CAAA,CACLC,QAAQ,CAACC,qBAAAA,CAAAA,CACTD,QAAQ,CAACE,cAAAA,CAAAA,CACTF,QAAQ,CAACG,yBAAAA,CAAAA,CACTH,QAAQ,CAACI,sBAAAA,CAAAA,CACTJ,QAAQ,CAACK,iBAAAA,CAAAA,CACTL,QAAQ,CAACM,0BAAAA,CAAAA;;AAGZC,IAAAA,uBAAAA,CAA2BC,qBAAqB,CAACvC,MAAAA,CAAAA;;IAGjDD,gCAAAA,CAAiC;AAAEC,QAAAA;AAAO,KAAA,CAAA;;IAG1C,MAAMwC,sBAAAA,GAAyBC,mBAAAA,CAAa,EAAC,EAAGzC,MAAAA,CAAO0C,EAAE,CAACC,QAAQ,CAACtC,GAAG,CAAC,kBAAA,CAAA,EAAqB;QAC1FuC,iBAAAA,EAAmBC,uBAAAA;QACnBC,iBAAAA,EAAmBC;AACrB,KAAA,CAAA;IACA,MAAMC,0BAAAA,GAA6BC,iBAAW,YAAA,EAAc;AAAEjD,QAAAA;AAAO,KAAA,CAAA;AACrEgD,IAAAA,0BAAAA,CAA2BjB,QAAQ,CAACS,sBAAAA,CAAAA;AACtC,CAAA;;;;"}
1
+ {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import { defaultsDeep } from 'lodash';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport { getService, getAdminService } from './utils';\nimport migrateReviewWorkflowStagesColor from './migrations/set-stages-default-color';\nimport migrateReviewWorkflowStagesRoles from './migrations/set-stages-roles';\nimport migrateReviewWorkflowStagesTransferToRoles from './migrations/setup-stage-transfer-to-roles';\nimport migrateReviewWorkflowName from './migrations/set-workflow-default-name';\nimport migrateWorkflowsContentTypes from './migrations/multiple-workflows';\nimport migrateDeletedCTInWorkflows from './migrations/handle-deleted-ct-in-workflows';\nimport reviewWorkflowsMiddlewares from './middlewares/review-workflows';\n\nimport { getVisibleContentTypesUID, hasStageAttribute } from './utils/review-workflows';\nimport { registerReviewWorkflowsEntitlements } from './entitlements';\n\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n ENTITY_ASSIGNEE_ATTRIBUTE,\n STAGE_MODEL_UID,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from './constants/workflows';\n\nconst setRelation = (attributeName: any, target: any, contentType: any) => {\n Object.assign(contentType.attributes, {\n [attributeName]: {\n writable: true,\n private: false,\n configurable: false,\n visible: false,\n useJoinTable: true, // We want a join table to persist data when downgrading to CE\n type: 'relation',\n relation: 'oneToOne',\n target,\n },\n });\n\n return contentType;\n};\n\n/**\n * Add the stage and assignee attributes to content types\n */\nfunction extendReviewWorkflowContentTypes({ strapi }: { strapi: Core.Strapi }) {\n const contentTypeToExtend = getVisibleContentTypesUID(strapi.contentTypes);\n\n for (const contentTypeUID of contentTypeToExtend) {\n strapi.get('content-types').extend(contentTypeUID, (contentType: any) => {\n // Set Stage attribute\n setRelation(ENTITY_STAGE_ATTRIBUTE, STAGE_MODEL_UID, contentType);\n // Set Assignee attribute\n setRelation(ENTITY_ASSIGNEE_ATTRIBUTE, 'admin::user', contentType);\n });\n }\n}\n\n/**\n * Persist the stage & assignee attributes so they are not removed when downgrading to CE.\n *\n * TODO: V6 - Instead of persisting the join tables, always create the stage & assignee attributes, even in CE mode\n * It was decided in V4 & V5 to not expose them in CE (as they pollute the CTs) but it's not worth given the complexity this needs\n */\nfunction persistRWOnDowngrade({ strapi }: { strapi: Core.Strapi }) {\n const { removePersistedTablesWithSuffix, persistTables } = getAdminService('persist-tables');\n\n return async ({ contentTypes }: { contentTypes: Record<UID.ContentType, any> }) => {\n const getStageTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the stage join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const getAssigneeTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the assignee join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const enabledRWContentTypes = getVisibleContentTypesUID(contentTypes).filter((uid) =>\n hasStageAttribute(contentTypes[uid])\n );\n\n // Remove previously created join tables and persist the new ones\n const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_stage_lnk');\n await persistTables(stageJoinTablesToPersist);\n\n // Remove previously created join tables and persist the new ones\n const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_assignee_lnk');\n await persistTables(assigneeJoinTablesToPersist);\n };\n}\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n // Data Migrations\n strapi.hook('strapi::content-types.afterSync').register(persistRWOnDowngrade({ strapi }));\n strapi\n .hook('strapi::content-types.afterSync')\n .register(migrateReviewWorkflowStagesColor)\n .register(migrateReviewWorkflowStagesRoles)\n .register(migrateReviewWorkflowStagesTransferToRoles)\n .register(migrateReviewWorkflowName)\n .register(migrateWorkflowsContentTypes)\n .register(migrateDeletedCTInWorkflows);\n\n // Middlewares\n reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi);\n\n // Schema customization\n extendReviewWorkflowContentTypes({ strapi });\n\n // License limits\n const reviewWorkflowsOptions = defaultsDeep({}, strapi.ee.features.get('review-workflows'), {\n numberOfWorkflows: MAX_WORKFLOWS,\n stagesPerWorkflow: MAX_STAGES_PER_WORKFLOW,\n });\n const workflowsValidationService = getService('validation', { strapi });\n workflowsValidationService.register(reviewWorkflowsOptions);\n\n registerReviewWorkflowsEntitlements(strapi);\n};\n"],"names":["setRelation","attributeName","target","contentType","Object","assign","attributes","writable","private","configurable","visible","useJoinTable","type","relation","extendReviewWorkflowContentTypes","strapi","contentTypeToExtend","getVisibleContentTypesUID","contentTypes","contentTypeUID","get","extend","ENTITY_STAGE_ATTRIBUTE","STAGE_MODEL_UID","ENTITY_ASSIGNEE_ATTRIBUTE","persistRWOnDowngrade","removePersistedTablesWithSuffix","persistTables","getAdminService","getStageTableToPersist","tableName","db","metadata","joinTableName","joinTable","name","dependsOn","getAssigneeTableToPersist","enabledRWContentTypes","filter","uid","hasStageAttribute","stageJoinTablesToPersist","map","assigneeJoinTablesToPersist","hook","register","migrateReviewWorkflowStagesColor","migrateReviewWorkflowStagesRoles","migrateReviewWorkflowStagesTransferToRoles","migrateReviewWorkflowName","migrateWorkflowsContentTypes","migrateDeletedCTInWorkflows","reviewWorkflowsMiddlewares","contentTypeMiddleware","reviewWorkflowsOptions","defaultsDeep","ee","features","numberOfWorkflows","MAX_WORKFLOWS","stagesPerWorkflow","MAX_STAGES_PER_WORKFLOW","workflowsValidationService","getService","registerReviewWorkflowsEntitlements"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAMA,WAAAA,GAAc,CAACC,aAAAA,EAAoBC,MAAAA,EAAaC,WAAAA,GAAAA;AACpDC,IAAAA,MAAAA,CAAOC,MAAM,CAACF,WAAAA,CAAYG,UAAU,EAAE;AACpC,QAAA,CAACL,gBAAgB;YACfM,QAAAA,EAAU,IAAA;YACVC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,KAAA;YACdC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,IAAA;YACdC,IAAAA,EAAM,UAAA;YACNC,QAAAA,EAAU,UAAA;AACVX,YAAAA;AACF;AACF,KAAA,CAAA;IAEA,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AAAA;;AAGZC,IAAAA,uBAAAA,CAA2BC,qBAAqB,CAACvC,MAAAA,CAAAA;;IAGjDD,gCAAAA,CAAiC;AAAEC,QAAAA;AAAO,KAAA,CAAA;;IAG1C,MAAMwC,sBAAAA,GAAyBC,mBAAAA,CAAa,EAAC,EAAGzC,MAAAA,CAAO0C,EAAE,CAACC,QAAQ,CAACtC,GAAG,CAAC,kBAAA,CAAA,EAAqB;QAC1FuC,iBAAAA,EAAmBC,uBAAAA;QACnBC,iBAAAA,EAAmBC;AACrB,KAAA,CAAA;IACA,MAAMC,0BAAAA,GAA6BC,iBAAW,YAAA,EAAc;AAAEjD,QAAAA;AAAO,KAAA,CAAA;AACrEgD,IAAAA,0BAAAA,CAA2BjB,QAAQ,CAACS,sBAAAA,CAAAA;IAEpCU,gDAAAA,CAAoClD,MAAAA,CAAAA;AACtC,CAAA;;;;"}
@@ -8,6 +8,7 @@ import migrateWorkflowsContentTypes from './migrations/multiple-workflows.mjs';
8
8
  import migrateDeletedCTInWorkflows from './migrations/handle-deleted-ct-in-workflows.mjs';
9
9
  import reviewWorkflowsMiddlewares from './middlewares/review-workflows.mjs';
10
10
  import { getVisibleContentTypesUID, hasStageAttribute } from './utils/review-workflows.mjs';
11
+ import { registerReviewWorkflowsEntitlements } from './entitlements.mjs';
11
12
  import { MAX_STAGES_PER_WORKFLOW, MAX_WORKFLOWS, ENTITY_STAGE_ATTRIBUTE, ENTITY_ASSIGNEE_ATTRIBUTE, STAGE_MODEL_UID } from './constants/workflows.mjs';
12
13
 
13
14
  const setRelation = (attributeName, target, contentType)=>{
@@ -104,6 +105,7 @@ var register = (async ({ strapi })=>{
104
105
  strapi
105
106
  });
106
107
  workflowsValidationService.register(reviewWorkflowsOptions);
108
+ registerReviewWorkflowsEntitlements(strapi);
107
109
  });
108
110
 
109
111
  export { register as default };
@@ -1 +1 @@
1
- {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import { defaultsDeep } from 'lodash';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport { getService, getAdminService } from './utils';\nimport migrateReviewWorkflowStagesColor from './migrations/set-stages-default-color';\nimport migrateReviewWorkflowStagesRoles from './migrations/set-stages-roles';\nimport migrateReviewWorkflowStagesTransferToRoles from './migrations/setup-stage-transfer-to-roles';\nimport migrateReviewWorkflowName from './migrations/set-workflow-default-name';\nimport migrateWorkflowsContentTypes from './migrations/multiple-workflows';\nimport migrateDeletedCTInWorkflows from './migrations/handle-deleted-ct-in-workflows';\nimport reviewWorkflowsMiddlewares from './middlewares/review-workflows';\n\nimport { getVisibleContentTypesUID, hasStageAttribute } from './utils/review-workflows';\n\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n ENTITY_ASSIGNEE_ATTRIBUTE,\n STAGE_MODEL_UID,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from './constants/workflows';\n\nconst setRelation = (attributeName: any, target: any, contentType: any) => {\n Object.assign(contentType.attributes, {\n [attributeName]: {\n writable: true,\n private: false,\n configurable: false,\n visible: false,\n useJoinTable: true, // We want a join table to persist data when downgrading to CE\n type: 'relation',\n relation: 'oneToOne',\n target,\n },\n });\n\n return contentType;\n};\n\n/**\n * Add the stage and assignee attributes to content types\n */\nfunction extendReviewWorkflowContentTypes({ strapi }: { strapi: Core.Strapi }) {\n const contentTypeToExtend = getVisibleContentTypesUID(strapi.contentTypes);\n\n for (const contentTypeUID of contentTypeToExtend) {\n strapi.get('content-types').extend(contentTypeUID, (contentType: any) => {\n // Set Stage attribute\n setRelation(ENTITY_STAGE_ATTRIBUTE, STAGE_MODEL_UID, contentType);\n // Set Assignee attribute\n setRelation(ENTITY_ASSIGNEE_ATTRIBUTE, 'admin::user', contentType);\n });\n }\n}\n\n/**\n * Persist the stage & assignee attributes so they are not removed when downgrading to CE.\n *\n * TODO: V6 - Instead of persisting the join tables, always create the stage & assignee attributes, even in CE mode\n * It was decided in V4 & V5 to not expose them in CE (as they pollute the CTs) but it's not worth given the complexity this needs\n */\nfunction persistRWOnDowngrade({ strapi }: { strapi: Core.Strapi }) {\n const { removePersistedTablesWithSuffix, persistTables } = getAdminService('persist-tables');\n\n return async ({ contentTypes }: { contentTypes: Record<UID.ContentType, any> }) => {\n const getStageTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the stage join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const getAssigneeTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the assignee join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const enabledRWContentTypes = getVisibleContentTypesUID(contentTypes).filter((uid) =>\n hasStageAttribute(contentTypes[uid])\n );\n\n // Remove previously created join tables and persist the new ones\n const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_stage_lnk');\n await persistTables(stageJoinTablesToPersist);\n\n // Remove previously created join tables and persist the new ones\n const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_assignee_lnk');\n await persistTables(assigneeJoinTablesToPersist);\n };\n}\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n // Data Migrations\n strapi.hook('strapi::content-types.afterSync').register(persistRWOnDowngrade({ strapi }));\n strapi\n .hook('strapi::content-types.afterSync')\n .register(migrateReviewWorkflowStagesColor)\n .register(migrateReviewWorkflowStagesRoles)\n .register(migrateReviewWorkflowStagesTransferToRoles)\n .register(migrateReviewWorkflowName)\n .register(migrateWorkflowsContentTypes)\n .register(migrateDeletedCTInWorkflows);\n\n // Middlewares\n reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi);\n\n // Schema customization\n extendReviewWorkflowContentTypes({ strapi });\n\n // License limits\n const reviewWorkflowsOptions = defaultsDeep({}, strapi.ee.features.get('review-workflows'), {\n numberOfWorkflows: MAX_WORKFLOWS,\n stagesPerWorkflow: MAX_STAGES_PER_WORKFLOW,\n });\n const workflowsValidationService = getService('validation', { strapi });\n workflowsValidationService.register(reviewWorkflowsOptions);\n};\n"],"names":["setRelation","attributeName","target","contentType","Object","assign","attributes","writable","private","configurable","visible","useJoinTable","type","relation","extendReviewWorkflowContentTypes","strapi","contentTypeToExtend","getVisibleContentTypesUID","contentTypes","contentTypeUID","get","extend","ENTITY_STAGE_ATTRIBUTE","STAGE_MODEL_UID","ENTITY_ASSIGNEE_ATTRIBUTE","persistRWOnDowngrade","removePersistedTablesWithSuffix","persistTables","getAdminService","getStageTableToPersist","tableName","db","metadata","joinTableName","joinTable","name","dependsOn","getAssigneeTableToPersist","enabledRWContentTypes","filter","uid","hasStageAttribute","stageJoinTablesToPersist","map","assigneeJoinTablesToPersist","hook","register","migrateReviewWorkflowStagesColor","migrateReviewWorkflowStagesRoles","migrateReviewWorkflowStagesTransferToRoles","migrateReviewWorkflowName","migrateWorkflowsContentTypes","migrateDeletedCTInWorkflows","reviewWorkflowsMiddlewares","contentTypeMiddleware","reviewWorkflowsOptions","defaultsDeep","ee","features","numberOfWorkflows","MAX_WORKFLOWS","stagesPerWorkflow","MAX_STAGES_PER_WORKFLOW","workflowsValidationService","getService"],"mappings":";;;;;;;;;;;;AAuBA,MAAMA,WAAAA,GAAc,CAACC,aAAAA,EAAoBC,MAAAA,EAAaC,WAAAA,GAAAA;AACpDC,IAAAA,MAAAA,CAAOC,MAAM,CAACF,WAAAA,CAAYG,UAAU,EAAE;AACpC,QAAA,CAACL,gBAAgB;YACfM,QAAAA,EAAU,IAAA;YACVC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,KAAA;YACdC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,IAAA;YACdC,IA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,yBAAAA,CAAAA,CACTJ,QAAQ,CAACK,4BAAAA,CAAAA,CACTL,QAAQ,CAACM,2BAAAA,CAAAA;;AAGZC,IAAAA,0BAAAA,CAA2BC,qBAAqB,CAACvC,MAAAA,CAAAA;;IAGjDD,gCAAAA,CAAiC;AAAEC,QAAAA;AAAO,KAAA,CAAA;;IAG1C,MAAMwC,sBAAAA,GAAyBC,YAAAA,CAAa,EAAC,EAAGzC,MAAAA,CAAO0C,EAAE,CAACC,QAAQ,CAACtC,GAAG,CAAC,kBAAA,CAAA,EAAqB;QAC1FuC,iBAAAA,EAAmBC,aAAAA;QACnBC,iBAAAA,EAAmBC;AACrB,KAAA,CAAA;IACA,MAAMC,0BAAAA,GAA6BC,WAAW,YAAA,EAAc;AAAEjD,QAAAA;AAAO,KAAA,CAAA;AACrEgD,IAAAA,0BAAAA,CAA2BjB,QAAQ,CAACS,sBAAAA,CAAAA;AACtC,CAAA;;;;"}
1
+ {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import { defaultsDeep } from 'lodash';\n\nimport type { Core, UID } from '@strapi/types';\n\nimport { getService, getAdminService } from './utils';\nimport migrateReviewWorkflowStagesColor from './migrations/set-stages-default-color';\nimport migrateReviewWorkflowStagesRoles from './migrations/set-stages-roles';\nimport migrateReviewWorkflowStagesTransferToRoles from './migrations/setup-stage-transfer-to-roles';\nimport migrateReviewWorkflowName from './migrations/set-workflow-default-name';\nimport migrateWorkflowsContentTypes from './migrations/multiple-workflows';\nimport migrateDeletedCTInWorkflows from './migrations/handle-deleted-ct-in-workflows';\nimport reviewWorkflowsMiddlewares from './middlewares/review-workflows';\n\nimport { getVisibleContentTypesUID, hasStageAttribute } from './utils/review-workflows';\nimport { registerReviewWorkflowsEntitlements } from './entitlements';\n\nimport {\n ENTITY_STAGE_ATTRIBUTE,\n ENTITY_ASSIGNEE_ATTRIBUTE,\n STAGE_MODEL_UID,\n MAX_WORKFLOWS,\n MAX_STAGES_PER_WORKFLOW,\n} from './constants/workflows';\n\nconst setRelation = (attributeName: any, target: any, contentType: any) => {\n Object.assign(contentType.attributes, {\n [attributeName]: {\n writable: true,\n private: false,\n configurable: false,\n visible: false,\n useJoinTable: true, // We want a join table to persist data when downgrading to CE\n type: 'relation',\n relation: 'oneToOne',\n target,\n },\n });\n\n return contentType;\n};\n\n/**\n * Add the stage and assignee attributes to content types\n */\nfunction extendReviewWorkflowContentTypes({ strapi }: { strapi: Core.Strapi }) {\n const contentTypeToExtend = getVisibleContentTypesUID(strapi.contentTypes);\n\n for (const contentTypeUID of contentTypeToExtend) {\n strapi.get('content-types').extend(contentTypeUID, (contentType: any) => {\n // Set Stage attribute\n setRelation(ENTITY_STAGE_ATTRIBUTE, STAGE_MODEL_UID, contentType);\n // Set Assignee attribute\n setRelation(ENTITY_ASSIGNEE_ATTRIBUTE, 'admin::user', contentType);\n });\n }\n}\n\n/**\n * Persist the stage & assignee attributes so they are not removed when downgrading to CE.\n *\n * TODO: V6 - Instead of persisting the join tables, always create the stage & assignee attributes, even in CE mode\n * It was decided in V4 & V5 to not expose them in CE (as they pollute the CTs) but it's not worth given the complexity this needs\n */\nfunction persistRWOnDowngrade({ strapi }: { strapi: Core.Strapi }) {\n const { removePersistedTablesWithSuffix, persistTables } = getAdminService('persist-tables');\n\n return async ({ contentTypes }: { contentTypes: Record<UID.ContentType, any> }) => {\n const getStageTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the stage join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const getAssigneeTableToPersist = (contentTypeUID: UID.ContentType) => {\n // Persist the assignee join table\n const { attributes, tableName } = strapi.db.metadata.get(contentTypeUID) as any;\n const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;\n return {\n name: joinTableName,\n dependsOn: [{ name: tableName }],\n };\n };\n\n const enabledRWContentTypes = getVisibleContentTypesUID(contentTypes).filter((uid) =>\n hasStageAttribute(contentTypes[uid])\n );\n\n // Remove previously created join tables and persist the new ones\n const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_stage_lnk');\n await persistTables(stageJoinTablesToPersist);\n\n // Remove previously created join tables and persist the new ones\n const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);\n await removePersistedTablesWithSuffix('_strapi_assignee_lnk');\n await persistTables(assigneeJoinTablesToPersist);\n };\n}\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n // Data Migrations\n strapi.hook('strapi::content-types.afterSync').register(persistRWOnDowngrade({ strapi }));\n strapi\n .hook('strapi::content-types.afterSync')\n .register(migrateReviewWorkflowStagesColor)\n .register(migrateReviewWorkflowStagesRoles)\n .register(migrateReviewWorkflowStagesTransferToRoles)\n .register(migrateReviewWorkflowName)\n .register(migrateWorkflowsContentTypes)\n .register(migrateDeletedCTInWorkflows);\n\n // Middlewares\n reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi);\n\n // Schema customization\n extendReviewWorkflowContentTypes({ strapi });\n\n // License limits\n const reviewWorkflowsOptions = defaultsDeep({}, strapi.ee.features.get('review-workflows'), {\n numberOfWorkflows: MAX_WORKFLOWS,\n stagesPerWorkflow: MAX_STAGES_PER_WORKFLOW,\n });\n const workflowsValidationService = getService('validation', { strapi });\n workflowsValidationService.register(reviewWorkflowsOptions);\n\n registerReviewWorkflowsEntitlements(strapi);\n};\n"],"names":["setRelation","attributeName","target","contentType","Object","assign","attributes","writable","private","configurable","visible","useJoinTable","type","relation","extendReviewWorkflowContentTypes","strapi","contentTypeToExtend","getVisibleContentTypesUID","contentTypes","contentTypeUID","get","extend","ENTITY_STAGE_ATTRIBUTE","STAGE_MODEL_UID","ENTITY_ASSIGNEE_ATTRIBUTE","persistRWOnDowngrade","removePersistedTablesWithSuffix","persistTables","getAdminService","getStageTableToPersist","tableName","db","metadata","joinTableName","joinTable","name","dependsOn","getAssigneeTableToPersist","enabledRWContentTypes","filter","uid","hasStageAttribute","stageJoinTablesToPersist","map","assigneeJoinTablesToPersist","hook","register","migrateReviewWorkflowStagesColor","migrateReviewWorkflowStagesRoles","migrateReviewWorkflowStagesTransferToRoles","migrateReviewWorkflowName","migrateWorkflowsContentTypes","migrateDeletedCTInWorkflows","reviewWorkflowsMiddlewares","contentTypeMiddleware","reviewWorkflowsOptions","defaultsDeep","ee","features","numberOfWorkflows","MAX_WORKFLOWS","stagesPerWorkflow","MAX_STAGES_PER_WORKFLOW","workflowsValidationService","getService","registerReviewWorkflowsEntitlements"],"mappings":";;;;;;;;;;;;;AAwBA,MAAMA,WAAAA,GAAc,CAACC,aAAAA,EAAoBC,MAAAA,EAAaC,WAAAA,GAAAA;AACpDC,IAAAA,MAAAA,CAAOC,MAAM,CAACF,WAAAA,CAAYG,UAAU,EAAE;AACpC,QAAA,CAACL,gBAAgB;YACfM,QAAAA,EAAU,IAAA;YACVC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,KAAA;YACdC,OAAAA,EAAS,KAAA;YACTC,YAAAA,EAAc,IAAA;YACdC,IAAAA,EAAM,UAAA;YACNC,QAAAA,EAAU,UAAA;AACVX,YAAAA;AACF;AACF,KAAA,CAAA;IAEA,OAAOC,WAAAA;AACT,CAAA;AAEA;;AAEC,IACD,SAASW,gCAAAA,CAAiC,EAAEC,MAAM,EAA2B,EAAA;IAC3E,MAAMC,mBAAAA,GAAsBC,yBAAAA,CAA0BF,MAAAA,CAAOG,YAAY,CAAA;IAEzE,KAAK,MAAMC,kBAAkBH,mBAAAA,CAAqB;AAChDD,QAAAA,MAAAA,CAAOK,GAAG,CAAC,eAAA,CAAA,CAAiBC,MAAM,CAACF,gBAAgB,CAAChB,WAAAA,GAAAA;;AAElDH,YAAAA,WAAAA,CAAYsB,wBAAwBC,eAAAA,EAAiBpB,WAAAA,CAAAA;;AAErDH,Y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A;AAAO,KAAA,CAAA;AACrEgD,IAAAA,0BAAAA,CAA2BjB,QAAQ,CAACS,sBAAAA,CAAAA;IAEpCU,mCAAAA,CAAoClD,MAAAA,CAAAA;AACtC,CAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ import type { Core } from '@strapi/types';
2
+ /**
3
+ * Exposes the clamped workflow limits to the Plan card and the debug dump. Registered whatever
4
+ * the boot-time license says, so a lapsed or later-renewed license still resolves.
5
+ */
6
+ export declare const registerReviewWorkflowsEntitlements: (strapi: Core.Strapi) => void;
7
+ //# sourceMappingURL=entitlements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../../server/src/entitlements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAW1C;;;GAGG;AACH,eAAO,MAAM,mCAAmC,GAAI,QAAQ,IAAI,CAAC,MAAM,SAoBtE,CAAC"}
@@ -1,9 +1,10 @@
1
+ import type { Core } from '@strapi/types';
1
2
  declare const _default: {
2
3
  register: ({ strapi }: {
3
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
4
+ strapi: Core.Strapi;
4
5
  }) => Promise<void>;
5
6
  bootstrap: ({ strapi }: {
6
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
7
+ strapi: Core.Strapi;
7
8
  }) => Promise<void>;
8
9
  destroy: () => Promise<void>;
9
10
  contentTypes: {
@@ -102,12 +103,12 @@ declare const _default: {
102
103
  };
103
104
  services: {
104
105
  homepage: ({ strapi }: {
105
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
106
+ strapi: Core.Strapi;
106
107
  }) => {
107
108
  getRecentlyAssignedDocuments(): Promise<import("../../shared/contracts/homepage").GetRecentlyAssignedDocuments.Response["data"]>;
108
109
  };
109
110
  workflows: ({ strapi }: {
110
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
111
+ strapi: Core.Strapi;
111
112
  }) => {
112
113
  find(opts?: any): Promise<any[]>;
113
114
  findById(id: any, opts?: {
@@ -125,7 +126,7 @@ declare const _default: {
125
126
  assertStageBelongsToWorkflow(stageId: any, workflow: any): void;
126
127
  };
127
128
  stages: ({ strapi }: {
128
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
129
+ strapi: Core.Strapi;
129
130
  }) => {
130
131
  find({ workflowId, populate }: any): Promise<any[]>;
131
132
  findById(id: string | number, { populate }?: any): Promise<any>;
@@ -146,7 +147,7 @@ declare const _default: {
146
147
  deleteAllEntitiesStage(contentTypeUID: any): Promise<number>;
147
148
  };
148
149
  'stage-permissions': ({ strapi }: {
149
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
150
+ strapi: Core.Strapi;
150
151
  }) => {
151
152
  register({ roleId, action, fromStage, }: {
152
153
  roleId: number;
@@ -185,7 +186,7 @@ declare const _default: {
185
186
  }): boolean;
186
187
  };
187
188
  assignees: ({ strapi }: {
188
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
189
+ strapi: Core.Strapi;
189
190
  }) => {
190
191
  findEntityAssigneeId(id: string | number, model: import("@strapi/types/dist/uid/index.js").ContentType): Promise<any>;
191
192
  updateEntityAssignee(entityToUpdate: {
@@ -196,7 +197,7 @@ declare const _default: {
196
197
  }, model: import("@strapi/types/dist/uid/index.js").ContentType, assigneeId: string | null): Promise<import("@strapi/types/dist/modules/documents/index.js").AnyDocument | null>;
197
198
  };
198
199
  validation: ({ strapi }: {
199
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
200
+ strapi: Core.Strapi;
200
201
  }) => {
201
202
  limits: {
202
203
  numberOfWorkflows: number;
@@ -223,7 +224,7 @@ declare const _default: {
223
224
  sendDidEditAssignee: (fromId: any, toId: any) => Promise<void>;
224
225
  };
225
226
  'workflow-weekly-metrics': ({ strapi }: {
226
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
227
+ strapi: Core.Strapi;
227
228
  }) => {
228
229
  computeMetrics(): Promise<{
229
230
  numberOfActiveWorkflows: number;
@@ -254,9 +255,9 @@ declare const _default: {
254
255
  };
255
256
  };
256
257
  routes: {
257
- homepage: import("@strapi/types/dist/core/router.js").Router | ((params: {
258
- strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
259
- }) => import("@strapi/types/dist/core/router.js").Router);
258
+ homepage: Core.Router | ((params: {
259
+ strapi: Core.Strapi;
260
+ }) => Core.Router);
260
261
  'review-workflows': {
261
262
  type: string;
262
263
  routes: {
@@ -276,6 +277,9 @@ declare const _default: {
276
277
  };
277
278
  };
278
279
  } | {
280
+ register({ strapi }: {
281
+ strapi: Core.Strapi;
282
+ }): void;
279
283
  contentTypes: {
280
284
  workflow: {
281
285
  schema: {
@@ -370,7 +374,6 @@ declare const _default: {
370
374
  };
371
375
  };
372
376
  };
373
- register?: undefined;
374
377
  bootstrap?: undefined;
375
378
  destroy?: undefined;
376
379
  services?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6B0oE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA+pB,CAAC;oCAAoB,CAAC;0BAAM,CAAC;;wBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADx1F,wBAA2B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAoCuzD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAA+pB,CAAC;oCAAoB,CAAC;0BAAM,CAAC;;wBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAVthF;QAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAShD,wBAA2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;yBAoGzB,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBAyBE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAO,MAAM,eAAe,CAAC;yBAqGzB,YAAY;IAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAA;CAAE;AAAzD,wBA2BE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/review-workflows",
3
- "version": "5.57.0",
3
+ "version": "5.58.0",
4
4
  "description": "Review workflows for your content",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -64,7 +64,7 @@
64
64
  "@reduxjs/toolkit": "1.9.7",
65
65
  "@strapi/design-system": "2.2.4",
66
66
  "@strapi/icons": "2.2.4",
67
- "@strapi/utils": "5.57.0",
67
+ "@strapi/utils": "5.58.0",
68
68
  "date-fns": "2.30.0",
69
69
  "fractional-indexing": "3.2.0",
70
70
  "koa": "2.16.4",
@@ -78,9 +78,9 @@
78
78
  "yup": "0.32.9"
79
79
  },
80
80
  "devDependencies": {
81
- "@strapi/admin": "5.57.0",
82
- "@strapi/content-manager": "5.57.0",
83
- "@strapi/types": "5.57.0",
81
+ "@strapi/admin": "5.58.0",
82
+ "@strapi/content-manager": "5.58.0",
83
+ "@strapi/types": "5.58.0",
84
84
  "@testing-library/dom": "10.4.1",
85
85
  "@testing-library/jest-dom": "6.9.1",
86
86
  "@testing-library/react": "16.3.2",