@strapi/content-releases 0.0.0-experimental.f31889311d753b5f7d95198ae84d8fce1d156cd6 → 0.0.0-experimental.f74ae50eea1ce95176f088dba837e95b60fa2a4d
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-Cf879yGs.mjs → App-Db0aPjrG.mjs} +40 -17
- package/dist/_chunks/App-Db0aPjrG.mjs.map +1 -0
- package/dist/_chunks/{App-BjBiAE8g.js → App-xHZkNTlJ.js} +39 -16
- package/dist/_chunks/App-xHZkNTlJ.js.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-BlUuvtd9.mjs → ReleasesSettingsPage-C3rlM6Kf.mjs} +3 -3
- package/dist/_chunks/ReleasesSettingsPage-C3rlM6Kf.mjs.map +1 -0
- package/dist/_chunks/{ReleasesSettingsPage-D7kMSSvV.js → ReleasesSettingsPage-DxEYftwd.js} +3 -3
- package/dist/_chunks/ReleasesSettingsPage-DxEYftwd.js.map +1 -0
- package/dist/_chunks/{en-BCDLTJn3.js → en-CmYoEnA7.js} +2 -1
- package/dist/_chunks/en-CmYoEnA7.js.map +1 -0
- package/dist/_chunks/{en-CGXIF4vQ.mjs → en-D0yVZFqf.mjs} +2 -1
- package/dist/_chunks/en-D0yVZFqf.mjs.map +1 -0
- package/dist/_chunks/{index-1MxwkUQx.js → index-CulHY6KM.js} +276 -17
- package/dist/_chunks/index-CulHY6KM.js.map +1 -0
- package/dist/_chunks/{index-BG0Q8zkH.mjs → index-Dj_bL2s7.mjs} +279 -20
- 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/admin/src/components/ReleaseListCell.d.ts +28 -0
- package/dist/admin/src/services/release.d.ts +6 -4
- package/dist/server/index.js +101 -77
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +101 -77
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/index.d.ts +2 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/release-action.d.ts +1 -0
- package/dist/server/src/controllers/release-action.d.ts.map +1 -1
- package/dist/server/src/controllers/release.d.ts +1 -0
- package/dist/server/src/controllers/release.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/release-action.d.ts.map +1 -1
- package/dist/server/src/routes/release.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/dist/shared/contracts/release-actions.d.ts +3 -5
- package/dist/shared/contracts/release-actions.d.ts.map +1 -1
- package/dist/shared/contracts/releases.d.ts +3 -2
- package/dist/shared/contracts/releases.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/_chunks/App-BjBiAE8g.js.map +0 -1
- package/dist/_chunks/App-Cf879yGs.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-BlUuvtd9.mjs.map +0 -1
- package/dist/_chunks/ReleasesSettingsPage-D7kMSSvV.js.map +0 -1
- package/dist/_chunks/en-BCDLTJn3.js.map +0 -1
- package/dist/_chunks/en-CGXIF4vQ.mjs.map +0 -1
- package/dist/_chunks/index-1MxwkUQx.js.map +0 -1
- package/dist/_chunks/index-BG0Q8zkH.mjs.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) {
|
|
@@ -1112,11 +1122,11 @@ const createReleaseValidationService = ({ strapi: strapi2 }) => ({
|
|
|
1112
1122
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
1113
1123
|
}
|
|
1114
1124
|
const isEntryInRelease = release2.actions.some(
|
|
1115
|
-
(action) =>
|
|
1125
|
+
(action) => action.entryDocumentId === releaseActionArgs.entryDocumentId && action.contentType === releaseActionArgs.contentType && (releaseActionArgs.locale ? action.locale === releaseActionArgs.locale : true)
|
|
1116
1126
|
);
|
|
1117
1127
|
if (isEntryInRelease) {
|
|
1118
1128
|
throw new AlreadyOnReleaseError(
|
|
1119
|
-
`Entry with documentId ${releaseActionArgs.entryDocumentId}
|
|
1129
|
+
`Entry with documentId ${releaseActionArgs.entryDocumentId}${releaseActionArgs.locale ? `( ${releaseActionArgs.locale})` : ""} and contentType ${releaseActionArgs.contentType} already exists in release with id ${releaseId}`
|
|
1120
1130
|
);
|
|
1121
1131
|
}
|
|
1122
1132
|
},
|
|
@@ -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({
|
|
@@ -1385,43 +1403,50 @@ const releaseController = {
|
|
|
1385
1403
|
};
|
|
1386
1404
|
ctx.body = { data };
|
|
1387
1405
|
},
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1406
|
+
async mapEntriesToReleases(ctx) {
|
|
1407
|
+
const { contentTypeUid, documentIds, locale } = ctx.query;
|
|
1408
|
+
if (!contentTypeUid || !documentIds) {
|
|
1409
|
+
throw new errors.ValidationError("Missing required query parameters");
|
|
1410
|
+
}
|
|
1411
|
+
const releaseService = getService("release", { strapi });
|
|
1412
|
+
const releasesWithActions = await releaseService.findMany({
|
|
1413
|
+
where: {
|
|
1414
|
+
releasedAt: null,
|
|
1415
|
+
actions: {
|
|
1416
|
+
contentType: contentTypeUid,
|
|
1417
|
+
entryDocumentId: {
|
|
1418
|
+
$in: documentIds
|
|
1419
|
+
},
|
|
1420
|
+
locale
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
populate: {
|
|
1424
|
+
actions: true
|
|
1394
1425
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
ctx.body = {
|
|
1421
|
-
data: mappedEntriesInReleases,
|
|
1422
|
-
};
|
|
1423
|
-
},
|
|
1424
|
-
*/
|
|
1426
|
+
});
|
|
1427
|
+
const mappedEntriesInReleases = releasesWithActions.reduce(
|
|
1428
|
+
(acc, release2) => {
|
|
1429
|
+
release2.actions.forEach((action) => {
|
|
1430
|
+
if (action.contentType !== contentTypeUid) {
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
if (locale && action.locale !== locale) {
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
if (!acc[action.entryDocumentId]) {
|
|
1437
|
+
acc[action.entryDocumentId] = [{ id: release2.id, name: release2.name }];
|
|
1438
|
+
} else {
|
|
1439
|
+
acc[action.entryDocumentId].push({ id: release2.id, name: release2.name });
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
return acc;
|
|
1443
|
+
},
|
|
1444
|
+
{}
|
|
1445
|
+
);
|
|
1446
|
+
ctx.body = {
|
|
1447
|
+
data: mappedEntriesInReleases
|
|
1448
|
+
};
|
|
1449
|
+
},
|
|
1425
1450
|
async create(ctx) {
|
|
1426
1451
|
const user = ctx.state.user;
|
|
1427
1452
|
const releaseArgs = ctx.request.body;
|
|
@@ -1514,22 +1539,23 @@ const releaseActionController = {
|
|
|
1514
1539
|
data: releaseAction2
|
|
1515
1540
|
});
|
|
1516
1541
|
},
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1520
|
-
const releaseActionsArgs = ctx.request.body as CreateManyReleaseActions.Request['body'];
|
|
1542
|
+
async createMany(ctx) {
|
|
1543
|
+
const releaseId = ctx.params.releaseId;
|
|
1544
|
+
const releaseActionsArgs = ctx.request.body;
|
|
1521
1545
|
await Promise.all(
|
|
1522
1546
|
releaseActionsArgs.map((releaseActionArgs) => validateReleaseAction(releaseActionArgs))
|
|
1523
1547
|
);
|
|
1524
|
-
const releaseActionService = getService(
|
|
1548
|
+
const releaseActionService = getService("release-action", { strapi });
|
|
1549
|
+
const releaseService = getService("release", { strapi });
|
|
1525
1550
|
const releaseActions = await strapi.db.transaction(async () => {
|
|
1526
|
-
const
|
|
1551
|
+
const releaseActions2 = await Promise.all(
|
|
1527
1552
|
releaseActionsArgs.map(async (releaseActionArgs) => {
|
|
1528
1553
|
try {
|
|
1529
|
-
const action = await releaseActionService.create(releaseId, releaseActionArgs
|
|
1554
|
+
const action = await releaseActionService.create(releaseId, releaseActionArgs, {
|
|
1555
|
+
disableUpdateReleaseStatus: true
|
|
1556
|
+
});
|
|
1530
1557
|
return action;
|
|
1531
1558
|
} catch (error) {
|
|
1532
|
-
// If the entry is already in the release, we don't want to throw an error, so we catch and ignore it
|
|
1533
1559
|
if (error instanceof AlreadyOnReleaseError) {
|
|
1534
1560
|
return null;
|
|
1535
1561
|
}
|
|
@@ -1537,18 +1563,20 @@ const releaseActionController = {
|
|
|
1537
1563
|
}
|
|
1538
1564
|
})
|
|
1539
1565
|
);
|
|
1540
|
-
return
|
|
1566
|
+
return releaseActions2;
|
|
1541
1567
|
});
|
|
1542
1568
|
const newReleaseActions = releaseActions.filter((action) => action !== null);
|
|
1569
|
+
if (newReleaseActions.length > 0) {
|
|
1570
|
+
releaseService.updateReleaseStatus(releaseId);
|
|
1571
|
+
}
|
|
1543
1572
|
ctx.created({
|
|
1544
1573
|
data: newReleaseActions,
|
|
1545
1574
|
meta: {
|
|
1546
1575
|
entriesAlreadyInRelease: releaseActions.length - newReleaseActions.length,
|
|
1547
|
-
totalEntries: releaseActions.length
|
|
1548
|
-
}
|
|
1576
|
+
totalEntries: releaseActions.length
|
|
1577
|
+
}
|
|
1549
1578
|
});
|
|
1550
1579
|
},
|
|
1551
|
-
*/
|
|
1552
1580
|
async findMany(ctx) {
|
|
1553
1581
|
const releaseId = ctx.params.releaseId;
|
|
1554
1582
|
const permissionsManager = strapi.service("admin::permission").createPermissionsManager({
|
|
@@ -1647,24 +1675,22 @@ const controllers = {
|
|
|
1647
1675
|
const release = {
|
|
1648
1676
|
type: "admin",
|
|
1649
1677
|
routes: [
|
|
1650
|
-
/*
|
|
1651
1678
|
{
|
|
1652
|
-
method:
|
|
1653
|
-
path:
|
|
1654
|
-
handler:
|
|
1679
|
+
method: "GET",
|
|
1680
|
+
path: "/mapEntriesToReleases",
|
|
1681
|
+
handler: "release.mapEntriesToReleases",
|
|
1655
1682
|
config: {
|
|
1656
1683
|
policies: [
|
|
1657
|
-
|
|
1684
|
+
"admin::isAuthenticatedAdmin",
|
|
1658
1685
|
{
|
|
1659
|
-
name:
|
|
1686
|
+
name: "admin::hasPermissions",
|
|
1660
1687
|
config: {
|
|
1661
|
-
actions: [
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
]
|
|
1665
|
-
}
|
|
1688
|
+
actions: ["plugin::content-releases.read"]
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1666
1693
|
},
|
|
1667
|
-
*/
|
|
1668
1694
|
{
|
|
1669
1695
|
method: "GET",
|
|
1670
1696
|
path: "/getByDocumentAttached",
|
|
@@ -1798,24 +1824,22 @@ const releaseAction = {
|
|
|
1798
1824
|
]
|
|
1799
1825
|
}
|
|
1800
1826
|
},
|
|
1801
|
-
/*
|
|
1802
1827
|
{
|
|
1803
|
-
method:
|
|
1804
|
-
path:
|
|
1805
|
-
handler:
|
|
1828
|
+
method: "POST",
|
|
1829
|
+
path: "/:releaseId/actions/bulk",
|
|
1830
|
+
handler: "release-action.createMany",
|
|
1806
1831
|
config: {
|
|
1807
1832
|
policies: [
|
|
1808
|
-
|
|
1833
|
+
"admin::isAuthenticatedAdmin",
|
|
1809
1834
|
{
|
|
1810
|
-
name:
|
|
1835
|
+
name: "admin::hasPermissions",
|
|
1811
1836
|
config: {
|
|
1812
|
-
actions: [
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
]
|
|
1816
|
-
}
|
|
1837
|
+
actions: ["plugin::content-releases.create-action"]
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
]
|
|
1841
|
+
}
|
|
1817
1842
|
},
|
|
1818
|
-
*/
|
|
1819
1843
|
{
|
|
1820
1844
|
method: "GET",
|
|
1821
1845
|
path: "/:releaseId/actions",
|