strapi-plugin-bulk-updater 1.2.7 → 1.2.9
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/{BulkUpdater-DR8Z9z95.mjs → BulkUpdater-NpSxrH3b.mjs} +64 -23
- package/dist/_chunks/BulkUpdater-NpSxrH3b.mjs.map +1 -0
- package/dist/_chunks/{BulkUpdater-2TTEWMXI.js → BulkUpdater-Q4rX3L5w.js} +64 -23
- package/dist/_chunks/BulkUpdater-Q4rX3L5w.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +53 -12
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +53 -12
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/BulkUpdater-2TTEWMXI.js.map +0 -1
- package/dist/_chunks/BulkUpdater-DR8Z9z95.mjs.map +0 -1
package/dist/server/index.mjs
CHANGED
|
@@ -2192,6 +2192,33 @@ const auditService = ({ strapi: strapi2 }) => ({
|
|
|
2192
2192
|
isEnterpriseNativeAvailable: false
|
|
2193
2193
|
};
|
|
2194
2194
|
},
|
|
2195
|
+
/**
|
|
2196
|
+
* Checks whether audit logging is enabled.
|
|
2197
|
+
*/
|
|
2198
|
+
isAuditEnabled() {
|
|
2199
|
+
const config = this.getAuditConfig();
|
|
2200
|
+
return Boolean(config && config.enabled);
|
|
2201
|
+
},
|
|
2202
|
+
/**
|
|
2203
|
+
* Convenience alias to log an operation into the audit trail.
|
|
2204
|
+
*/
|
|
2205
|
+
async logOperation(data) {
|
|
2206
|
+
return this.recordBatch(
|
|
2207
|
+
{
|
|
2208
|
+
batchId: data.batchId,
|
|
2209
|
+
attribute: data.attribute,
|
|
2210
|
+
value: data.value,
|
|
2211
|
+
updatedCount: data.updatedCount,
|
|
2212
|
+
skippedCount: data.skippedCount,
|
|
2213
|
+
totalTargets: data.totalTargets
|
|
2214
|
+
},
|
|
2215
|
+
data.diffs || [],
|
|
2216
|
+
{
|
|
2217
|
+
email: data.userEmail,
|
|
2218
|
+
firstname: data.userName
|
|
2219
|
+
}
|
|
2220
|
+
);
|
|
2221
|
+
},
|
|
2195
2222
|
/**
|
|
2196
2223
|
* Optionally writes an audit event directly to Strapi Enterprise's native Audit Logs table.
|
|
2197
2224
|
*/
|
|
@@ -3350,18 +3377,32 @@ ${sampleRow.map(escapeCsvValue).join(",")}
|
|
|
3350
3377
|
if (stats.updated > 0 || stats.created > 0) {
|
|
3351
3378
|
try {
|
|
3352
3379
|
const auditService2 = strapi2.plugin("bulk-updater").service("audit");
|
|
3353
|
-
if (auditService2
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3380
|
+
if (auditService2) {
|
|
3381
|
+
const isEnabled = typeof auditService2.isAuditEnabled === "function" ? auditService2.isAuditEnabled() : Boolean(auditService2.getAuditConfig?.().enabled ?? true);
|
|
3382
|
+
if (isEnabled) {
|
|
3383
|
+
const batchSummary = {
|
|
3384
|
+
batchId,
|
|
3385
|
+
attribute: "CSV_IMPORT",
|
|
3386
|
+
value: `Mode: ${mode2} (${stats.created} created, ${stats.updated} updated)`,
|
|
3387
|
+
updatedCount: stats.updated + stats.created,
|
|
3388
|
+
skippedCount: stats.skipped,
|
|
3389
|
+
totalTargets: stats.total
|
|
3390
|
+
};
|
|
3391
|
+
const userObj = {
|
|
3392
|
+
email: userEmail || "admin@strapi.io",
|
|
3393
|
+
firstname: userName || "Admin"
|
|
3394
|
+
};
|
|
3395
|
+
if (typeof auditService2.recordBatch === "function") {
|
|
3396
|
+
await auditService2.recordBatch(batchSummary, stats.diffs, userObj);
|
|
3397
|
+
} else if (typeof auditService2.logOperation === "function") {
|
|
3398
|
+
await auditService2.logOperation({
|
|
3399
|
+
...batchSummary,
|
|
3400
|
+
userEmail,
|
|
3401
|
+
userName,
|
|
3402
|
+
diffs: stats.diffs
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3365
3406
|
}
|
|
3366
3407
|
} catch (auditErr) {
|
|
3367
3408
|
strapi2.log.warn("[bulk-updater] Failed logging CSV import audit:", auditErr);
|