@strapi/content-releases 0.0.0-experimental.d362bf200f5f9359a4bbd4a549603de5ee1f04ca → 0.0.0-experimental.d5b46d578a5c055b8dcc66939e1b5d540976fafb
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-1LckaIGY.js → App-OP70yd5M.js} +210 -224
- package/dist/_chunks/App-OP70yd5M.js.map +1 -0
- package/dist/_chunks/{App-X01LBg5V.mjs → App-x6Tjj3HN.mjs} +202 -216
- package/dist/_chunks/App-x6Tjj3HN.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-Clm0iACO.mjs → PurchaseContentReleases-3tRbmbY3.mjs} +2 -2
- package/dist/_chunks/PurchaseContentReleases-3tRbmbY3.mjs.map +1 -0
- package/dist/_chunks/{PurchaseContentReleases-YhAPgpG9.js → PurchaseContentReleases-bpIYXOfu.js} +2 -2
- package/dist/_chunks/PurchaseContentReleases-bpIYXOfu.js.map +1 -0
- package/dist/_chunks/{en-faJDuv3q.js → en-3SGjiVyR.js} +10 -2
- package/dist/_chunks/en-3SGjiVyR.js.map +1 -0
- package/dist/_chunks/{en-RdapH-9X.mjs → en-bpHsnU0n.mjs} +10 -2
- package/dist/_chunks/en-bpHsnU0n.mjs.map +1 -0
- package/dist/_chunks/{index-OD9AlD-6.mjs → index-1ejXLtzt.mjs} +273 -103
- package/dist/_chunks/index-1ejXLtzt.mjs.map +1 -0
- package/dist/_chunks/{index-cYWov2wa.js → index-ydocdaZ0.js} +270 -100
- package/dist/_chunks/index-ydocdaZ0.js.map +1 -0
- package/dist/admin/index.js +15 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +16 -2
- package/dist/admin/index.mjs.map +1 -1
- package/dist/server/index.js +62 -60
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +62 -61
- package/dist/server/index.mjs.map +1 -1
- package/package.json +28 -21
- package/dist/_chunks/App-1LckaIGY.js.map +0 -1
- package/dist/_chunks/App-X01LBg5V.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-Clm0iACO.mjs.map +0 -1
- package/dist/_chunks/PurchaseContentReleases-YhAPgpG9.js.map +0 -1
- package/dist/_chunks/en-RdapH-9X.mjs.map +0 -1
- package/dist/_chunks/en-faJDuv3q.js.map +0 -1
- package/dist/_chunks/index-OD9AlD-6.mjs.map +0 -1
- package/dist/_chunks/index-cYWov2wa.js.map +0 -1
- package/dist/admin/src/components/CMReleasesContainer.d.ts +0 -1
- package/dist/admin/src/components/RelativeTime.d.ts +0 -28
- package/dist/admin/src/components/ReleaseActionMenu.d.ts +0 -26
- package/dist/admin/src/components/ReleaseActionOptions.d.ts +0 -9
- package/dist/admin/src/components/ReleaseModal.d.ts +0 -16
- package/dist/admin/src/constants.d.ts +0 -58
- package/dist/admin/src/index.d.ts +0 -3
- package/dist/admin/src/pages/App.d.ts +0 -1
- package/dist/admin/src/pages/PurchaseContentReleases.d.ts +0 -2
- package/dist/admin/src/pages/ReleaseDetailsPage.d.ts +0 -2
- package/dist/admin/src/pages/ReleasesPage.d.ts +0 -8
- package/dist/admin/src/pages/tests/mockReleaseDetailsPageData.d.ts +0 -181
- package/dist/admin/src/pages/tests/mockReleasesPageData.d.ts +0 -39
- package/dist/admin/src/pluginId.d.ts +0 -1
- package/dist/admin/src/services/axios.d.ts +0 -29
- package/dist/admin/src/services/release.d.ts +0 -369
- package/dist/admin/src/store/hooks.d.ts +0 -7
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +0 -3
- package/dist/admin/src/utils/time.d.ts +0 -1
- package/dist/server/src/bootstrap.d.ts +0 -5
- package/dist/server/src/bootstrap.d.ts.map +0 -1
- package/dist/server/src/constants.d.ts +0 -12
- package/dist/server/src/constants.d.ts.map +0 -1
- package/dist/server/src/content-types/index.d.ts +0 -99
- package/dist/server/src/content-types/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/index.d.ts +0 -48
- package/dist/server/src/content-types/release/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release/schema.d.ts +0 -47
- package/dist/server/src/content-types/release/schema.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/index.d.ts +0 -50
- package/dist/server/src/content-types/release-action/index.d.ts.map +0 -1
- package/dist/server/src/content-types/release-action/schema.d.ts +0 -49
- package/dist/server/src/content-types/release-action/schema.d.ts.map +0 -1
- package/dist/server/src/controllers/index.d.ts +0 -19
- package/dist/server/src/controllers/index.d.ts.map +0 -1
- package/dist/server/src/controllers/release-action.d.ts +0 -10
- package/dist/server/src/controllers/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/release.d.ts +0 -11
- package/dist/server/src/controllers/release.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release-action.d.ts +0 -8
- package/dist/server/src/controllers/validation/release-action.d.ts.map +0 -1
- package/dist/server/src/controllers/validation/release.d.ts +0 -2
- package/dist/server/src/controllers/validation/release.d.ts.map +0 -1
- package/dist/server/src/destroy.d.ts +0 -5
- package/dist/server/src/destroy.d.ts.map +0 -1
- package/dist/server/src/index.d.ts +0 -2095
- package/dist/server/src/index.d.ts.map +0 -1
- package/dist/server/src/migrations/index.d.ts +0 -13
- package/dist/server/src/migrations/index.d.ts.map +0 -1
- package/dist/server/src/register.d.ts +0 -5
- package/dist/server/src/register.d.ts.map +0 -1
- package/dist/server/src/routes/index.d.ts +0 -35
- package/dist/server/src/routes/index.d.ts.map +0 -1
- package/dist/server/src/routes/release-action.d.ts +0 -18
- package/dist/server/src/routes/release-action.d.ts.map +0 -1
- package/dist/server/src/routes/release.d.ts +0 -18
- package/dist/server/src/routes/release.d.ts.map +0 -1
- package/dist/server/src/services/index.d.ts +0 -1826
- package/dist/server/src/services/index.d.ts.map +0 -1
- package/dist/server/src/services/release.d.ts +0 -66
- package/dist/server/src/services/release.d.ts.map +0 -1
- package/dist/server/src/services/scheduling.d.ts +0 -18
- package/dist/server/src/services/scheduling.d.ts.map +0 -1
- package/dist/server/src/services/validation.d.ts +0 -18
- package/dist/server/src/services/validation.d.ts.map +0 -1
- package/dist/server/src/utils/index.d.ts +0 -14
- package/dist/server/src/utils/index.d.ts.map +0 -1
- package/dist/shared/contracts/release-actions.d.ts +0 -131
- package/dist/shared/contracts/release-actions.d.ts.map +0 -1
- package/dist/shared/contracts/releases.d.ts +0 -166
- package/dist/shared/contracts/releases.d.ts.map +0 -1
- package/dist/shared/types.d.ts +0 -24
- package/dist/shared/types.d.ts.map +0 -1
- package/dist/shared/validation-schemas.d.ts +0 -2
- package/dist/shared/validation-schemas.d.ts.map +0 -1
package/dist/server/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { contentTypes as contentTypes$1,
|
|
1
|
+
import { contentTypes as contentTypes$1, mapAsync, setCreatorFields, errors, validateYupSchema, yup as yup$1 } from "@strapi/utils";
|
|
2
2
|
import isEqual from "lodash/isEqual";
|
|
3
3
|
import { difference, keys } from "lodash";
|
|
4
4
|
import _ from "lodash/fp";
|
|
5
|
+
import EE from "@strapi/strapi/dist/utils/ee";
|
|
5
6
|
import { scheduleJob } from "node-schedule";
|
|
6
7
|
import * as yup from "yup";
|
|
7
8
|
const RELEASE_MODEL_UID = "plugin::content-releases.release";
|
|
@@ -59,10 +60,7 @@ const getService = (name, { strapi: strapi2 } = { strapi: global.strapi }) => {
|
|
|
59
60
|
const getPopulatedEntry = async (contentTypeUid, entryId, { strapi: strapi2 } = { strapi: global.strapi }) => {
|
|
60
61
|
const populateBuilderService = strapi2.plugin("content-manager").service("populate-builder");
|
|
61
62
|
const populate = await populateBuilderService(contentTypeUid).populateDeep(Infinity).build();
|
|
62
|
-
const entry = await strapi2.
|
|
63
|
-
where: { id: entryId },
|
|
64
|
-
populate
|
|
65
|
-
});
|
|
63
|
+
const entry = await strapi2.entityService.findOne(contentTypeUid, entryId, { populate });
|
|
66
64
|
return entry;
|
|
67
65
|
};
|
|
68
66
|
const getEntryValidStatus = async (contentTypeUid, entry, { strapi: strapi2 } = { strapi: global.strapi }) => {
|
|
@@ -100,7 +98,7 @@ async function deleteActionsOnDisableDraftAndPublish({
|
|
|
100
98
|
async function deleteActionsOnDeleteContentType({ oldContentTypes, contentTypes: contentTypes2 }) {
|
|
101
99
|
const deletedContentTypes = difference(keys(oldContentTypes), keys(contentTypes2)) ?? [];
|
|
102
100
|
if (deletedContentTypes.length) {
|
|
103
|
-
await
|
|
101
|
+
await mapAsync(deletedContentTypes, async (deletedContentTypeUID) => {
|
|
104
102
|
return strapi.db?.queryBuilder(RELEASE_ACTION_MODEL_UID).delete().where({ contentType: deletedContentTypeUID }).execute();
|
|
105
103
|
});
|
|
106
104
|
}
|
|
@@ -119,7 +117,7 @@ async function migrateIsValidAndStatusReleases() {
|
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
});
|
|
122
|
-
|
|
120
|
+
mapAsync(releasesWithoutStatus, async (release2) => {
|
|
123
121
|
const actions = release2.actions;
|
|
124
122
|
const notValidatedActions = actions.filter((action) => action.isEntryValid === null);
|
|
125
123
|
for (const action of notValidatedActions) {
|
|
@@ -150,7 +148,7 @@ async function migrateIsValidAndStatusReleases() {
|
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
150
|
});
|
|
153
|
-
|
|
151
|
+
mapAsync(publishedReleases, async (release2) => {
|
|
154
152
|
return strapi.db.query(RELEASE_MODEL_UID).update({
|
|
155
153
|
where: {
|
|
156
154
|
id: release2.id
|
|
@@ -167,7 +165,7 @@ async function revalidateChangedContentTypes({ oldContentTypes, contentTypes: co
|
|
|
167
165
|
(uid) => oldContentTypes[uid]?.options?.draftAndPublish
|
|
168
166
|
);
|
|
169
167
|
const releasesAffected = /* @__PURE__ */ new Set();
|
|
170
|
-
|
|
168
|
+
mapAsync(contentTypesWithDraftAndPublish, async (contentTypeUID) => {
|
|
171
169
|
const oldContentType = oldContentTypes[contentTypeUID];
|
|
172
170
|
const contentType = contentTypes2[contentTypeUID];
|
|
173
171
|
if (!isEqual(oldContentType?.attributes, contentType?.attributes)) {
|
|
@@ -180,7 +178,7 @@ async function revalidateChangedContentTypes({ oldContentTypes, contentTypes: co
|
|
|
180
178
|
release: true
|
|
181
179
|
}
|
|
182
180
|
});
|
|
183
|
-
await
|
|
181
|
+
await mapAsync(actions, async (action) => {
|
|
184
182
|
if (action.entry && action.release) {
|
|
185
183
|
const populatedEntry = await getPopulatedEntry(contentTypeUID, action.entry.id, {
|
|
186
184
|
strapi
|
|
@@ -203,7 +201,7 @@ async function revalidateChangedContentTypes({ oldContentTypes, contentTypes: co
|
|
|
203
201
|
});
|
|
204
202
|
}
|
|
205
203
|
}).then(() => {
|
|
206
|
-
|
|
204
|
+
mapAsync(releasesAffected, async (releaseId) => {
|
|
207
205
|
return getService("release", { strapi }).updateReleaseStatus(releaseId);
|
|
208
206
|
});
|
|
209
207
|
});
|
|
@@ -249,10 +247,11 @@ async function enableContentTypeLocalized({ oldContentTypes, contentTypes: conte
|
|
|
249
247
|
}
|
|
250
248
|
}
|
|
251
249
|
}
|
|
250
|
+
const { features: features$2 } = require("@strapi/strapi/dist/utils/ee");
|
|
252
251
|
const register = async ({ strapi: strapi2 }) => {
|
|
253
|
-
if (
|
|
252
|
+
if (features$2.isEnabled("cms-content-releases")) {
|
|
254
253
|
await strapi2.admin.services.permission.actionProvider.registerMany(ACTIONS);
|
|
255
|
-
strapi2.hook("strapi::content-types.beforeSync").register(
|
|
254
|
+
strapi2.hook("strapi::content-types.beforeSync").register(deleteActionsOnDisableDraftAndPublish).register(disableContentTypeLocalized);
|
|
256
255
|
strapi2.hook("strapi::content-types.afterSync").register(deleteActionsOnDeleteContentType).register(enableContentTypeLocalized).register(revalidateChangedContentTypes).register(migrateIsValidAndStatusReleases);
|
|
257
256
|
}
|
|
258
257
|
if (strapi2.plugin("graphql")) {
|
|
@@ -261,8 +260,9 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
261
260
|
graphqlExtensionService.shadowCRUD(RELEASE_ACTION_MODEL_UID).disable();
|
|
262
261
|
}
|
|
263
262
|
};
|
|
263
|
+
const { features: features$1 } = require("@strapi/strapi/dist/utils/ee");
|
|
264
264
|
const bootstrap = async ({ strapi: strapi2 }) => {
|
|
265
|
-
if (
|
|
265
|
+
if (features$1.isEnabled("cms-content-releases")) {
|
|
266
266
|
const contentTypesWithDraftAndPublish = Object.keys(strapi2.contentTypes).filter(
|
|
267
267
|
(uid) => strapi2.contentTypes[uid]?.options?.draftAndPublish
|
|
268
268
|
);
|
|
@@ -321,7 +321,9 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
321
321
|
actions: {
|
|
322
322
|
target_type: model.uid,
|
|
323
323
|
target_id: {
|
|
324
|
-
$in: entriesToDelete.map(
|
|
324
|
+
$in: entriesToDelete.map(
|
|
325
|
+
(entry) => entry.id
|
|
326
|
+
)
|
|
325
327
|
}
|
|
326
328
|
}
|
|
327
329
|
}
|
|
@@ -348,9 +350,13 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
348
350
|
try {
|
|
349
351
|
const { model, result } = event;
|
|
350
352
|
if (model.kind === "collectionType" && model.options?.draftAndPublish) {
|
|
351
|
-
const isEntryValid = await getEntryValidStatus(
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const isEntryValid = await getEntryValidStatus(
|
|
354
|
+
model.uid,
|
|
355
|
+
result,
|
|
356
|
+
{
|
|
357
|
+
strapi: strapi2
|
|
358
|
+
}
|
|
359
|
+
);
|
|
354
360
|
await strapi2.db.query(RELEASE_ACTION_MODEL_UID).update({
|
|
355
361
|
where: {
|
|
356
362
|
target_type: model.uid,
|
|
@@ -619,7 +625,7 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
619
625
|
validateUniqueNameForPendingRelease(releaseWithCreatorFields.name),
|
|
620
626
|
validateScheduledAtIsLaterThanNow(releaseWithCreatorFields.scheduledAt)
|
|
621
627
|
]);
|
|
622
|
-
const release2 = await strapi2.
|
|
628
|
+
const release2 = await strapi2.entityService.create(RELEASE_MODEL_UID, {
|
|
623
629
|
data: {
|
|
624
630
|
...releaseWithCreatorFields,
|
|
625
631
|
status: "empty"
|
|
@@ -633,19 +639,17 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
633
639
|
return release2;
|
|
634
640
|
},
|
|
635
641
|
async findOne(id, query = {}) {
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
...dbQuery,
|
|
639
|
-
where: { id }
|
|
642
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, id, {
|
|
643
|
+
...query
|
|
640
644
|
});
|
|
641
645
|
return release2;
|
|
642
646
|
},
|
|
643
647
|
findPage(query) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
...dbQuery,
|
|
648
|
+
return strapi2.entityService.findPage(RELEASE_MODEL_UID, {
|
|
649
|
+
...query,
|
|
647
650
|
populate: {
|
|
648
651
|
actions: {
|
|
652
|
+
// @ts-expect-error Ignore missing properties
|
|
649
653
|
count: true
|
|
650
654
|
}
|
|
651
655
|
}
|
|
@@ -737,15 +741,19 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
737
741
|
validateUniqueNameForPendingRelease(releaseWithCreatorFields.name, id),
|
|
738
742
|
validateScheduledAtIsLaterThanNow(releaseWithCreatorFields.scheduledAt)
|
|
739
743
|
]);
|
|
740
|
-
const release2 = await strapi2.
|
|
744
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, id);
|
|
741
745
|
if (!release2) {
|
|
742
746
|
throw new errors.NotFoundError(`No release found for id ${id}`);
|
|
743
747
|
}
|
|
744
748
|
if (release2.releasedAt) {
|
|
745
749
|
throw new errors.ValidationError("Release already published");
|
|
746
750
|
}
|
|
747
|
-
const updatedRelease = await strapi2.
|
|
748
|
-
|
|
751
|
+
const updatedRelease = await strapi2.entityService.update(RELEASE_MODEL_UID, id, {
|
|
752
|
+
/*
|
|
753
|
+
* The type returned from the entity service: Partial<Input<"plugin::content-releases.release">>
|
|
754
|
+
* is not compatible with the type we are passing here: UpdateRelease.Request['body']
|
|
755
|
+
*/
|
|
756
|
+
// @ts-expect-error see above
|
|
749
757
|
data: releaseWithCreatorFields
|
|
750
758
|
});
|
|
751
759
|
const schedulingService = getService("scheduling", { strapi: strapi2 });
|
|
@@ -766,7 +774,7 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
766
774
|
validateEntryContentType(action.entry.contentType),
|
|
767
775
|
validateUniqueEntry(releaseId, action)
|
|
768
776
|
]);
|
|
769
|
-
const release2 = await strapi2.
|
|
777
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, releaseId);
|
|
770
778
|
if (!release2) {
|
|
771
779
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
772
780
|
}
|
|
@@ -776,7 +784,7 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
776
784
|
const { entry, type } = action;
|
|
777
785
|
const populatedEntry = await getPopulatedEntry(entry.contentType, entry.id, { strapi: strapi2 });
|
|
778
786
|
const isEntryValid = await getEntryValidStatus(entry.contentType, populatedEntry, { strapi: strapi2 });
|
|
779
|
-
const releaseAction2 = await strapi2.
|
|
787
|
+
const releaseAction2 = await strapi2.entityService.create(RELEASE_ACTION_MODEL_UID, {
|
|
780
788
|
data: {
|
|
781
789
|
type,
|
|
782
790
|
contentType: entry.contentType,
|
|
@@ -789,35 +797,32 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
789
797
|
},
|
|
790
798
|
release: releaseId
|
|
791
799
|
},
|
|
792
|
-
populate: { release: {
|
|
800
|
+
populate: { release: { fields: ["id"] }, entry: { fields: ["id"] } }
|
|
793
801
|
});
|
|
794
802
|
this.updateReleaseStatus(releaseId);
|
|
795
803
|
return releaseAction2;
|
|
796
804
|
},
|
|
797
805
|
async findActions(releaseId, query) {
|
|
798
|
-
const release2 = await strapi2.
|
|
799
|
-
|
|
800
|
-
select: ["id"]
|
|
806
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, releaseId, {
|
|
807
|
+
fields: ["id"]
|
|
801
808
|
});
|
|
802
809
|
if (!release2) {
|
|
803
810
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
804
811
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
...dbQuery,
|
|
812
|
+
return strapi2.entityService.findPage(RELEASE_ACTION_MODEL_UID, {
|
|
813
|
+
...query,
|
|
808
814
|
populate: {
|
|
809
815
|
entry: {
|
|
810
816
|
populate: "*"
|
|
811
817
|
}
|
|
812
818
|
},
|
|
813
|
-
|
|
819
|
+
filters: {
|
|
814
820
|
release: releaseId
|
|
815
821
|
}
|
|
816
822
|
});
|
|
817
823
|
},
|
|
818
824
|
async countActions(query) {
|
|
819
|
-
|
|
820
|
-
return strapi2.db.query(RELEASE_ACTION_MODEL_UID).count(dbQuery);
|
|
825
|
+
return strapi2.entityService.count(RELEASE_ACTION_MODEL_UID, query);
|
|
821
826
|
},
|
|
822
827
|
async groupActions(actions, groupBy) {
|
|
823
828
|
const contentTypeUids = actions.reduce((acc, action) => {
|
|
@@ -898,11 +903,10 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
898
903
|
return componentsMap;
|
|
899
904
|
},
|
|
900
905
|
async delete(releaseId) {
|
|
901
|
-
const release2 = await strapi2.
|
|
902
|
-
where: { id: releaseId },
|
|
906
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, releaseId, {
|
|
903
907
|
populate: {
|
|
904
908
|
actions: {
|
|
905
|
-
|
|
909
|
+
fields: ["id"]
|
|
906
910
|
}
|
|
907
911
|
}
|
|
908
912
|
});
|
|
@@ -920,11 +924,7 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
920
924
|
}
|
|
921
925
|
}
|
|
922
926
|
});
|
|
923
|
-
await strapi2.
|
|
924
|
-
where: {
|
|
925
|
-
id: releaseId
|
|
926
|
-
}
|
|
927
|
-
});
|
|
927
|
+
await strapi2.entityService.delete(RELEASE_MODEL_UID, releaseId);
|
|
928
928
|
});
|
|
929
929
|
if (release2.scheduledAt) {
|
|
930
930
|
const schedulingService = getService("scheduling", { strapi: strapi2 });
|
|
@@ -995,7 +995,7 @@ const createReleaseService = ({ strapi: strapi2 }) => {
|
|
|
995
995
|
};
|
|
996
996
|
}
|
|
997
997
|
});
|
|
998
|
-
if (error
|
|
998
|
+
if (error) {
|
|
999
999
|
throw error;
|
|
1000
1000
|
}
|
|
1001
1001
|
return release2;
|
|
@@ -1093,11 +1093,8 @@ class AlreadyOnReleaseError extends errors.ApplicationError {
|
|
|
1093
1093
|
}
|
|
1094
1094
|
const createReleaseValidationService = ({ strapi: strapi2 }) => ({
|
|
1095
1095
|
async validateUniqueEntry(releaseId, releaseActionArgs) {
|
|
1096
|
-
const release2 = await strapi2.
|
|
1097
|
-
|
|
1098
|
-
id: releaseId
|
|
1099
|
-
},
|
|
1100
|
-
populate: { actions: { populate: { entry: { select: ["id"] } } } }
|
|
1096
|
+
const release2 = await strapi2.entityService.findOne(RELEASE_MODEL_UID, releaseId, {
|
|
1097
|
+
populate: { actions: { populate: { entry: { fields: ["id"] } } } }
|
|
1101
1098
|
});
|
|
1102
1099
|
if (!release2) {
|
|
1103
1100
|
throw new errors.NotFoundError(`No release found for id ${releaseId}`);
|
|
@@ -1123,7 +1120,10 @@ const createReleaseValidationService = ({ strapi: strapi2 }) => ({
|
|
|
1123
1120
|
}
|
|
1124
1121
|
},
|
|
1125
1122
|
async validatePendingReleasesLimit() {
|
|
1126
|
-
const maximumPendingReleases =
|
|
1123
|
+
const maximumPendingReleases = (
|
|
1124
|
+
// @ts-expect-error - options is not typed into features
|
|
1125
|
+
EE.features.get("cms-content-releases")?.options?.maximumReleases || 3
|
|
1126
|
+
);
|
|
1127
1127
|
const [, pendingReleasesCount] = await strapi2.db.query(RELEASE_MODEL_UID).findWithCount({
|
|
1128
1128
|
filters: {
|
|
1129
1129
|
releasedAt: {
|
|
@@ -1136,8 +1136,8 @@ const createReleaseValidationService = ({ strapi: strapi2 }) => ({
|
|
|
1136
1136
|
}
|
|
1137
1137
|
},
|
|
1138
1138
|
async validateUniqueNameForPendingRelease(name, id) {
|
|
1139
|
-
const pendingReleases = await strapi2.
|
|
1140
|
-
|
|
1139
|
+
const pendingReleases = await strapi2.entityService.findMany(RELEASE_MODEL_UID, {
|
|
1140
|
+
filters: {
|
|
1141
1141
|
releasedAt: {
|
|
1142
1142
|
$null: true
|
|
1143
1143
|
},
|
|
@@ -1264,7 +1264,7 @@ const releaseController = {
|
|
|
1264
1264
|
}
|
|
1265
1265
|
};
|
|
1266
1266
|
});
|
|
1267
|
-
const pendingReleasesCount = await strapi.
|
|
1267
|
+
const pendingReleasesCount = await strapi.query(RELEASE_MODEL_UID).count({
|
|
1268
1268
|
where: {
|
|
1269
1269
|
releasedAt: null
|
|
1270
1270
|
}
|
|
@@ -1442,7 +1442,7 @@ const releaseActionController = {
|
|
|
1442
1442
|
acc[action.contentType] = contentTypePermissionsManager.sanitizeOutput;
|
|
1443
1443
|
return acc;
|
|
1444
1444
|
}, {});
|
|
1445
|
-
const sanitizedResults = await
|
|
1445
|
+
const sanitizedResults = await mapAsync(results, async (action) => ({
|
|
1446
1446
|
...action,
|
|
1447
1447
|
entry: await contentTypeOutputSanitizers[action.contentType](action.entry)
|
|
1448
1448
|
}));
|
|
@@ -1674,8 +1674,9 @@ const routes = {
|
|
|
1674
1674
|
release,
|
|
1675
1675
|
"release-action": releaseAction
|
|
1676
1676
|
};
|
|
1677
|
+
const { features } = require("@strapi/strapi/dist/utils/ee");
|
|
1677
1678
|
const getPlugin = () => {
|
|
1678
|
-
if (
|
|
1679
|
+
if (features.isEnabled("cms-content-releases")) {
|
|
1679
1680
|
return {
|
|
1680
1681
|
register,
|
|
1681
1682
|
bootstrap,
|