@strapi/content-releases 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.dd1d47ef78ef6cfec4ed62576108500bd9f13740
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/{App-DpoC8s97.js → App-BKB1esYS.js} +32 -14
- package/dist/_chunks/App-BKB1esYS.js.map +1 -0
- package/dist/_chunks/{App-B4mkcLmw.mjs → App-Cne--1Z8.mjs} +32 -14
- package/dist/_chunks/App-Cne--1Z8.mjs.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-DfL6yxLG.mjs → ReleasesSettingsPage-C1WwGWIH.mjs} +3 -3
- package/dist/_chunks/{ReleasesSettingsPage-DfL6yxLG.mjs.map → ReleasesSettingsPage-C1WwGWIH.mjs.map} +1 -1
- package/dist/_chunks/{ReleasesSettingsPage-B89WWWJf.js → ReleasesSettingsPage-kuXIwpWp.js} +3 -3
- package/dist/_chunks/{ReleasesSettingsPage-B89WWWJf.js.map → ReleasesSettingsPage-kuXIwpWp.js.map} +1 -1
- package/dist/_chunks/{index-sGcuP2hw.js → index-5Odi61vw.js} +38 -18
- package/dist/_chunks/index-5Odi61vw.js.map +1 -0
- package/dist/_chunks/{index-B3cqcIza.mjs → index-Cy7qwpaU.mjs} +38 -18
- package/dist/_chunks/index-Cy7qwpaU.mjs.map +1 -0
- package/dist/_chunks/{schemas-z5zp-_Gd.js → schemas-BE1LxE9J.js} +2 -2
- package/dist/_chunks/schemas-BE1LxE9J.js.map +1 -0
- package/dist/_chunks/{schemas-63pFihNF.mjs → schemas-DdA2ic2U.mjs} +2 -2
- package/dist/_chunks/schemas-DdA2ic2U.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/services/release.d.ts +28 -28
- package/dist/server/index.js +39 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +39 -6
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +2 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/migrations/database/5.0.0-document-id-in-actions.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +2 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/release-action.d.ts +3 -1
- package/dist/server/src/services/release-action.d.ts.map +1 -1
- package/package.json +16 -15
- package/dist/_chunks/App-B4mkcLmw.mjs.map +0 -1
- package/dist/_chunks/App-DpoC8s97.js.map +0 -1
- package/dist/_chunks/index-B3cqcIza.mjs.map +0 -1
- package/dist/_chunks/index-sGcuP2hw.js.map +0 -1
- package/dist/_chunks/schemas-63pFihNF.mjs.map +0 -1
- package/dist/_chunks/schemas-z5zp-_Gd.js.map +0 -1
- package/strapi-server.js +0 -3
package/dist/server/index.mjs
CHANGED
|
@@ -306,6 +306,10 @@ async function enableContentTypeLocalized({ oldContentTypes, contentTypes: conte
|
|
|
306
306
|
const addEntryDocumentToReleaseActions = {
|
|
307
307
|
name: "content-releases::5.0.0-add-entry-document-id-to-release-actions",
|
|
308
308
|
async up(trx, db) {
|
|
309
|
+
const hasTable = await trx.schema.hasTable("strapi_release_actions");
|
|
310
|
+
if (!hasTable) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
309
313
|
const hasPolymorphicColumn = await trx.schema.hasColumn("strapi_release_actions", "target_id");
|
|
310
314
|
if (hasPolymorphicColumn) {
|
|
311
315
|
const hasEntryDocumentIdColumn = await trx.schema.hasColumn(
|
|
@@ -906,7 +910,7 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
906
910
|
return contentTypesData;
|
|
907
911
|
};
|
|
908
912
|
return {
|
|
909
|
-
async create(releaseId, action) {
|
|
913
|
+
async create(releaseId, action, { disableUpdateReleaseStatus = false } = {}) {
|
|
910
914
|
const { validateEntryData, validateUniqueEntry } = getService("release-validation", {
|
|
911
915
|
strapi: strapi2
|
|
912
916
|
});
|
|
@@ -914,6 +918,14 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
914
918
|
validateEntryData(action.contentType, action.entryDocumentId),
|
|
915
919
|
validateUniqueEntry(releaseId, action)
|
|
916
920
|
]);
|
|
921
|
+
const model = strapi2.contentType(action.contentType);
|
|
922
|
+
if (model.kind === "singleType") {
|
|
923
|
+
const document = await strapi2.db.query(model.uid).findOne({ select: ["documentId"] });
|
|
924
|
+
if (!document) {
|
|
925
|
+
throw new errors.NotFoundError(`No entry found for contentType ${action.contentType}`);
|
|
926
|
+
}
|
|
927
|
+
action.entryDocumentId = document.documentId;
|
|
928
|
+
}
|
|
917
929
|
const release2 = await strapi2.db.query(RELEASE_MODEL_UID).findOne({ where: { id: releaseId } });
|
|
918
930
|
if (!release2) {
|
|
919
931
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
@@ -939,7 +951,9 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
939
951
|
},
|
|
940
952
|
populate: { release: { select: ["id"] } }
|
|
941
953
|
});
|
|
942
|
-
|
|
954
|
+
if (!disableUpdateReleaseStatus) {
|
|
955
|
+
getService("release", { strapi: strapi2 }).updateReleaseStatus(release2.id);
|
|
956
|
+
}
|
|
943
957
|
return releaseAction2;
|
|
944
958
|
},
|
|
945
959
|
async findPage(releaseId, query) {
|
|
@@ -1042,7 +1056,7 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
1042
1056
|
`Action with id ${actionId} not found in release with id ${releaseId} or it is already published`
|
|
1043
1057
|
);
|
|
1044
1058
|
}
|
|
1045
|
-
const actionStatus = update.type === "publish" ? getDraftEntryValidStatus(
|
|
1059
|
+
const actionStatus = update.type === "publish" ? await getDraftEntryValidStatus(
|
|
1046
1060
|
{
|
|
1047
1061
|
contentType: action.contentType,
|
|
1048
1062
|
documentId: action.entryDocumentId,
|
|
@@ -1283,7 +1297,15 @@ const releaseController = {
|
|
|
1283
1297
|
const releaseService = getService("release", { strapi });
|
|
1284
1298
|
const query = await permissionsManager.sanitizeQuery(ctx.query);
|
|
1285
1299
|
await validatefindByDocumentAttachedParams(query);
|
|
1286
|
-
const
|
|
1300
|
+
const model = strapi.getModel(query.contentType);
|
|
1301
|
+
if (model.kind && model.kind === "singleType") {
|
|
1302
|
+
const document = await strapi.db.query(model.uid).findOne({ select: ["documentId"] });
|
|
1303
|
+
if (!document) {
|
|
1304
|
+
throw new errors.NotFoundError(`No entry found for contentType ${query.contentType}`);
|
|
1305
|
+
}
|
|
1306
|
+
query.entryDocumentId = document.documentId;
|
|
1307
|
+
}
|
|
1308
|
+
const { contentType, hasEntryAttached, entryDocumentId, locale } = query;
|
|
1287
1309
|
const isEntryAttached = typeof hasEntryAttached === "string" ? Boolean(JSON.parse(hasEntryAttached)) : false;
|
|
1288
1310
|
if (isEntryAttached) {
|
|
1289
1311
|
const releases = await releaseService.findMany({
|
|
@@ -1297,7 +1319,12 @@ const releaseController = {
|
|
|
1297
1319
|
},
|
|
1298
1320
|
populate: {
|
|
1299
1321
|
actions: {
|
|
1300
|
-
fields: ["type"]
|
|
1322
|
+
fields: ["type"],
|
|
1323
|
+
filters: {
|
|
1324
|
+
contentType,
|
|
1325
|
+
entryDocumentId: entryDocumentId ?? null,
|
|
1326
|
+
locale: locale ?? null
|
|
1327
|
+
}
|
|
1301
1328
|
}
|
|
1302
1329
|
}
|
|
1303
1330
|
});
|
|
@@ -1528,11 +1555,14 @@ const releaseActionController = {
|
|
|
1528
1555
|
releaseActionsArgs.map((releaseActionArgs) => validateReleaseAction(releaseActionArgs))
|
|
1529
1556
|
);
|
|
1530
1557
|
const releaseActionService = getService("release-action", { strapi });
|
|
1558
|
+
const releaseService = getService("release", { strapi });
|
|
1531
1559
|
const releaseActions = await strapi.db.transaction(async () => {
|
|
1532
1560
|
const releaseActions2 = await Promise.all(
|
|
1533
1561
|
releaseActionsArgs.map(async (releaseActionArgs) => {
|
|
1534
1562
|
try {
|
|
1535
|
-
const action = await releaseActionService.create(releaseId, releaseActionArgs
|
|
1563
|
+
const action = await releaseActionService.create(releaseId, releaseActionArgs, {
|
|
1564
|
+
disableUpdateReleaseStatus: true
|
|
1565
|
+
});
|
|
1536
1566
|
return action;
|
|
1537
1567
|
} catch (error) {
|
|
1538
1568
|
if (error instanceof AlreadyOnReleaseError) {
|
|
@@ -1545,6 +1575,9 @@ const releaseActionController = {
|
|
|
1545
1575
|
return releaseActions2;
|
|
1546
1576
|
});
|
|
1547
1577
|
const newReleaseActions = releaseActions.filter((action) => action !== null);
|
|
1578
|
+
if (newReleaseActions.length > 0) {
|
|
1579
|
+
releaseService.updateReleaseStatus(releaseId);
|
|
1580
|
+
}
|
|
1548
1581
|
ctx.created({
|
|
1549
1582
|
data: newReleaseActions,
|
|
1550
1583
|
meta: {
|