@strapi/review-workflows 5.0.0-rc.2 → 5.0.0-rc.20
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-D3DDQmMI.js → Layout-AREWDuuq.js} +7 -8
- package/dist/_chunks/Layout-AREWDuuq.js.map +1 -0
- package/dist/_chunks/{Layout-Da8jupiA.mjs → Layout-D5aa9iUm.mjs} +7 -8
- package/dist/_chunks/Layout-D5aa9iUm.mjs.map +1 -0
- package/dist/_chunks/{_id-CnRDP3Xx.js → _id-C7pCAzXV.js} +10 -36
- package/dist/_chunks/_id-C7pCAzXV.js.map +1 -0
- package/dist/_chunks/{_id-xSrgPSJs.mjs → _id-DDNHKV_W.mjs} +10 -36
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +1 -0
- package/dist/_chunks/{index-4kp4AkBB.js → index-Bv3cQ3c-.js} +4 -4
- package/dist/_chunks/index-Bv3cQ3c-.js.map +1 -0
- package/dist/_chunks/{index-DhPxWpsW.js → index-CIBLMG85.js} +55 -47
- package/dist/_chunks/index-CIBLMG85.js.map +1 -0
- package/dist/_chunks/{index-jfO5GxtW.mjs → index-CeaoNBIP.mjs} +4 -4
- package/dist/_chunks/index-CeaoNBIP.mjs.map +1 -0
- package/dist/_chunks/{index-DDsJlZQw.mjs → index-Cx5QECZI.mjs} +56 -48
- package/dist/_chunks/index-Cx5QECZI.mjs.map +1 -0
- package/dist/_chunks/{router-DOEULOpS.mjs → router-BEoNwQZ1.mjs} +3 -3
- package/dist/_chunks/{router-DOEULOpS.mjs.map → router-BEoNwQZ1.mjs.map} +1 -1
- package/dist/_chunks/{router-DSXpeew4.js → router-gRPIa2_c.js} +3 -3
- package/dist/_chunks/{router-DSXpeew4.js.map → router-gRPIa2_c.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.mjs
CHANGED
|
@@ -6837,23 +6837,6 @@ const reviewWorkflows = {
|
|
|
6837
6837
|
]
|
|
6838
6838
|
}
|
|
6839
6839
|
},
|
|
6840
|
-
{
|
|
6841
|
-
method: "GET",
|
|
6842
|
-
path: "/workflows/:id",
|
|
6843
|
-
handler: "workflows.findById",
|
|
6844
|
-
config: {
|
|
6845
|
-
middlewares: [enableFeatureMiddleware("review-workflows")],
|
|
6846
|
-
policies: [
|
|
6847
|
-
"admin::isAuthenticatedAdmin",
|
|
6848
|
-
{
|
|
6849
|
-
name: "admin::hasPermissions",
|
|
6850
|
-
config: {
|
|
6851
|
-
actions: ["admin::review-workflows.read"]
|
|
6852
|
-
}
|
|
6853
|
-
}
|
|
6854
|
-
]
|
|
6855
|
-
}
|
|
6856
|
-
},
|
|
6857
6840
|
{
|
|
6858
6841
|
method: "GET",
|
|
6859
6842
|
path: "/workflows/:workflow_id/stages",
|
|
@@ -7338,23 +7321,17 @@ const stages$1 = ({ strapi: strapi2 }) => {
|
|
|
7338
7321
|
},
|
|
7339
7322
|
/**
|
|
7340
7323
|
* Update the stage of an entity
|
|
7341
|
-
*
|
|
7342
|
-
* @param {object} entityInfo
|
|
7343
|
-
* @param {number} entityInfo.id - Entity id
|
|
7344
|
-
* @param {string} entityInfo.modelUID - the content-type of the entity
|
|
7345
|
-
* @param {number} stageId - The id of the stage to assign to the entity
|
|
7346
7324
|
*/
|
|
7347
|
-
async updateEntity(
|
|
7325
|
+
async updateEntity(documentId, locale, model, stageId) {
|
|
7348
7326
|
const stage = await this.findById(stageId);
|
|
7349
7327
|
await workflowValidator.validateWorkflowCount();
|
|
7350
7328
|
if (!stage) {
|
|
7351
7329
|
throw new ApplicationError$2(`Selected stage does not exist`);
|
|
7352
7330
|
}
|
|
7353
|
-
const entity = await strapi2.
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
},
|
|
7357
|
-
data: { [ENTITY_STAGE_ATTRIBUTE]: stageId },
|
|
7331
|
+
const entity = await strapi2.documents(model).update({
|
|
7332
|
+
documentId,
|
|
7333
|
+
locale,
|
|
7334
|
+
data: { [ENTITY_STAGE_ATTRIBUTE]: stage },
|
|
7358
7335
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
7359
7336
|
});
|
|
7360
7337
|
metrics.sendDidChangeEntryStage();
|
|
@@ -7827,6 +7804,7 @@ const handleStageOnUpdate = async (ctx, next) => {
|
|
|
7827
7804
|
strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
|
|
7828
7805
|
model: model.modelName,
|
|
7829
7806
|
uid: model.uid,
|
|
7807
|
+
// TODO v6: Rename to "entry", which is what is used for regular CRUD updates
|
|
7830
7808
|
entity: {
|
|
7831
7809
|
// @ts-expect-error
|
|
7832
7810
|
id: result?.id,
|
|
@@ -8028,30 +8006,6 @@ const workflows = {
|
|
|
8028
8006
|
workflowCount
|
|
8029
8007
|
}
|
|
8030
8008
|
};
|
|
8031
|
-
},
|
|
8032
|
-
/**
|
|
8033
|
-
* Get one workflow based on its id contained in request parameters
|
|
8034
|
-
* Returns count of workflows in meta, used to prevent workflow edition when
|
|
8035
|
-
* max workflow count is reached for the current plan
|
|
8036
|
-
* @param {import('koa').BaseContext} ctx - koa context
|
|
8037
|
-
*/
|
|
8038
|
-
async findById(ctx) {
|
|
8039
|
-
const { id } = ctx.params;
|
|
8040
|
-
const { query } = ctx.request;
|
|
8041
|
-
const { sanitizeOutput, sanitizedQuery } = getWorkflowsPermissionChecker(
|
|
8042
|
-
{ strapi },
|
|
8043
|
-
ctx.state.userAbility
|
|
8044
|
-
);
|
|
8045
|
-
const { populate } = await sanitizedQuery.read(query);
|
|
8046
|
-
const workflowService = getService("workflows");
|
|
8047
|
-
const [workflow2, workflowCount] = await Promise.all([
|
|
8048
|
-
workflowService.findById(id, { populate }).then(formatWorkflowToAdmin),
|
|
8049
|
-
workflowService.count()
|
|
8050
|
-
]);
|
|
8051
|
-
ctx.body = {
|
|
8052
|
-
data: await sanitizeOutput(workflow2),
|
|
8053
|
-
meta: { workflowCount }
|
|
8054
|
-
};
|
|
8055
8009
|
}
|
|
8056
8010
|
};
|
|
8057
8011
|
function sanitizeStage({ strapi: strapi2 }, userAbility) {
|
|
@@ -8136,7 +8090,12 @@ const stages = {
|
|
|
8136
8090
|
);
|
|
8137
8091
|
const workflow2 = await workflowService.assertContentTypeBelongsToWorkflow(modelUID);
|
|
8138
8092
|
workflowService.assertStageBelongsToWorkflow(stageId, workflow2);
|
|
8139
|
-
const updatedEntity = await stagesService.updateEntity(
|
|
8093
|
+
const updatedEntity = await stagesService.updateEntity(
|
|
8094
|
+
entity.documentId,
|
|
8095
|
+
entity.locale,
|
|
8096
|
+
modelUID,
|
|
8097
|
+
stageId
|
|
8098
|
+
);
|
|
8140
8099
|
ctx.body = { data: await sanitizeOutput(updatedEntity) };
|
|
8141
8100
|
},
|
|
8142
8101
|
/**
|
|
@@ -8168,12 +8127,13 @@ const stages = {
|
|
|
8168
8127
|
}
|
|
8169
8128
|
const entityStageId = entity[ENTITY_STAGE_ATTRIBUTE]?.id;
|
|
8170
8129
|
const canTransition = stagePermissions2.can(STAGE_TRANSITION_UID, entityStageId);
|
|
8171
|
-
const [workflowCount,
|
|
8130
|
+
const [workflowCount, workflowResult] = await Promise.all([
|
|
8172
8131
|
workflowService.count(),
|
|
8173
8132
|
workflowService.getAssignedWorkflow(modelUID, {
|
|
8174
8133
|
populate: "stages"
|
|
8175
8134
|
})
|
|
8176
8135
|
]);
|
|
8136
|
+
const workflowStages = workflowResult ? workflowResult.stages : [];
|
|
8177
8137
|
const meta = {
|
|
8178
8138
|
stageCount: workflowStages.length,
|
|
8179
8139
|
workflowCount
|