@strapi/content-releases 0.0.0-experimental.c5235059f5636c4549ea2118c75c43b92e2615c8 → 0.0.0-experimental.c592deb623aed3f74ef7fdacfad9757ed59d34f7
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-DbD5Ks8-.mjs → App-Db0aPjrG.mjs} +40 -17
- package/dist/_chunks/App-Db0aPjrG.mjs.map +1 -0
- package/dist/_chunks/{App-D2cVDqQK.js → App-xHZkNTlJ.js} +39 -16
- package/dist/_chunks/App-xHZkNTlJ.js.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-BDinCYKz.mjs → ReleasesSettingsPage-C3rlM6Kf.mjs} +3 -3
- package/dist/_chunks/ReleasesSettingsPage-C3rlM6Kf.mjs.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-CE_KqB_s.js → ReleasesSettingsPage-DxEYftwd.js} +3 -3
- package/dist/_chunks/ReleasesSettingsPage-DxEYftwd.js.map +1 -0
- package/dist/_chunks/{index-mECKW99O.js → index-CulHY6KM.js} +52 -28
- package/dist/_chunks/index-CulHY6KM.js.map +1 -0
- package/dist/_chunks/{index-Bgq1X1sL.mjs → index-Dj_bL2s7.mjs} +52 -28
- package/dist/_chunks/index-Dj_bL2s7.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +28 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +28 -4
- 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/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 +12 -11
- package/dist/_chunks/App-D2cVDqQK.js.map +0 -1
- package/dist/_chunks/App-DbD5Ks8-.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-BDinCYKz.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-CE_KqB_s.js.map +0 -1
- package/dist/_chunks/index-Bgq1X1sL.mjs.map +0 -1
- package/dist/_chunks/index-mECKW99O.js.map +0 -1
- package/strapi-server.js +0 -3
package/dist/server/index.mjs
CHANGED
|
@@ -906,7 +906,7 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
906
906
|
return contentTypesData;
|
|
907
907
|
};
|
|
908
908
|
return {
|
|
909
|
-
async create(releaseId, action) {
|
|
909
|
+
async create(releaseId, action, { disableUpdateReleaseStatus = false } = {}) {
|
|
910
910
|
const { validateEntryData, validateUniqueEntry } = getService("release-validation", {
|
|
911
911
|
strapi: strapi2
|
|
912
912
|
});
|
|
@@ -914,6 +914,14 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
914
914
|
validateEntryData(action.contentType, action.entryDocumentId),
|
|
915
915
|
validateUniqueEntry(releaseId, action)
|
|
916
916
|
]);
|
|
917
|
+
const model = strapi2.contentType(action.contentType);
|
|
918
|
+
if (model.kind === "singleType") {
|
|
919
|
+
const document = await strapi2.db.query(model.uid).findOne({ select: ["documentId"] });
|
|
920
|
+
if (!document) {
|
|
921
|
+
throw new errors.NotFoundError(`No entry found for contentType ${action.contentType}`);
|
|
922
|
+
}
|
|
923
|
+
action.entryDocumentId = document.documentId;
|
|
924
|
+
}
|
|
917
925
|
const release2 = await strapi2.db.query(RELEASE_MODEL_UID).findOne({ where: { id: releaseId } });
|
|
918
926
|
if (!release2) {
|
|
919
927
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
@@ -939,7 +947,9 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
|
|
|
939
947
|
},
|
|
940
948
|
populate: { release: { select: ["id"] } }
|
|
941
949
|
});
|
|
942
|
-
|
|
950
|
+
if (!disableUpdateReleaseStatus) {
|
|
951
|
+
getService("release", { strapi: strapi2 }).updateReleaseStatus(release2.id);
|
|
952
|
+
}
|
|
943
953
|
return releaseAction2;
|
|
944
954
|
},
|
|
945
955
|
async findPage(releaseId, query) {
|
|
@@ -1283,7 +1293,15 @@ const releaseController = {
|
|
|
1283
1293
|
const releaseService = getService("release", { strapi });
|
|
1284
1294
|
const query = await permissionsManager.sanitizeQuery(ctx.query);
|
|
1285
1295
|
await validatefindByDocumentAttachedParams(query);
|
|
1286
|
-
const
|
|
1296
|
+
const model = strapi.getModel(query.contentType);
|
|
1297
|
+
if (model.kind && model.kind === "singleType") {
|
|
1298
|
+
const document = await strapi.db.query(model.uid).findOne({ select: ["documentId"] });
|
|
1299
|
+
if (!document) {
|
|
1300
|
+
throw new errors.NotFoundError(`No entry found for contentType ${query.contentType}`);
|
|
1301
|
+
}
|
|
1302
|
+
query.entryDocumentId = document.documentId;
|
|
1303
|
+
}
|
|
1304
|
+
const { contentType, hasEntryAttached, entryDocumentId, locale } = query;
|
|
1287
1305
|
const isEntryAttached = typeof hasEntryAttached === "string" ? Boolean(JSON.parse(hasEntryAttached)) : false;
|
|
1288
1306
|
if (isEntryAttached) {
|
|
1289
1307
|
const releases = await releaseService.findMany({
|
|
@@ -1528,11 +1546,14 @@ const releaseActionController = {
|
|
|
1528
1546
|
releaseActionsArgs.map((releaseActionArgs) => validateReleaseAction(releaseActionArgs))
|
|
1529
1547
|
);
|
|
1530
1548
|
const releaseActionService = getService("release-action", { strapi });
|
|
1549
|
+
const releaseService = getService("release", { strapi });
|
|
1531
1550
|
const releaseActions = await strapi.db.transaction(async () => {
|
|
1532
1551
|
const releaseActions2 = await Promise.all(
|
|
1533
1552
|
releaseActionsArgs.map(async (releaseActionArgs) => {
|
|
1534
1553
|
try {
|
|
1535
|
-
const action = await releaseActionService.create(releaseId, releaseActionArgs
|
|
1554
|
+
const action = await releaseActionService.create(releaseId, releaseActionArgs, {
|
|
1555
|
+
disableUpdateReleaseStatus: true
|
|
1556
|
+
});
|
|
1536
1557
|
return action;
|
|
1537
1558
|
} catch (error) {
|
|
1538
1559
|
if (error instanceof AlreadyOnReleaseError) {
|
|
@@ -1545,6 +1566,9 @@ const releaseActionController = {
|
|
|
1545
1566
|
return releaseActions2;
|
|
1546
1567
|
});
|
|
1547
1568
|
const newReleaseActions = releaseActions.filter((action) => action !== null);
|
|
1569
|
+
if (newReleaseActions.length > 0) {
|
|
1570
|
+
releaseService.updateReleaseStatus(releaseId);
|
|
1571
|
+
}
|
|
1548
1572
|
ctx.created({
|
|
1549
1573
|
data: newReleaseActions,
|
|
1550
1574
|
meta: {
|