@strapi/review-workflows 0.0.0-next.3db8f1fc613b89bf7742dc5746bf21a8d8ba0d04 → 0.0.0-next.3fdd03038d558a8190aa7e17574020c5f65395e6
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/server/index.mjs
CHANGED
|
@@ -6561,8 +6561,40 @@ function extendReviewWorkflowContentTypes({ strapi: strapi2 }) {
|
|
|
6561
6561
|
});
|
|
6562
6562
|
}
|
|
6563
6563
|
}
|
|
6564
|
+
function persistRWOnDowngrade({ strapi: strapi2 }) {
|
|
6565
|
+
const { removePersistedTablesWithSuffix, persistTables } = getAdminService("persist-tables");
|
|
6566
|
+
return async ({ contentTypes: contentTypes2 }) => {
|
|
6567
|
+
const getStageTableToPersist = (contentTypeUID) => {
|
|
6568
|
+
const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
|
|
6569
|
+
const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;
|
|
6570
|
+
return {
|
|
6571
|
+
name: joinTableName,
|
|
6572
|
+
dependsOn: [{ name: tableName }]
|
|
6573
|
+
};
|
|
6574
|
+
};
|
|
6575
|
+
const getAssigneeTableToPersist = (contentTypeUID) => {
|
|
6576
|
+
const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
|
|
6577
|
+
const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;
|
|
6578
|
+
return {
|
|
6579
|
+
name: joinTableName,
|
|
6580
|
+
dependsOn: [{ name: tableName }]
|
|
6581
|
+
};
|
|
6582
|
+
};
|
|
6583
|
+
const enabledRWContentTypes = fp.pipe([
|
|
6584
|
+
getVisibleContentTypesUID,
|
|
6585
|
+
fp.filter((uid) => hasStageAttribute(contentTypes2[uid]))
|
|
6586
|
+
])(contentTypes2);
|
|
6587
|
+
const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);
|
|
6588
|
+
await removePersistedTablesWithSuffix("_strapi_stage_lnk");
|
|
6589
|
+
await persistTables(stageJoinTablesToPersist);
|
|
6590
|
+
const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);
|
|
6591
|
+
await removePersistedTablesWithSuffix("_strapi_assignee_lnk");
|
|
6592
|
+
await persistTables(assigneeJoinTablesToPersist);
|
|
6593
|
+
};
|
|
6594
|
+
}
|
|
6564
6595
|
const register = async ({ strapi: strapi2 }) => {
|
|
6565
6596
|
strapi2.hook("strapi::content-types.beforeSync").register(migrateStageAttribute);
|
|
6597
|
+
strapi2.hook("strapi::content-types.afterSync").register(persistRWOnDowngrade({ strapi: strapi2 }));
|
|
6566
6598
|
strapi2.hook("strapi::content-types.afterSync").register(migrateReviewWorkflowStagesColor).register(migrateReviewWorkflowStagesRoles).register(migrateReviewWorkflowName).register(migrateWorkflowsContentTypes).register(migrateDeletedCTInWorkflows);
|
|
6567
6599
|
reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi2);
|
|
6568
6600
|
extendReviewWorkflowContentTypes({ strapi: strapi2 });
|