strapi-plugin-bulk-updater 1.5.5 → 1.5.6
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.js +201 -35
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +201 -35
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -990,6 +990,88 @@ function formatEntryRecord(entry) {
|
|
|
990
990
|
}
|
|
991
991
|
return formatted;
|
|
992
992
|
}
|
|
993
|
+
function extractStageName(val) {
|
|
994
|
+
if (val === void 0 || val === null) return "";
|
|
995
|
+
if (typeof val === "object") {
|
|
996
|
+
const candidateProps = [
|
|
997
|
+
"strapi_stage",
|
|
998
|
+
"strapi_stage.name",
|
|
999
|
+
"strapiStage",
|
|
1000
|
+
"Strapi Stage",
|
|
1001
|
+
"strapi-stage",
|
|
1002
|
+
"stage",
|
|
1003
|
+
"Stage",
|
|
1004
|
+
"review_stage"
|
|
1005
|
+
];
|
|
1006
|
+
for (const prop of candidateProps) {
|
|
1007
|
+
if (val[prop] !== void 0 && val[prop] !== null) {
|
|
1008
|
+
const fromProp = extractStageName(val[prop]);
|
|
1009
|
+
if (fromProp) return fromProp;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
return String(val.name || val.title || val.status || val.label || "").trim();
|
|
1013
|
+
}
|
|
1014
|
+
if (typeof val === "string") {
|
|
1015
|
+
const trimmed = val.trim();
|
|
1016
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
|
|
1017
|
+
try {
|
|
1018
|
+
const parsed = JSON.parse(trimmed);
|
|
1019
|
+
if (parsed && typeof parsed === "object") {
|
|
1020
|
+
const fromParsed = String(parsed.name || parsed.title || parsed.status || parsed.label || "").trim();
|
|
1021
|
+
if (fromParsed) return fromParsed;
|
|
1022
|
+
}
|
|
1023
|
+
} catch {
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return trimmed;
|
|
1027
|
+
}
|
|
1028
|
+
return String(val).trim();
|
|
1029
|
+
}
|
|
1030
|
+
function isStageApproved(stageVal) {
|
|
1031
|
+
const name = extractStageName(stageVal);
|
|
1032
|
+
return name.toLowerCase() === "approved";
|
|
1033
|
+
}
|
|
1034
|
+
function isStageEditingOrPending(stageVal) {
|
|
1035
|
+
const name = extractStageName(stageVal).toLowerCase();
|
|
1036
|
+
return name === "editing" || name === "in review" || name === "in_review" || name === "pending review" || name === "pending_review";
|
|
1037
|
+
}
|
|
1038
|
+
function inspectPreUpdateStatus(entry) {
|
|
1039
|
+
if (!entry || typeof entry !== "object") {
|
|
1040
|
+
return { hadPublishedVersion: false, isModified: false };
|
|
1041
|
+
}
|
|
1042
|
+
const isModified = entry.status === "modified";
|
|
1043
|
+
const isPublished = entry.status === "published" || Boolean(entry.publishedAt);
|
|
1044
|
+
const hadPublishedVersion = isModified || isPublished;
|
|
1045
|
+
return { hadPublishedVersion, isModified };
|
|
1046
|
+
}
|
|
1047
|
+
function determineShouldPublish({
|
|
1048
|
+
isDraftAndPublish,
|
|
1049
|
+
hadPublishedVersion,
|
|
1050
|
+
isModified = false,
|
|
1051
|
+
stageValue,
|
|
1052
|
+
publish = true,
|
|
1053
|
+
publishStrategy = "safe",
|
|
1054
|
+
unreviewedConsent = false
|
|
1055
|
+
}) {
|
|
1056
|
+
if (!isDraftAndPublish || !publish) {
|
|
1057
|
+
return false;
|
|
1058
|
+
}
|
|
1059
|
+
if (!hadPublishedVersion) {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
const isApproved = isStageApproved(stageValue);
|
|
1063
|
+
const isEditingOrPending = isStageEditingOrPending(stageValue);
|
|
1064
|
+
if (isApproved) {
|
|
1065
|
+
return true;
|
|
1066
|
+
}
|
|
1067
|
+
if (isEditingOrPending) {
|
|
1068
|
+
return false;
|
|
1069
|
+
}
|
|
1070
|
+
if (publishStrategy === "all" || unreviewedConsent) {
|
|
1071
|
+
return true;
|
|
1072
|
+
}
|
|
1073
|
+
return hadPublishedVersion && !isModified;
|
|
1074
|
+
}
|
|
993
1075
|
async function populateDocumentLifecycleStatus(strapi, uid, entries) {
|
|
994
1076
|
if (!entries || !Array.isArray(entries) || entries.length === 0) {
|
|
995
1077
|
return entries;
|
|
@@ -1633,9 +1715,14 @@ async function executeBatchInternal(strapi, {
|
|
|
1633
1715
|
const getDocumentDeduplicated = (uid, documentId) => {
|
|
1634
1716
|
const loaderKey = `${uid}@@@${documentId}`;
|
|
1635
1717
|
if (!documentLoader.has(loaderKey)) {
|
|
1718
|
+
const ct = strapi.contentTypes[uid];
|
|
1719
|
+
const findOneArgs = { documentId };
|
|
1720
|
+
if (ct?.attributes?.strapi_stage) {
|
|
1721
|
+
findOneArgs.populate = ["strapi_stage"];
|
|
1722
|
+
}
|
|
1636
1723
|
documentLoader.set(
|
|
1637
1724
|
loaderKey,
|
|
1638
|
-
strapi.documents(uid).findOne(
|
|
1725
|
+
strapi.documents(uid).findOne(findOneArgs)
|
|
1639
1726
|
);
|
|
1640
1727
|
}
|
|
1641
1728
|
return documentLoader.get(loaderKey);
|
|
@@ -1693,13 +1780,24 @@ async function executeBatchInternal(strapi, {
|
|
|
1693
1780
|
}
|
|
1694
1781
|
});
|
|
1695
1782
|
const isDraftAndPublishComp = Boolean(contentType?.options?.draftAndPublish);
|
|
1696
|
-
const
|
|
1697
|
-
const
|
|
1783
|
+
const { hadPublishedVersion: hadPubComp, isModified: isModComp } = inspectPreUpdateStatus(currentEntry);
|
|
1784
|
+
const targetStageComp = attribute.toLowerCase() === "strapi_stage" || attribute.toLowerCase() === "stage" ? value : currentEntry?.strapi_stage ?? currentEntry?.stage ?? target?.strapi_stage ?? target?.stage;
|
|
1785
|
+
const shouldPublishComp = determineShouldPublish({
|
|
1786
|
+
isDraftAndPublish: isDraftAndPublishComp,
|
|
1787
|
+
hadPublishedVersion: hadPubComp,
|
|
1788
|
+
isModified: isModComp,
|
|
1789
|
+
stageValue: targetStageComp,
|
|
1790
|
+
publish: Boolean(publishOnApproval),
|
|
1791
|
+
publishStrategy,
|
|
1792
|
+
unreviewedConsent
|
|
1793
|
+
});
|
|
1698
1794
|
if (shouldPublishComp) {
|
|
1699
1795
|
try {
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1796
|
+
const pubArgs = { documentId: target.documentId };
|
|
1797
|
+
if (target.locale || currentEntry?.locale) {
|
|
1798
|
+
pubArgs.locale = target.locale || currentEntry?.locale;
|
|
1799
|
+
}
|
|
1800
|
+
await strapi.documents(target.uid).publish(pubArgs);
|
|
1703
1801
|
} catch (publishErr) {
|
|
1704
1802
|
strapi.log.warn(`[bulk-updater] Failed to auto-publish ${target.uid}/${target.documentId}:`, publishErr);
|
|
1705
1803
|
}
|
|
@@ -1709,7 +1807,7 @@ async function executeBatchInternal(strapi, {
|
|
|
1709
1807
|
uid: target.uid,
|
|
1710
1808
|
documentId: target.documentId,
|
|
1711
1809
|
userId: currentUser?.id,
|
|
1712
|
-
statusOverride: shouldPublishComp ? "published" : isDraftAndPublishComp ? "draft" : void 0
|
|
1810
|
+
statusOverride: shouldPublishComp ? "published" : isDraftAndPublishComp ? hadPubComp ? "modified" : "draft" : void 0
|
|
1713
1811
|
});
|
|
1714
1812
|
const dzDiffs = isRootDz && affectedMatches.length > 0 ? affectedMatches.map((m) => ({
|
|
1715
1813
|
index: m.index,
|
|
@@ -1792,13 +1890,24 @@ async function executeBatchInternal(strapi, {
|
|
|
1792
1890
|
}
|
|
1793
1891
|
});
|
|
1794
1892
|
const isDraftAndPublishRel = Boolean(contentType?.options?.draftAndPublish);
|
|
1795
|
-
const
|
|
1796
|
-
const
|
|
1893
|
+
const { hadPublishedVersion: hadPubRel, isModified: isModRel } = inspectPreUpdateStatus(currentEntry);
|
|
1894
|
+
const targetStageRel = attribute.toLowerCase() === "strapi_stage" || attribute.toLowerCase() === "stage" ? value : currentEntry?.strapi_stage ?? currentEntry?.stage ?? target?.strapi_stage ?? target?.stage;
|
|
1895
|
+
const shouldPublishRel = determineShouldPublish({
|
|
1896
|
+
isDraftAndPublish: isDraftAndPublishRel,
|
|
1897
|
+
hadPublishedVersion: hadPubRel,
|
|
1898
|
+
isModified: isModRel,
|
|
1899
|
+
stageValue: targetStageRel,
|
|
1900
|
+
publish: Boolean(publishOnApproval),
|
|
1901
|
+
publishStrategy,
|
|
1902
|
+
unreviewedConsent
|
|
1903
|
+
});
|
|
1797
1904
|
if (shouldPublishRel) {
|
|
1798
1905
|
try {
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1906
|
+
const pubArgs = { documentId: target.documentId };
|
|
1907
|
+
if (target.locale || currentEntry?.locale) {
|
|
1908
|
+
pubArgs.locale = target.locale || currentEntry?.locale;
|
|
1909
|
+
}
|
|
1910
|
+
await strapi.documents(target.uid).publish(pubArgs);
|
|
1802
1911
|
} catch (publishErr) {
|
|
1803
1912
|
strapi.log.warn(`[bulk-updater] Failed to auto-publish ${target.uid}/${target.documentId}:`, publishErr);
|
|
1804
1913
|
}
|
|
@@ -1811,7 +1920,7 @@ async function executeBatchInternal(strapi, {
|
|
|
1811
1920
|
uid: target.uid,
|
|
1812
1921
|
documentId: target.documentId,
|
|
1813
1922
|
userId: currentUser?.id,
|
|
1814
|
-
statusOverride: shouldPublishRel ? "published" : isDraftAndPublishRel ? "draft" : void 0
|
|
1923
|
+
statusOverride: shouldPublishRel ? "published" : isDraftAndPublishRel ? hadPubRel ? "modified" : "draft" : void 0
|
|
1815
1924
|
});
|
|
1816
1925
|
return {
|
|
1817
1926
|
uid: target.uid,
|
|
@@ -1837,13 +1946,24 @@ async function executeBatchInternal(strapi, {
|
|
|
1837
1946
|
}
|
|
1838
1947
|
});
|
|
1839
1948
|
const isDraftAndPublishScalar = Boolean(contentType?.options?.draftAndPublish);
|
|
1840
|
-
const
|
|
1841
|
-
const
|
|
1949
|
+
const { hadPublishedVersion: hadPubScalar, isModified: isModScalar } = inspectPreUpdateStatus(currentEntry);
|
|
1950
|
+
const targetStageScalar = attribute.toLowerCase() === "strapi_stage" || attribute.toLowerCase() === "stage" ? value : currentEntry?.strapi_stage ?? currentEntry?.stage ?? target?.strapi_stage ?? target?.stage;
|
|
1951
|
+
const shouldPublishScalar = determineShouldPublish({
|
|
1952
|
+
isDraftAndPublish: isDraftAndPublishScalar,
|
|
1953
|
+
hadPublishedVersion: hadPubScalar,
|
|
1954
|
+
isModified: isModScalar,
|
|
1955
|
+
stageValue: targetStageScalar,
|
|
1956
|
+
publish: Boolean(publishOnApproval),
|
|
1957
|
+
publishStrategy,
|
|
1958
|
+
unreviewedConsent
|
|
1959
|
+
});
|
|
1842
1960
|
if (shouldPublishScalar) {
|
|
1843
1961
|
try {
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1962
|
+
const pubArgs = { documentId: target.documentId };
|
|
1963
|
+
if (target.locale || currentEntry?.locale) {
|
|
1964
|
+
pubArgs.locale = target.locale || currentEntry?.locale;
|
|
1965
|
+
}
|
|
1966
|
+
await strapi.documents(target.uid).publish(pubArgs);
|
|
1847
1967
|
} catch (publishErr) {
|
|
1848
1968
|
strapi.log.warn(`[bulk-updater] Failed to auto-publish ${target.uid}/${target.documentId}:`, publishErr);
|
|
1849
1969
|
}
|
|
@@ -1852,7 +1972,7 @@ async function executeBatchInternal(strapi, {
|
|
|
1852
1972
|
uid: target.uid,
|
|
1853
1973
|
documentId: target.documentId,
|
|
1854
1974
|
userId: currentUser?.id,
|
|
1855
|
-
statusOverride: shouldPublishScalar ? "published" : isDraftAndPublishScalar ? "draft" : void 0
|
|
1975
|
+
statusOverride: shouldPublishScalar ? "published" : isDraftAndPublishScalar ? hadPubScalar ? "modified" : "draft" : void 0
|
|
1856
1976
|
});
|
|
1857
1977
|
return {
|
|
1858
1978
|
uid: target.uid,
|
|
@@ -5260,6 +5380,10 @@ function isRowInEditingStage(row) {
|
|
|
5260
5380
|
}
|
|
5261
5381
|
return false;
|
|
5262
5382
|
}
|
|
5383
|
+
function isRowInApprovedStage(row) {
|
|
5384
|
+
if (!row || typeof row !== "object") return false;
|
|
5385
|
+
return isStageApproved(row);
|
|
5386
|
+
}
|
|
5263
5387
|
function extractDetailedErrorMessage(err) {
|
|
5264
5388
|
if (!err) return "Error processing row";
|
|
5265
5389
|
const detailsErrors = err.details?.errors || err.error?.details?.errors;
|
|
@@ -5456,6 +5580,7 @@ async function findExistingDocument(strapi, uid, targetDocId, docLocale) {
|
|
|
5456
5580
|
try {
|
|
5457
5581
|
const queryArgs = { documentId: targetDocId };
|
|
5458
5582
|
if (effectiveLocale) queryArgs.locale = effectiveLocale;
|
|
5583
|
+
if (ct?.attributes?.strapi_stage) queryArgs.populate = ["strapi_stage"];
|
|
5459
5584
|
const found = await strapi.documents(uid).findOne(queryArgs);
|
|
5460
5585
|
if (found) return found;
|
|
5461
5586
|
} catch {
|
|
@@ -5902,8 +6027,17 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
5902
6027
|
};
|
|
5903
6028
|
if (effectiveLocale) updateArgs.locale = effectiveLocale;
|
|
5904
6029
|
await strapi.documents(uid).update(updateArgs);
|
|
5905
|
-
const
|
|
5906
|
-
const
|
|
6030
|
+
const { hadPublishedVersion, isModified } = inspectPreUpdateStatus(existing);
|
|
6031
|
+
const stageVal = row.strapi_stage ?? row["strapi_stage"] ?? row.stage ?? existing?.strapi_stage;
|
|
6032
|
+
const shouldPublish = determineShouldPublish({
|
|
6033
|
+
isDraftAndPublish,
|
|
6034
|
+
hadPublishedVersion,
|
|
6035
|
+
isModified,
|
|
6036
|
+
stageValue: stageVal,
|
|
6037
|
+
publish: Boolean(publish),
|
|
6038
|
+
publishStrategy,
|
|
6039
|
+
unreviewedConsent: options.unreviewedConsent
|
|
6040
|
+
});
|
|
5907
6041
|
if (shouldPublish) {
|
|
5908
6042
|
try {
|
|
5909
6043
|
const pubArgs = { documentId: resolvedDocId };
|
|
@@ -5918,7 +6052,7 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
5918
6052
|
uid,
|
|
5919
6053
|
documentId: resolvedDocId,
|
|
5920
6054
|
userId: user?.id,
|
|
5921
|
-
statusOverride: shouldPublish ? "published" : isDraftAndPublish ?
|
|
6055
|
+
statusOverride: shouldPublish ? "published" : isDraftAndPublish ? hadPublishedVersion ? "modified" : "draft" : void 0
|
|
5922
6056
|
});
|
|
5923
6057
|
} catch {
|
|
5924
6058
|
}
|
|
@@ -5957,8 +6091,17 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
5957
6091
|
};
|
|
5958
6092
|
if (effectiveLocale) updateArgs.locale = effectiveLocale;
|
|
5959
6093
|
await strapi.documents(uid).update(updateArgs);
|
|
5960
|
-
const
|
|
5961
|
-
const
|
|
6094
|
+
const { hadPublishedVersion, isModified } = inspectPreUpdateStatus(existing);
|
|
6095
|
+
const stageVal = row.strapi_stage ?? row["strapi_stage"] ?? row.stage ?? existing?.strapi_stage;
|
|
6096
|
+
const shouldPublish = determineShouldPublish({
|
|
6097
|
+
isDraftAndPublish,
|
|
6098
|
+
hadPublishedVersion,
|
|
6099
|
+
isModified,
|
|
6100
|
+
stageValue: stageVal,
|
|
6101
|
+
publish: Boolean(publish),
|
|
6102
|
+
publishStrategy,
|
|
6103
|
+
unreviewedConsent: options.unreviewedConsent
|
|
6104
|
+
});
|
|
5962
6105
|
if (shouldPublish) {
|
|
5963
6106
|
try {
|
|
5964
6107
|
const pubArgs = { documentId: resolvedDocId };
|
|
@@ -5973,7 +6116,7 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
5973
6116
|
uid,
|
|
5974
6117
|
documentId: resolvedDocId,
|
|
5975
6118
|
userId: user?.id,
|
|
5976
|
-
statusOverride: shouldPublish ? "published" : isDraftAndPublish ?
|
|
6119
|
+
statusOverride: shouldPublish ? "published" : isDraftAndPublish ? hadPublishedVersion ? "modified" : "draft" : void 0
|
|
5977
6120
|
});
|
|
5978
6121
|
} catch {
|
|
5979
6122
|
}
|
|
@@ -5999,7 +6142,8 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
5999
6142
|
if (effectiveLocale) createArgs.locale = effectiveLocale;
|
|
6000
6143
|
const created = await strapi.documents(uid).create(createArgs);
|
|
6001
6144
|
const newDocId = created?.documentId || docId;
|
|
6002
|
-
const
|
|
6145
|
+
const isApprovedStage = isRowInApprovedStage(row);
|
|
6146
|
+
const shouldPublishNew = !isEditing && !isApprovedStage && isDraftAndPublish && Boolean(publish) && (publishStrategy === "all" || options.unreviewedConsent ? true : false);
|
|
6003
6147
|
if (shouldPublishNew && newDocId) {
|
|
6004
6148
|
try {
|
|
6005
6149
|
const pubArgs = { documentId: newDocId };
|
|
@@ -6054,8 +6198,17 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
6054
6198
|
};
|
|
6055
6199
|
if (effectiveLocale) updateArgs.locale = effectiveLocale;
|
|
6056
6200
|
await strapi.documents(uid).update(updateArgs);
|
|
6057
|
-
const
|
|
6058
|
-
const
|
|
6201
|
+
const { hadPublishedVersion, isModified } = inspectPreUpdateStatus(existing);
|
|
6202
|
+
const stageVal = row.strapi_stage ?? row["strapi_stage"] ?? row.stage ?? existing?.strapi_stage;
|
|
6203
|
+
const shouldPublish = determineShouldPublish({
|
|
6204
|
+
isDraftAndPublish,
|
|
6205
|
+
hadPublishedVersion,
|
|
6206
|
+
isModified,
|
|
6207
|
+
stageValue: stageVal,
|
|
6208
|
+
publish: Boolean(publish),
|
|
6209
|
+
publishStrategy,
|
|
6210
|
+
unreviewedConsent: options.unreviewedConsent
|
|
6211
|
+
});
|
|
6059
6212
|
if (shouldPublish) {
|
|
6060
6213
|
try {
|
|
6061
6214
|
const pubArgs = { documentId: resolvedDocId };
|
|
@@ -6070,7 +6223,7 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
6070
6223
|
uid,
|
|
6071
6224
|
documentId: resolvedDocId,
|
|
6072
6225
|
userId: user?.id,
|
|
6073
|
-
statusOverride: shouldPublish ? "published" : isDraftAndPublish ?
|
|
6226
|
+
statusOverride: shouldPublish ? "published" : isDraftAndPublish ? hadPublishedVersion ? "modified" : "draft" : void 0
|
|
6074
6227
|
});
|
|
6075
6228
|
} catch {
|
|
6076
6229
|
}
|
|
@@ -6096,7 +6249,8 @@ async function processCsvRows(strapi, ct, uid, rows, startRowNumber, options) {
|
|
|
6096
6249
|
if (effectiveLocale) createArgs.locale = effectiveLocale;
|
|
6097
6250
|
const created = await strapi.documents(uid).create(createArgs);
|
|
6098
6251
|
const newDocId = created?.documentId || docId;
|
|
6099
|
-
const
|
|
6252
|
+
const isApprovedStage = isRowInApprovedStage(row);
|
|
6253
|
+
const shouldPublishNew = !isEditing && !isApprovedStage && isDraftAndPublish && Boolean(publish) && (publishStrategy === "all" || options.unreviewedConsent ? true : false);
|
|
6100
6254
|
if (shouldPublishNew && newDocId) {
|
|
6101
6255
|
try {
|
|
6102
6256
|
const pubArgs = { documentId: newDocId };
|
|
@@ -6696,7 +6850,7 @@ const csvService = ({ strapi }) => ({
|
|
|
6696
6850
|
const docId = extractDocId(row);
|
|
6697
6851
|
const rowLocale = extractLocale(row);
|
|
6698
6852
|
const effectiveLocale = getEffectiveLocale(ct, rowLocale);
|
|
6699
|
-
|
|
6853
|
+
isRowInEditingStage(row);
|
|
6700
6854
|
let rowHasError = false;
|
|
6701
6855
|
let existing = null;
|
|
6702
6856
|
if (docId) {
|
|
@@ -6704,15 +6858,27 @@ const csvService = ({ strapi }) => ({
|
|
|
6704
6858
|
}
|
|
6705
6859
|
if (existing && isDraftAndPublish) {
|
|
6706
6860
|
lifecycleStats.totalChecked++;
|
|
6707
|
-
const
|
|
6708
|
-
|
|
6861
|
+
const { hadPublishedVersion, isModified } = inspectPreUpdateStatus(existing);
|
|
6862
|
+
const stageVal = row.strapi_stage ?? row["strapi_stage"] ?? row.stage ?? existing?.strapi_stage;
|
|
6863
|
+
const willPublish = determineShouldPublish({
|
|
6864
|
+
isDraftAndPublish,
|
|
6865
|
+
hadPublishedVersion,
|
|
6866
|
+
isModified,
|
|
6867
|
+
stageValue: stageVal,
|
|
6868
|
+
publish: true,
|
|
6869
|
+
publishStrategy: options.publishStrategy || "safe",
|
|
6870
|
+
unreviewedConsent: options.unreviewedConsent
|
|
6871
|
+
});
|
|
6872
|
+
if (willPublish) {
|
|
6709
6873
|
lifecycleStats.published++;
|
|
6710
|
-
} else if (
|
|
6874
|
+
} else if (hadPublishedVersion && (isModified || isRowInEditingStage(row))) {
|
|
6711
6875
|
lifecycleStats.modified++;
|
|
6712
6876
|
lifecycleStats.unreviewedCount++;
|
|
6713
|
-
} else {
|
|
6877
|
+
} else if (!hadPublishedVersion) {
|
|
6714
6878
|
lifecycleStats.draft++;
|
|
6715
6879
|
lifecycleStats.unreviewedCount++;
|
|
6880
|
+
} else {
|
|
6881
|
+
lifecycleStats.published++;
|
|
6716
6882
|
}
|
|
6717
6883
|
}
|
|
6718
6884
|
if (mode === "update") {
|