@strapi/review-workflows 0.0.0-experimental.e9122b401c96877b6707775c4f893660eab93ae3 → 0.0.0-experimental.f0d3b2d782e972f1dcb8acf0dce31d4090d1e420
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-AREWDuuq.js → Layout-8i0EXRRs.js} +2 -2
- package/dist/_chunks/{Layout-AREWDuuq.js.map → Layout-8i0EXRRs.js.map} +1 -1
- package/dist/_chunks/{Layout-D5aa9iUm.mjs → Layout-C9m07iTY.mjs} +2 -2
- package/dist/_chunks/{Layout-D5aa9iUm.mjs.map → Layout-C9m07iTY.mjs.map} +1 -1
- package/dist/_chunks/{_id-C7pCAzXV.js → id-CmtaTf1x.js} +6 -7
- package/dist/_chunks/id-CmtaTf1x.js.map +1 -0
- package/dist/_chunks/{_id-DDNHKV_W.mjs → id-DV0Ndeav.mjs} +6 -7
- package/dist/_chunks/id-DV0Ndeav.mjs.map +1 -0
- package/dist/_chunks/{index-Bv3cQ3c-.js → index-B8WmHbCU.js} +8 -28
- package/dist/_chunks/index-B8WmHbCU.js.map +1 -0
- package/dist/_chunks/{index-CIBLMG85.js → index-BCUO98DV.js} +25 -22
- package/dist/_chunks/index-BCUO98DV.js.map +1 -0
- package/dist/_chunks/{index-CeaoNBIP.mjs → index-CA5Axcoc.mjs} +10 -30
- package/dist/_chunks/index-CA5Axcoc.mjs.map +1 -0
- package/dist/_chunks/{index-Cx5QECZI.mjs → index-CqYVkW3E.mjs} +25 -22
- package/dist/_chunks/index-CqYVkW3E.mjs.map +1 -0
- package/dist/_chunks/{router-gRPIa2_c.js → router-BOXlNnrU.js} +3 -3
- package/dist/_chunks/router-BOXlNnrU.js.map +1 -0
- package/dist/_chunks/{router-BEoNwQZ1.mjs → router-Jdt6SbIA.mjs} +3 -3
- package/dist/_chunks/router-Jdt6SbIA.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +38 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +38 -16
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/assignees.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/dist/server/src/services/metrics/weekly-metrics.d.ts.map +1 -1
- package/dist/server/src/services/stages.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/_chunks/_id-C7pCAzXV.js.map +0 -1
- package/dist/_chunks/_id-DDNHKV_W.mjs.map +0 -1
- package/dist/_chunks/index-Bv3cQ3c-.js.map +0 -1
- package/dist/_chunks/index-CIBLMG85.js.map +0 -1
- package/dist/_chunks/index-CeaoNBIP.mjs.map +0 -1
- package/dist/_chunks/index-Cx5QECZI.mjs.map +0 -1
- package/dist/_chunks/router-BEoNwQZ1.mjs.map +0 -1
- package/dist/_chunks/router-gRPIa2_c.js.map +0 -1
- package/strapi-server.js +0 -3
- /package/dist/admin/src/routes/settings/{:id.d.ts → id.d.ts} +0 -0
package/dist/server/index.js
CHANGED
|
@@ -6901,7 +6901,7 @@ const reviewWorkflows = {
|
|
|
6901
6901
|
{
|
|
6902
6902
|
name: "admin::hasPermissions",
|
|
6903
6903
|
config: {
|
|
6904
|
-
actions: ["admin::users.read"
|
|
6904
|
+
actions: ["admin::users.read"]
|
|
6905
6905
|
}
|
|
6906
6906
|
}
|
|
6907
6907
|
]
|
|
@@ -7332,7 +7332,9 @@ const stages$1 = ({ strapi: strapi2 }) => {
|
|
|
7332
7332
|
const entity = await strapi2.documents(model).update({
|
|
7333
7333
|
documentId,
|
|
7334
7334
|
locale,
|
|
7335
|
-
|
|
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) },
|
|
7336
7338
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
7337
7339
|
});
|
|
7338
7340
|
metrics.sendDidChangeEntryStage();
|
|
@@ -7608,13 +7610,13 @@ const reviewWorkflowsMetrics = {
|
|
|
7608
7610
|
sendDidSendReviewWorkflowPropertiesOnceAWeek,
|
|
7609
7611
|
sendDidEditAssignee
|
|
7610
7612
|
};
|
|
7611
|
-
function _typeof(
|
|
7613
|
+
function _typeof(o) {
|
|
7612
7614
|
"@babel/helpers - typeof";
|
|
7613
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(
|
|
7614
|
-
return typeof
|
|
7615
|
-
} : function(
|
|
7616
|
-
return
|
|
7617
|
-
}, _typeof(
|
|
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);
|
|
7618
7620
|
}
|
|
7619
7621
|
function toInteger(dirtyNumber) {
|
|
7620
7622
|
if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
|
|
@@ -7749,7 +7751,12 @@ const reviewWorkflowsWeeklyMetrics = ({ strapi: strapi2 }) => {
|
|
|
7749
7751
|
},
|
|
7750
7752
|
async registerCron() {
|
|
7751
7753
|
const weeklySchedule = await this.ensureWeeklyStoredCronSchedule();
|
|
7752
|
-
strapi2.cron.add({
|
|
7754
|
+
strapi2.cron.add({
|
|
7755
|
+
reviewWorkflowsWeekly: {
|
|
7756
|
+
task: this.sendMetrics.bind(this),
|
|
7757
|
+
options: weeklySchedule
|
|
7758
|
+
}
|
|
7759
|
+
});
|
|
7753
7760
|
}
|
|
7754
7761
|
};
|
|
7755
7762
|
};
|
|
@@ -8116,10 +8123,9 @@ const stages = {
|
|
|
8116
8123
|
if (strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model: modelUID }).cannot.read()) {
|
|
8117
8124
|
return ctx.forbidden();
|
|
8118
8125
|
}
|
|
8119
|
-
const locale = await validateLocale(query?.locale);
|
|
8126
|
+
const locale = await validateLocale(query?.locale) ?? void 0;
|
|
8120
8127
|
const entity = await strapi.documents(modelUID).findOne({
|
|
8121
8128
|
documentId,
|
|
8122
|
-
// @ts-expect-error - locale should be also null in the doc service types
|
|
8123
8129
|
locale,
|
|
8124
8130
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
8125
8131
|
});
|
|
@@ -8128,12 +8134,13 @@ const stages = {
|
|
|
8128
8134
|
}
|
|
8129
8135
|
const entityStageId = entity[ENTITY_STAGE_ATTRIBUTE]?.id;
|
|
8130
8136
|
const canTransition = stagePermissions2.can(STAGE_TRANSITION_UID, entityStageId);
|
|
8131
|
-
const [workflowCount,
|
|
8137
|
+
const [workflowCount, workflowResult] = await Promise.all([
|
|
8132
8138
|
workflowService.count(),
|
|
8133
8139
|
workflowService.getAssignedWorkflow(modelUID, {
|
|
8134
8140
|
populate: "stages"
|
|
8135
8141
|
})
|
|
8136
8142
|
]);
|
|
8143
|
+
const workflowStages = workflowResult ? workflowResult.stages : [];
|
|
8137
8144
|
const meta = {
|
|
8138
8145
|
stageCount: workflowStages.length,
|
|
8139
8146
|
workflowCount
|
|
@@ -8169,22 +8176,37 @@ const assignees = {
|
|
|
8169
8176
|
async updateEntity(ctx) {
|
|
8170
8177
|
const assigneeService = getService("assignees");
|
|
8171
8178
|
const workflowService = getService("workflows");
|
|
8179
|
+
const stagePermissions2 = getService("stage-permissions");
|
|
8172
8180
|
const { model_uid: model, id: documentId } = ctx.params;
|
|
8173
|
-
const
|
|
8181
|
+
const locale = await validateLocale(ctx.request.query?.locale) ?? void 0;
|
|
8174
8182
|
const { sanitizeOutput } = strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model });
|
|
8183
|
+
const entity = await strapi.documents(model).findOne({
|
|
8184
|
+
documentId,
|
|
8185
|
+
locale,
|
|
8186
|
+
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
8187
|
+
});
|
|
8188
|
+
if (!entity) {
|
|
8189
|
+
ctx.throw(404, "Entity not found");
|
|
8190
|
+
}
|
|
8191
|
+
const canTransitionStage = stagePermissions2.can(
|
|
8192
|
+
STAGE_TRANSITION_UID,
|
|
8193
|
+
entity[ENTITY_STAGE_ATTRIBUTE]?.id
|
|
8194
|
+
);
|
|
8195
|
+
if (!canTransitionStage) {
|
|
8196
|
+
ctx.throw(403, "Stage transition permission is required");
|
|
8197
|
+
}
|
|
8175
8198
|
const { id: assigneeId } = await validateUpdateAssigneeOnEntity(
|
|
8176
8199
|
ctx.request?.body?.data,
|
|
8177
8200
|
"You should pass a valid id to the body of the put request."
|
|
8178
8201
|
);
|
|
8179
|
-
await validateLocale(locale);
|
|
8180
8202
|
await workflowService.assertContentTypeBelongsToWorkflow(model);
|
|
8181
|
-
const
|
|
8203
|
+
const updatedEntity = await assigneeService.updateEntityAssignee(
|
|
8182
8204
|
documentId,
|
|
8183
8205
|
locale || null,
|
|
8184
8206
|
model,
|
|
8185
8207
|
assigneeId
|
|
8186
8208
|
);
|
|
8187
|
-
ctx.body = { data: await sanitizeOutput(
|
|
8209
|
+
ctx.body = { data: await sanitizeOutput(updatedEntity) };
|
|
8188
8210
|
}
|
|
8189
8211
|
};
|
|
8190
8212
|
const controllers = {
|