@fourlights/strapi-plugin-deep-populate 1.9.1 → 1.9.3

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.
@@ -18418,6 +18418,12 @@ async function removeDeepPopulateCacheFullTextIndex(db, tableName, columnName) {
18418
18418
  console.log(`Full-text index not supported for this database engine (${client})`);
18419
18419
  }
18420
18420
  }
18421
+ function asBoolean(value) {
18422
+ if (typeof value === "boolean") return value;
18423
+ if (!value) return false;
18424
+ const normalized = value.toLowerCase().trim();
18425
+ return normalized !== "false" && normalized !== "0";
18426
+ }
18421
18427
  const populateIsWildcardEquivalent = async ({
18422
18428
  strapi: strapi2,
18423
18429
  schema: schema2,
@@ -18456,6 +18462,7 @@ const register = async ({ strapi: strapi2 }) => {
18456
18462
  const populateService = strapi2.plugin("deep-populate").service("populate");
18457
18463
  const cacheService = strapi2.plugin("deep-populate").service("cache");
18458
18464
  const { populate: populate2 } = context.params;
18465
+ const bustCache = asBoolean(context.params.bustCache);
18459
18466
  const returnDeeplyPopulated = replaceWildcard && await populateIsWildcardEquivalent({ strapi: strapi2, schema: context.contentType, populate: populate2 });
18460
18467
  if (has__default.default(populate2, "__deepPopulated")) unset__default.default(populate2, "__deepPopulated");
18461
18468
  if (useCache && context.action === "delete")
@@ -18484,7 +18491,7 @@ const register = async ({ strapi: strapi2 }) => {
18484
18491
  documentId,
18485
18492
  status,
18486
18493
  locale: locale2,
18487
- bustCache: context.params.bustCache
18494
+ bustCache
18488
18495
  });
18489
18496
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18490
18497
  }
@@ -18497,7 +18504,7 @@ const register = async ({ strapi: strapi2 }) => {
18497
18504
  documentId,
18498
18505
  status,
18499
18506
  locale: locale2,
18500
- bustCache: context.params.bustCache
18507
+ bustCache
18501
18508
  });
18502
18509
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18503
18510
  })
@@ -18766,7 +18773,7 @@ async function _populate({
18766
18773
  continue;
18767
18774
  }
18768
18775
  if (__deny?.relations?.includes(attr.target)) {
18769
- newPopulate[attrName] = true;
18776
+ newPopulate[attrName] = false;
18770
18777
  continue;
18771
18778
  }
18772
18779
  }
@@ -18776,7 +18783,7 @@ async function _populate({
18776
18783
  continue;
18777
18784
  }
18778
18785
  if (__deny?.components?.includes(attr.component)) {
18779
- newPopulate[attrName] = true;
18786
+ newPopulate[attrName] = false;
18780
18787
  continue;
18781
18788
  }
18782
18789
  }
@@ -18391,6 +18391,12 @@ async function removeDeepPopulateCacheFullTextIndex(db, tableName, columnName) {
18391
18391
  console.log(`Full-text index not supported for this database engine (${client})`);
18392
18392
  }
18393
18393
  }
18394
+ function asBoolean(value) {
18395
+ if (typeof value === "boolean") return value;
18396
+ if (!value) return false;
18397
+ const normalized = value.toLowerCase().trim();
18398
+ return normalized !== "false" && normalized !== "0";
18399
+ }
18394
18400
  const populateIsWildcardEquivalent = async ({
18395
18401
  strapi: strapi2,
18396
18402
  schema: schema2,
@@ -18429,6 +18435,7 @@ const register = async ({ strapi: strapi2 }) => {
18429
18435
  const populateService = strapi2.plugin("deep-populate").service("populate");
18430
18436
  const cacheService = strapi2.plugin("deep-populate").service("cache");
18431
18437
  const { populate: populate2 } = context.params;
18438
+ const bustCache = asBoolean(context.params.bustCache);
18432
18439
  const returnDeeplyPopulated = replaceWildcard && await populateIsWildcardEquivalent({ strapi: strapi2, schema: context.contentType, populate: populate2 });
18433
18440
  if (has(populate2, "__deepPopulated")) unset(populate2, "__deepPopulated");
18434
18441
  if (useCache && context.action === "delete")
@@ -18457,7 +18464,7 @@ const register = async ({ strapi: strapi2 }) => {
18457
18464
  documentId,
18458
18465
  status,
18459
18466
  locale: locale2,
18460
- bustCache: context.params.bustCache
18467
+ bustCache
18461
18468
  });
18462
18469
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18463
18470
  }
@@ -18470,7 +18477,7 @@ const register = async ({ strapi: strapi2 }) => {
18470
18477
  documentId,
18471
18478
  status,
18472
18479
  locale: locale2,
18473
- bustCache: context.params.bustCache
18480
+ bustCache
18474
18481
  });
18475
18482
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18476
18483
  })
@@ -18739,7 +18746,7 @@ async function _populate({
18739
18746
  continue;
18740
18747
  }
18741
18748
  if (__deny?.relations?.includes(attr.target)) {
18742
- newPopulate[attrName] = true;
18749
+ newPopulate[attrName] = false;
18743
18750
  continue;
18744
18751
  }
18745
18752
  }
@@ -18749,7 +18756,7 @@ async function _populate({
18749
18756
  continue;
18750
18757
  }
18751
18758
  if (__deny?.components?.includes(attr.component)) {
18752
- newPopulate[attrName] = true;
18759
+ newPopulate[attrName] = false;
18753
18760
  continue;
18754
18761
  }
18755
18762
  }
@@ -0,0 +1 @@
1
+ export declare function asBoolean(value: string | boolean | null | undefined): value is Exclude<string | boolean, "" | "false" | "0" | false>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.1",
2
+ "version": "1.9.3",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",