@strapi/review-workflows 5.0.0-rc.2 → 5.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Layout-Da8jupiA.mjs → Layout-BL8djfsC.mjs} +7 -8
- package/dist/_chunks/Layout-BL8djfsC.mjs.map +1 -0
- package/dist/_chunks/{Layout-D3DDQmMI.js → Layout-C03LlqOq.js} +7 -8
- package/dist/_chunks/Layout-C03LlqOq.js.map +1 -0
- package/dist/_chunks/{_id-CnRDP3Xx.js → _id-DJbIpA0G.js} +10 -36
- package/dist/_chunks/_id-DJbIpA0G.js.map +1 -0
- package/dist/_chunks/{_id-xSrgPSJs.mjs → _id-Dqkyfusr.mjs} +10 -36
- package/dist/_chunks/_id-Dqkyfusr.mjs.map +1 -0
- package/dist/_chunks/{index-jfO5GxtW.mjs → index-BPEorVRx.mjs} +11 -31
- package/dist/_chunks/index-BPEorVRx.mjs.map +1 -0
- package/dist/_chunks/{index-DDsJlZQw.mjs → index-BZLIQ0fO.mjs} +56 -48
- package/dist/_chunks/index-BZLIQ0fO.mjs.map +1 -0
- package/dist/_chunks/{index-DhPxWpsW.js → index-C8M5OkXj.js} +55 -47
- package/dist/_chunks/index-C8M5OkXj.js.map +1 -0
- package/dist/_chunks/{index-4kp4AkBB.js → index-D3id9TXV.js} +9 -29
- package/dist/_chunks/index-D3id9TXV.js.map +1 -0
- package/dist/_chunks/{router-DOEULOpS.mjs → router-Bh38qGTT.mjs} +3 -3
- package/dist/_chunks/{router-DOEULOpS.mjs.map → router-Bh38qGTT.mjs.map} +1 -1
- package/dist/_chunks/{router-DSXpeew4.js → router-glyRmw5L.js} +3 -3
- package/dist/_chunks/{router-DSXpeew4.js.map → router-glyRmw5L.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/services/admin.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/content-manager.d.ts +4 -4
- package/dist/admin/src/services/settings.d.ts +1733 -7
- package/dist/server/index.js +14 -54
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +14 -54
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +0 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/controllers/workflows.d.ts +0 -7
- package/dist/server/src/controllers/workflows.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +1 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/review-workflows.d.ts.map +1 -1
- package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/stages.d.ts +2 -7
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +1 -14
- package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/Layout-D3DDQmMI.js.map +0 -1
- package/dist/_chunks/Layout-Da8jupiA.mjs.map +0 -1
- package/dist/_chunks/_id-CnRDP3Xx.js.map +0 -1
- package/dist/_chunks/_id-xSrgPSJs.mjs.map +0 -1
- package/dist/_chunks/index-4kp4AkBB.js.map +0 -1
- package/dist/_chunks/index-DDsJlZQw.mjs.map +0 -1
- package/dist/_chunks/index-DhPxWpsW.js.map +0 -1
- package/dist/_chunks/index-jfO5GxtW.mjs.map +0 -1
- package/strapi-server.js +0 -3
package/dist/server/index.js
CHANGED
|
@@ -6838,23 +6838,6 @@ const reviewWorkflows = {
|
|
|
6838
6838
|
]
|
|
6839
6839
|
}
|
|
6840
6840
|
},
|
|
6841
|
-
{
|
|
6842
|
-
method: "GET",
|
|
6843
|
-
path: "/workflows/:id",
|
|
6844
|
-
handler: "workflows.findById",
|
|
6845
|
-
config: {
|
|
6846
|
-
middlewares: [enableFeatureMiddleware("review-workflows")],
|
|
6847
|
-
policies: [
|
|
6848
|
-
"admin::isAuthenticatedAdmin",
|
|
6849
|
-
{
|
|
6850
|
-
name: "admin::hasPermissions",
|
|
6851
|
-
config: {
|
|
6852
|
-
actions: ["admin::review-workflows.read"]
|
|
6853
|
-
}
|
|
6854
|
-
}
|
|
6855
|
-
]
|
|
6856
|
-
}
|
|
6857
|
-
},
|
|
6858
6841
|
{
|
|
6859
6842
|
method: "GET",
|
|
6860
6843
|
path: "/workflows/:workflow_id/stages",
|
|
@@ -7339,23 +7322,17 @@ const stages$1 = ({ strapi: strapi2 }) => {
|
|
|
7339
7322
|
},
|
|
7340
7323
|
/**
|
|
7341
7324
|
* Update the stage of an entity
|
|
7342
|
-
*
|
|
7343
|
-
* @param {object} entityInfo
|
|
7344
|
-
* @param {number} entityInfo.id - Entity id
|
|
7345
|
-
* @param {string} entityInfo.modelUID - the content-type of the entity
|
|
7346
|
-
* @param {number} stageId - The id of the stage to assign to the entity
|
|
7347
7325
|
*/
|
|
7348
|
-
async updateEntity(
|
|
7326
|
+
async updateEntity(documentId, locale, model, stageId) {
|
|
7349
7327
|
const stage = await this.findById(stageId);
|
|
7350
7328
|
await workflowValidator.validateWorkflowCount();
|
|
7351
7329
|
if (!stage) {
|
|
7352
7330
|
throw new ApplicationError$2(`Selected stage does not exist`);
|
|
7353
7331
|
}
|
|
7354
|
-
const entity = await strapi2.
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
},
|
|
7358
|
-
data: { [ENTITY_STAGE_ATTRIBUTE]: stageId },
|
|
7332
|
+
const entity = await strapi2.documents(model).update({
|
|
7333
|
+
documentId,
|
|
7334
|
+
locale,
|
|
7335
|
+
data: { [ENTITY_STAGE_ATTRIBUTE]: stage },
|
|
7359
7336
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
7360
7337
|
});
|
|
7361
7338
|
metrics.sendDidChangeEntryStage();
|
|
@@ -7828,6 +7805,7 @@ const handleStageOnUpdate = async (ctx, next) => {
|
|
|
7828
7805
|
strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
|
|
7829
7806
|
model: model.modelName,
|
|
7830
7807
|
uid: model.uid,
|
|
7808
|
+
// TODO v6: Rename to "entry", which is what is used for regular CRUD updates
|
|
7831
7809
|
entity: {
|
|
7832
7810
|
// @ts-expect-error
|
|
7833
7811
|
id: result?.id,
|
|
@@ -8029,30 +8007,6 @@ const workflows = {
|
|
|
8029
8007
|
workflowCount
|
|
8030
8008
|
}
|
|
8031
8009
|
};
|
|
8032
|
-
},
|
|
8033
|
-
/**
|
|
8034
|
-
* Get one workflow based on its id contained in request parameters
|
|
8035
|
-
* Returns count of workflows in meta, used to prevent workflow edition when
|
|
8036
|
-
* max workflow count is reached for the current plan
|
|
8037
|
-
* @param {import('koa').BaseContext} ctx - koa context
|
|
8038
|
-
*/
|
|
8039
|
-
async findById(ctx) {
|
|
8040
|
-
const { id } = ctx.params;
|
|
8041
|
-
const { query } = ctx.request;
|
|
8042
|
-
const { sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
|
|
8043
|
-
{ strapi },
|
|
8044
|
-
ctx.state.userAbility
|
|
8045
|
-
);
|
|
8046
|
-
const { populate } = await sanitizedQuery.read(query);
|
|
8047
|
-
const workflowService = getService("workflows");
|
|
8048
|
-
const [workflow2, workflowCount] = await Promise.all([
|
|
8049
|
-
workflowService.findById(id, { populate }).then(formatWorkflowToAdmin),
|
|
8050
|
-
workflowService.count()
|
|
8051
|
-
]);
|
|
8052
|
-
ctx.body = {
|
|
8053
|
-
data: await sanitizeOutput(workflow2),
|
|
8054
|
-
meta: { workflowCount }
|
|
8055
|
-
};
|
|
8056
8010
|
}
|
|
8057
8011
|
};
|
|
8058
8012
|
function sanitizeStage({ strapi: strapi2 }, userAbility) {
|
|
@@ -8137,7 +8091,12 @@ const stages = {
|
|
|
8137
8091
|
);
|
|
8138
8092
|
const workflow2 = await workflowService.assertContentTypeBelongsToWorkflow(modelUID);
|
|
8139
8093
|
workflowService.assertStageBelongsToWorkflow(stageId, workflow2);
|
|
8140
|
-
const updatedEntity = await stagesService.updateEntity(
|
|
8094
|
+
const updatedEntity = await stagesService.updateEntity(
|
|
8095
|
+
entity.documentId,
|
|
8096
|
+
entity.locale,
|
|
8097
|
+
modelUID,
|
|
8098
|
+
stageId
|
|
8099
|
+
);
|
|
8141
8100
|
ctx.body = { data: await sanitizeOutput(updatedEntity) };
|
|
8142
8101
|
},
|
|
8143
8102
|
/**
|
|
@@ -8169,12 +8128,13 @@ const stages = {
|
|
|
8169
8128
|
}
|
|
8170
8129
|
const entityStageId = entity[ENTITY_STAGE_ATTRIBUTE]?.id;
|
|
8171
8130
|
const canTransition = stagePermissions2.can(STAGE_TRANSITION_UID, entityStageId);
|
|
8172
|
-
const [workflowCount,
|
|
8131
|
+
const [workflowCount, workflowResult] = await Promise.all([
|
|
8173
8132
|
workflowService.count(),
|
|
8174
8133
|
workflowService.getAssignedWorkflow(modelUID, {
|
|
8175
8134
|
populate: "stages"
|
|
8176
8135
|
})
|
|
8177
8136
|
]);
|
|
8137
|
+
const workflowStages = workflowResult ? workflowResult.stages : [];
|
|
8178
8138
|
const meta = {
|
|
8179
8139
|
stageCount: workflowStages.length,
|
|
8180
8140
|
workflowCount
|