strapi-plugin-bulk-updater 1.2.10 → 1.2.11

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.
@@ -10,7 +10,7 @@ const index = {
10
10
  id: `${PLUGIN_ID}.plugin.name`,
11
11
  defaultMessage: "Bulk Attribute Updater"
12
12
  },
13
- Component: () => Promise.resolve().then(() => require("../_chunks/BulkUpdater-EI4sKaLN.js")),
13
+ Component: () => Promise.resolve().then(() => require("../_chunks/BulkUpdater-DS6gm_qd.js")),
14
14
  permissions: [],
15
15
  position: 3
16
16
  });
@@ -9,7 +9,7 @@ const index = {
9
9
  id: `${PLUGIN_ID}.plugin.name`,
10
10
  defaultMessage: "Bulk Attribute Updater"
11
11
  },
12
- Component: () => import("../_chunks/BulkUpdater-Cg9utqzm.mjs"),
12
+ Component: () => import("../_chunks/BulkUpdater-B_COVQmo.mjs"),
13
13
  permissions: [],
14
14
  position: 3
15
15
  });
@@ -294,10 +294,6 @@ const bulkUpdaterController = ({ strapi: strapi2 }) => ({
294
294
  if (data?.etag) {
295
295
  ctx.set("ETag", data.etag);
296
296
  ctx.set("Cache-Control", "private, no-cache");
297
- if (ctx.request.headers["if-none-match"] === data.etag) {
298
- ctx.status = 304;
299
- return;
300
- }
301
297
  }
302
298
  ctx.body = data;
303
299
  } catch (err) {
@@ -323,10 +319,6 @@ const bulkUpdaterController = ({ strapi: strapi2 }) => ({
323
319
  if (data?.etag) {
324
320
  ctx.set("ETag", data.etag);
325
321
  ctx.set("Cache-Control", "private, no-cache");
326
- if (ctx.request.headers["if-none-match"] === data.etag) {
327
- ctx.status = 304;
328
- return;
329
- }
330
322
  }
331
323
  ctx.body = { success: true, ...data };
332
324
  } catch (err) {
@@ -1403,10 +1395,12 @@ const bulkUpdaterService = ({ strapi: strapi2 }) => {
1403
1395
  }
1404
1396
  let condition = void 0;
1405
1397
  const q = (filterQuery || "").trim();
1398
+ const targetAttrSchema = isNestedAttr ? strapi2.components[attrs[parentKey]?.component]?.attributes?.[childKey] : attrs[attribute];
1399
+ const isStringLike = ["string", "text", "email", "richtext", "uid"].includes(targetAttrSchema?.type);
1406
1400
  if (normOp === "empty") {
1407
- condition = { $or: [{ $null: true }, { $eq: "" }] };
1401
+ condition = isStringLike ? { $or: [{ $null: true }, { $eq: "" }] } : { $null: true };
1408
1402
  } else if (normOp === "notempty") {
1409
- condition = { $and: [{ $notNull: true }, { $ne: "" }] };
1403
+ condition = isStringLike ? { $and: [{ $notNull: true }, { $ne: "" }] } : { $notNull: true };
1410
1404
  } else if (q !== "") {
1411
1405
  switch (normOp) {
1412
1406
  case "equals":
@@ -1435,12 +1429,12 @@ const bulkUpdaterService = ({ strapi: strapi2 }) => {
1435
1429
  [childKey]: condition
1436
1430
  };
1437
1431
  } else {
1438
- if (normOp === "empty") {
1432
+ if (normOp === "empty" && isStringLike) {
1439
1433
  filters2.$or = [
1440
1434
  { [attribute]: { $null: true } },
1441
1435
  { [attribute]: { $eq: "" } }
1442
1436
  ];
1443
- } else if (normOp === "notempty") {
1437
+ } else if (normOp === "notempty" && isStringLike) {
1444
1438
  filters2[attribute] = { $notNull: true, $ne: "" };
1445
1439
  } else {
1446
1440
  filters2[attribute] = condition;