@fourlights/strapi-plugin-deep-populate 1.7.0 → 1.8.0

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.
@@ -18477,14 +18477,26 @@ const register = async ({ strapi: strapi2 }) => {
18477
18477
  if (returnDeeplyPopulated && ["findOne", "findFirst"].includes(context.action)) {
18478
18478
  const { documentId, publishedAt, locale: locale2 } = result;
18479
18479
  const status = publishedAt !== null ? "published" : "draft";
18480
- const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
18480
+ const deepPopulate = await populateService.get({
18481
+ contentType: context.uid,
18482
+ documentId,
18483
+ status,
18484
+ locale: locale2,
18485
+ bustCache: context.params.bustCache
18486
+ });
18481
18487
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18482
18488
  }
18483
18489
  if (returnDeeplyPopulated && context.action === "findMany") {
18484
18490
  return await Promise.all(
18485
18491
  result.map(async ({ documentId, publishedAt, locale: locale2 }) => {
18486
18492
  const status = publishedAt !== null ? "published" : "draft";
18487
- const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
18493
+ const deepPopulate = await populateService.get({
18494
+ contentType: context.uid,
18495
+ documentId,
18496
+ status,
18497
+ locale: locale2,
18498
+ bustCache: context.params.bustCache
18499
+ });
18488
18500
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18489
18501
  })
18490
18502
  );
@@ -18828,7 +18840,7 @@ const populate = ({ strapi: strapi2 }) => ({
18828
18840
  const { useCache } = strapi2.config.get("plugin::deep-populate");
18829
18841
  if (!useCache) return (await populate$1(params)).populate;
18830
18842
  const cachedEntry = await strapi2.service("plugin::deep-populate.cache").get(params);
18831
- if (cachedEntry) return cachedEntry;
18843
+ if (cachedEntry && params.bustCache !== true) return cachedEntry;
18832
18844
  const resolved = await populate$1(params);
18833
18845
  await strapi2.service("plugin::deep-populate.cache").set({ ...params, ...resolved });
18834
18846
  return resolved.populate;
@@ -18451,14 +18451,26 @@ const register = async ({ strapi: strapi2 }) => {
18451
18451
  if (returnDeeplyPopulated && ["findOne", "findFirst"].includes(context.action)) {
18452
18452
  const { documentId, publishedAt, locale: locale2 } = result;
18453
18453
  const status = publishedAt !== null ? "published" : "draft";
18454
- const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
18454
+ const deepPopulate = await populateService.get({
18455
+ contentType: context.uid,
18456
+ documentId,
18457
+ status,
18458
+ locale: locale2,
18459
+ bustCache: context.params.bustCache
18460
+ });
18455
18461
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18456
18462
  }
18457
18463
  if (returnDeeplyPopulated && context.action === "findMany") {
18458
18464
  return await Promise.all(
18459
18465
  result.map(async ({ documentId, publishedAt, locale: locale2 }) => {
18460
18466
  const status = publishedAt !== null ? "published" : "draft";
18461
- const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
18467
+ const deepPopulate = await populateService.get({
18468
+ contentType: context.uid,
18469
+ documentId,
18470
+ status,
18471
+ locale: locale2,
18472
+ bustCache: context.params.bustCache
18473
+ });
18462
18474
  return await strapi2.documents(context.uid).findOne({ documentId, status, locale: locale2, fields: originalFields, populate: deepPopulate });
18463
18475
  })
18464
18476
  );
@@ -18802,7 +18814,7 @@ const populate = ({ strapi: strapi2 }) => ({
18802
18814
  const { useCache } = strapi2.config.get("plugin::deep-populate");
18803
18815
  if (!useCache) return (await populate$1(params)).populate;
18804
18816
  const cachedEntry = await strapi2.service("plugin::deep-populate.cache").get(params);
18805
- if (cachedEntry) return cachedEntry;
18817
+ if (cachedEntry && params.bustCache !== true) return cachedEntry;
18806
18818
  const resolved = await populate$1(params);
18807
18819
  await strapi2.service("plugin::deep-populate.cache").set({ ...params, ...resolved });
18808
18820
  return resolved.populate;
@@ -73,6 +73,7 @@ declare const _default: {
73
73
  contentType: import("@strapi/types/dist/uid").ContentType;
74
74
  documentId: string;
75
75
  omitEmpty?: boolean;
76
+ bustCache?: boolean;
76
77
  localizations?: boolean;
77
78
  } & {
78
79
  populate?: import("@strapi/types/dist/modules/documents/params/populate").Any<import("@strapi/types/dist/uid").ContentType>;
@@ -14,6 +14,7 @@ declare const _default: {
14
14
  contentType: import("@strapi/types/dist/uid").ContentType;
15
15
  documentId: string;
16
16
  omitEmpty?: boolean;
17
+ bustCache?: boolean;
17
18
  localizations?: boolean;
18
19
  } & {
19
20
  populate?: import("@strapi/types/dist/modules/documents/params/populate").Any<import("@strapi/types/dist/uid").ContentType>;
@@ -3,6 +3,7 @@ export type PopulateParams<TContentType extends UID.ContentType = UID.ContentTyp
3
3
  contentType: TContentType;
4
4
  documentId: string;
5
5
  omitEmpty?: boolean;
6
+ bustCache?: boolean;
6
7
  localizations?: boolean;
7
8
  };
8
9
  declare const _default: ({ strapi }: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0",
2
+ "version": "1.8.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",