@fourlights/strapi-plugin-deep-populate 1.14.0 → 1.15.0-rc.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.
@@ -632,9 +632,9 @@ function requireDist() {
632
632
  t2.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
633
633
  }, function(t2, n2, r) {
634
634
  var e = r(2), o = r(6), i = r(7), c = r(5), u = "prototype", s = function(t3, n3, r2) {
635
- var f, a, p, l = t3 & s.F, v = t3 & s.G, h = t3 & s.S, d = t3 & s.P, y = t3 & s.B, _ = t3 & s.W, x = v ? o : o[n3] || (o[n3] = {}), m = x[u], w = v ? e : h ? e[n3] : (e[n3] || {})[u];
635
+ var f2, a, p, l = t3 & s.F, v = t3 & s.G, h = t3 & s.S, d = t3 & s.P, y = t3 & s.B, _ = t3 & s.W, x = v ? o : o[n3] || (o[n3] = {}), m = x[u], w = v ? e : h ? e[n3] : (e[n3] || {})[u];
636
636
  v && (r2 = n3);
637
- for (f in r2) a = !l && w && void 0 !== w[f], a && f in x || (p = a ? w[f] : r2[f], x[f] = v && "function" != typeof w[f] ? r2[f] : y && a ? i(p, e) : _ && w[f] == p ? (function(t4) {
637
+ for (f2 in r2) a = !l && w && void 0 !== w[f2], a && f2 in x || (p = a ? w[f2] : r2[f2], x[f2] = v && "function" != typeof w[f2] ? r2[f2] : y && a ? i(p, e) : _ && w[f2] == p ? (function(t4) {
638
638
  var n4 = function(n5, r3, e2) {
639
639
  if (this instanceof t4) {
640
640
  switch (arguments.length) {
@@ -650,7 +650,7 @@ function requireDist() {
650
650
  return t4.apply(this, arguments);
651
651
  };
652
652
  return n4[u] = t4[u], n4;
653
- })(p) : d && "function" == typeof p ? i(Function.call, p) : p, d && ((x.virtual || (x.virtual = {}))[f] = p, t3 & s.R && m && !m[f] && c(m, f, p)));
653
+ })(p) : d && "function" == typeof p ? i(Function.call, p) : p, d && ((x.virtual || (x.virtual = {}))[f2] = p, t3 & s.R && m && !m[f2] && c(m, f2, p)));
654
654
  };
655
655
  s.F = 1, s.G = 2, s.S = 4, s.P = 8, s.B = 16, s.W = 32, s.U = 64, s.R = 128, t2.exports = s;
656
656
  }, function(t2, n2) {
@@ -670,11 +670,11 @@ function requireDist() {
670
670
  } }).a;
671
671
  });
672
672
  }, function(t2, n2, r) {
673
- var e = r(28), o = r(23), i = r(57), c = r(5), u = r(8), s = r(10), f = r(45), a = r(18), p = r(52), l = r(1)("iterator"), v = !([].keys && "next" in [].keys()), h = "@@iterator", d = "keys", y = "values", _ = function() {
673
+ var e = r(28), o = r(23), i = r(57), c = r(5), u = r(8), s = r(10), f2 = r(45), a = r(18), p = r(52), l = r(1)("iterator"), v = !([].keys && "next" in [].keys()), h = "@@iterator", d = "keys", y = "values", _ = function() {
674
674
  return this;
675
675
  };
676
676
  t2.exports = function(t3, n3, r2, x, m, w, g) {
677
- f(r2, n3, x);
677
+ f2(r2, n3, x);
678
678
  var b, O, j, S = function(t4) {
679
679
  if (!v && t4 in T) return T[t4];
680
680
  switch (t4) {
@@ -705,7 +705,7 @@ function requireDist() {
705
705
  return i[t3] || (i[t3] = {});
706
706
  };
707
707
  }, function(t2, n2, r) {
708
- var e, o, i, c = r(7), u = r(41), s = r(25), f = r(16), a = r(2), p = a.process, l = a.setImmediate, v = a.clearImmediate, h = a.MessageChannel, d = 0, y = {}, _ = "onreadystatechange", x = function() {
708
+ var e, o, i, c = r(7), u = r(41), s = r(25), f2 = r(16), a = r(2), p = a.process, l = a.setImmediate, v = a.clearImmediate, h = a.MessageChannel, d = 0, y = {}, _ = "onreadystatechange", x = function() {
709
709
  var t3 = +this;
710
710
  if (y.hasOwnProperty(t3)) {
711
711
  var n3 = y[t3];
@@ -725,8 +725,8 @@ function requireDist() {
725
725
  p.nextTick(c(x, t3, 1));
726
726
  } : h ? (o = new h(), i = o.port2, o.port1.onmessage = m, e = c(i.postMessage, i, 1)) : a.addEventListener && "function" == typeof postMessage && !a.importScripts ? (e = function(t3) {
727
727
  a.postMessage(t3 + "", "*");
728
- }, a.addEventListener("message", m, false)) : e = _ in f("script") ? function(t3) {
729
- s.appendChild(f("script"))[_] = function() {
728
+ }, a.addEventListener("message", m, false)) : e = _ in f2("script") ? function(t3) {
729
+ s.appendChild(f2("script"))[_] = function() {
730
730
  s.removeChild(this), x.call(t3);
731
731
  };
732
732
  } : function(t3) {
@@ -790,7 +790,7 @@ function requireDist() {
790
790
  });
791
791
  }
792
792
  Object.defineProperty(n2, "__esModule", { value: true });
793
- var f = r(35), a = e(f);
793
+ var f2 = r(35), a = e(f2);
794
794
  n2.machineIdSync = u, n2.machineId = s;
795
795
  var p = r(70), l = r(71), v = process, h = v.platform, d = { native: "%windir%\\System32", mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32" }, y = { darwin: "ioreg -rd1 -c IOPlatformExpertDevice", win32: d[o()] + "\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid", linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :", freebsd: "kenv -q smbios.system.uuid || sysctl -n kern.hostuuid" };
796
796
  }, function(t2, n2, r) {
@@ -809,24 +809,24 @@ function requireDist() {
809
809
  var e = r(13), o = r(31), i = r(62);
810
810
  t2.exports = function(t3) {
811
811
  return function(n3, r2, c) {
812
- var u, s = e(n3), f = o(s.length), a = i(c, f);
812
+ var u, s = e(n3), f2 = o(s.length), a = i(c, f2);
813
813
  if (t3 && r2 != r2) {
814
- for (; f > a; ) if (u = s[a++], u != u) return true;
815
- } else for (; f > a; a++) if ((t3 || a in s) && s[a] === r2) return t3 || a || 0;
814
+ for (; f2 > a; ) if (u = s[a++], u != u) return true;
815
+ } else for (; f2 > a; a++) if ((t3 || a in s) && s[a] === r2) return t3 || a || 0;
816
816
  return !t3 && -1;
817
817
  };
818
818
  };
819
819
  }, function(t2, n2, r) {
820
- var e = r(7), o = r(44), i = r(43), c = r(3), u = r(31), s = r(64), f = {}, a = {}, n2 = t2.exports = function(t3, n3, r2, p, l) {
820
+ var e = r(7), o = r(44), i = r(43), c = r(3), u = r(31), s = r(64), f2 = {}, a = {}, n2 = t2.exports = function(t3, n3, r2, p, l) {
821
821
  var v, h, d, y, _ = l ? function() {
822
822
  return t3;
823
823
  } : s(t3), x = e(r2, p, n3 ? 2 : 1), m = 0;
824
824
  if ("function" != typeof _) throw TypeError(t3 + " is not iterable!");
825
825
  if (i(_)) {
826
- for (v = u(t3.length); v > m; m++) if (y = n3 ? x(c(h = t3[m])[0], h[1]) : x(t3[m]), y === f || y === a) return y;
827
- } else for (d = _.call(t3); !(h = d.next()).done; ) if (y = o(d, x, h.value, n3), y === f || y === a) return y;
826
+ for (v = u(t3.length); v > m; m++) if (y = n3 ? x(c(h = t3[m])[0], h[1]) : x(t3[m]), y === f2 || y === a) return y;
827
+ } else for (d = _.call(t3); !(h = d.next()).done; ) if (y = o(d, x, h.value, n3), y === f2 || y === a) return y;
828
828
  };
829
- n2.BREAK = f, n2.RETURN = a;
829
+ n2.BREAK = f2, n2.RETURN = a;
830
830
  }, function(t2, n2) {
831
831
  t2.exports = function(t3, n3, r) {
832
832
  var e = void 0 === r;
@@ -903,7 +903,7 @@ function requireDist() {
903
903
  }, function(t2, n2, r) {
904
904
  var e = r(2), o = r(30).set, i = e.MutationObserver || e.WebKitMutationObserver, c = e.process, u = e.Promise, s = "process" == r(11)(c);
905
905
  t2.exports = function() {
906
- var t3, n3, r2, f = function() {
906
+ var t3, n3, r2, f2 = function() {
907
907
  var e2, o2;
908
908
  for (s && (e2 = c.domain) && e2.exit(); t3; ) {
909
909
  o2 = t3.fn, t3 = t3.next;
@@ -916,20 +916,20 @@ function requireDist() {
916
916
  n3 = void 0, e2 && e2.enter();
917
917
  };
918
918
  if (s) r2 = function() {
919
- c.nextTick(f);
919
+ c.nextTick(f2);
920
920
  };
921
921
  else if (i) {
922
922
  var a = true, p = document.createTextNode("");
923
- new i(f).observe(p, { characterData: true }), r2 = function() {
923
+ new i(f2).observe(p, { characterData: true }), r2 = function() {
924
924
  p.data = a = !a;
925
925
  };
926
926
  } else if (u && u.resolve) {
927
927
  var l = u.resolve();
928
928
  r2 = function() {
929
- l.then(f);
929
+ l.then(f2);
930
930
  };
931
931
  } else r2 = function() {
932
- o.call(e, f);
932
+ o.call(e, f2);
933
933
  };
934
934
  return function(e2) {
935
935
  var o2 = { fn: e2, next: void 0 };
@@ -938,14 +938,14 @@ function requireDist() {
938
938
  };
939
939
  }, function(t2, n2, r) {
940
940
  var e = r(3), o = r(50), i = r(22), c = r(19)("IE_PROTO"), u = function() {
941
- }, s = "prototype", f = function() {
941
+ }, s = "prototype", f2 = function() {
942
942
  var t3, n3 = r(16)("iframe"), e2 = i.length, o2 = ">";
943
- for (n3.style.display = "none", r(25).appendChild(n3), n3.src = "javascript:", t3 = n3.contentWindow.document, t3.open(), t3.write("<script>document.F=Object<\/script" + o2), t3.close(), f = t3.F; e2--; ) delete f[s][i[e2]];
944
- return f();
943
+ for (n3.style.display = "none", r(25).appendChild(n3), n3.src = "javascript:", t3 = n3.contentWindow.document, t3.open(), t3.write("<script>document.F=Object<\/script" + o2), t3.close(), f2 = t3.F; e2--; ) delete f2[s][i[e2]];
944
+ return f2();
945
945
  };
946
946
  t2.exports = Object.create || function(t3, n3) {
947
947
  var r2;
948
- return null !== t3 ? (u[s] = e(t3), r2 = new u(), u[s] = null, r2[c] = t3) : r2 = f(), void 0 === n3 ? r2 : o(r2, n3);
948
+ return null !== t3 ? (u[s] = e(t3), r2 = new u(), u[s] = null, r2[c] = t3) : r2 = f2(), void 0 === n3 ? r2 : o(r2, n3);
949
949
  };
950
950
  }, function(t2, n2, r) {
951
951
  var e = r(12), o = r(3), i = r(54);
@@ -955,10 +955,10 @@ function requireDist() {
955
955
  return t3;
956
956
  };
957
957
  }, function(t2, n2, r) {
958
- var e = r(55), o = r(17), i = r(13), c = r(32), u = r(8), s = r(26), f = Object.getOwnPropertyDescriptor;
959
- n2.f = r(4) ? f : function(t3, n3) {
958
+ var e = r(55), o = r(17), i = r(13), c = r(32), u = r(8), s = r(26), f2 = Object.getOwnPropertyDescriptor;
959
+ n2.f = r(4) ? f2 : function(t3, n3) {
960
960
  if (t3 = i(t3), n3 = c(n3, true), s) try {
961
- return f(t3, n3);
961
+ return f2(t3, n3);
962
962
  } catch (t4) {
963
963
  }
964
964
  if (u(t3, n3)) return o(!e.f.call(t3, n3), t3[n3]);
@@ -971,10 +971,10 @@ function requireDist() {
971
971
  }, function(t2, n2, r) {
972
972
  var e = r(8), o = r(13), i = r(39)(false), c = r(19)("IE_PROTO");
973
973
  t2.exports = function(t3, n3) {
974
- var r2, u = o(t3), s = 0, f = [];
975
- for (r2 in u) r2 != c && e(u, r2) && f.push(r2);
976
- for (; n3.length > s; ) e(u, r2 = n3[s++]) && (~i(f, r2) || f.push(r2));
977
- return f;
974
+ var r2, u = o(t3), s = 0, f2 = [];
975
+ for (r2 in u) r2 != c && e(u, r2) && f2.push(r2);
976
+ for (; n3.length > s; ) e(u, r2 = n3[s++]) && (~i(f2, r2) || f2.push(r2));
977
+ return f2;
978
978
  };
979
979
  }, function(t2, n2, r) {
980
980
  var e = r(53), o = r(22);
@@ -1023,8 +1023,8 @@ function requireDist() {
1023
1023
  var e = r(20), o = r(15);
1024
1024
  t2.exports = function(t3) {
1025
1025
  return function(n3, r2) {
1026
- var i, c, u = String(o(n3)), s = e(r2), f = u.length;
1027
- return s < 0 || s >= f ? t3 ? "" : void 0 : (i = u.charCodeAt(s), i < 55296 || i > 56319 || s + 1 === f || (c = u.charCodeAt(s + 1)) < 56320 || c > 57343 ? t3 ? u.charAt(s) : i : t3 ? u.slice(s, s + 2) : (i - 55296 << 10) + (c - 56320) + 65536);
1026
+ var i, c, u = String(o(n3)), s = e(r2), f2 = u.length;
1027
+ return s < 0 || s >= f2 ? t3 ? "" : void 0 : (i = u.charCodeAt(s), i < 55296 || i > 56319 || s + 1 === f2 || (c = u.charCodeAt(s + 1)) < 56320 || c > 57343 ? t3 ? u.charAt(s) : i : t3 ? u.slice(s, s + 2) : (i - 55296 << 10) + (c - 56320) + 65536);
1028
1028
  };
1029
1029
  };
1030
1030
  }, function(t2, n2, r) {
@@ -1052,7 +1052,7 @@ function requireDist() {
1052
1052
  }, "values"), i.Arguments = i.Array, e("keys"), e("values"), e("entries");
1053
1053
  }, function(t2, n2) {
1054
1054
  }, function(t2, n2, r) {
1055
- var e, o, i, c = r(28), u = r(2), s = r(7), f = r(21), a = r(23), p = r(9), l = (r(3), r(14)), v = r(38), h = r(40), d = (r(58).set, r(60)), y = r(30).set, _ = r(48)(), x = "Promise", m = u.TypeError, w = u.process, g = u[x], w = u.process, b = "process" == f(w), O = function() {
1055
+ var e, o, i, c = r(28), u = r(2), s = r(7), f2 = r(21), a = r(23), p = r(9), l = (r(3), r(14)), v = r(38), h = r(40), d = (r(58).set, r(60)), y = r(30).set, _ = r(48)(), x = "Promise", m = u.TypeError, w = u.process, g = u[x], w = u.process, b = "process" == f2(w), O = function() {
1056
1056
  }, j = !!(function() {
1057
1057
  try {
1058
1058
  var t3 = g.resolve(1), n3 = (t3.constructor = {})[r(1)("species")] = function(t4) {
@@ -1086,9 +1086,9 @@ function requireDist() {
1086
1086
  var r2 = t3._c;
1087
1087
  _(function() {
1088
1088
  for (var e2 = t3._v, o2 = 1 == t3._s, i2 = 0, c2 = function(n4) {
1089
- var r3, i3, c3 = o2 ? n4.ok : n4.fail, u2 = n4.resolve, s2 = n4.reject, f2 = n4.domain;
1089
+ var r3, i3, c3 = o2 ? n4.ok : n4.fail, u2 = n4.resolve, s2 = n4.reject, f3 = n4.domain;
1090
1090
  try {
1091
- c3 ? (o2 || (2 == t3._h && I(t3), t3._h = 1), c3 === true ? r3 = e2 : (f2 && f2.enter(), r3 = c3(e2), f2 && f2.exit()), r3 === n4.promise ? s2(m("Promise-chain cycle")) : (i3 = E(r3)) ? i3.call(r3, u2, s2) : u2(r3)) : s2(e2);
1091
+ c3 ? (o2 || (2 == t3._h && I(t3), t3._h = 1), c3 === true ? r3 = e2 : (f3 && f3.enter(), r3 = c3(e2), f3 && f3.exit()), r3 === n4.promise ? s2(m("Promise-chain cycle")) : (i3 = E(r3)) ? i3.call(r3, u2, s2) : u2(r3)) : s2(e2);
1092
1092
  } catch (t4) {
1093
1093
  s2(t4);
1094
1094
  }
@@ -1190,8 +1190,8 @@ function requireDist() {
1190
1190
  }, function(t2, n2, r) {
1191
1191
  r(65);
1192
1192
  for (var e = r(2), o = r(5), i = r(10), c = r(1)("toStringTag"), u = ["NodeList", "DOMTokenList", "MediaList", "StyleSheetList", "CSSRuleList"], s = 0; s < 5; s++) {
1193
- var f = u[s], a = e[f], p = a && a.prototype;
1194
- p && !p[c] && o(p, c, f), i[f] = i.Array;
1193
+ var f2 = u[s], a = e[f2], p = a && a.prototype;
1194
+ p && !p[c] && o(p, c, f2), i[f2] = i.Array;
1195
1195
  }
1196
1196
  }, function(t2, n2) {
1197
1197
  t2.exports = require$$0__default.default;
@@ -1203,9 +1203,9 @@ function requireDist() {
1203
1203
  return dist$1.exports;
1204
1204
  }
1205
1205
  requireDist();
1206
- var map$1;
1206
+ var map$2;
1207
1207
  try {
1208
- map$1 = Map;
1208
+ map$2 = Map;
1209
1209
  } catch (_) {
1210
1210
  }
1211
1211
  var set$1;
@@ -1229,7 +1229,7 @@ function baseClone(src, circulars, clones) {
1229
1229
  if (Array.isArray(src)) {
1230
1230
  return src.map(clone$1);
1231
1231
  }
1232
- if (map$1 && src instanceof map$1) {
1232
+ if (map$2 && src instanceof map$2) {
1233
1233
  return new Map(Array.from(src.entries()));
1234
1234
  }
1235
1235
  if (set$1 && src instanceof set$1) {
@@ -3779,7 +3779,7 @@ function pipe$1(...fns) {
3779
3779
  return res;
3780
3780
  };
3781
3781
  }
3782
- fp.curry(pMap);
3782
+ const map$1 = fp.curry(pMap);
3783
3783
  const visitor$4 = ({ key, attribute }, { remove }) => {
3784
3784
  if (attribute?.type === "password") {
3785
3785
  remove(key);
@@ -18430,6 +18430,19 @@ function asBoolean(value) {
18430
18430
  const normalized = value.toLowerCase().trim();
18431
18431
  return normalized !== "false" && normalized !== "0";
18432
18432
  }
18433
+ const version = "1.15.0-rc.0";
18434
+ const name = "@fourlights/strapi-plugin-deep-populate";
18435
+ const f = (msg, context = void 0) => {
18436
+ const prefix = `[${name}] `;
18437
+ const suffix = context !== void 0 ? `
18438
+ ${prefix}${context}` : "";
18439
+ return `${prefix}${msg}${suffix}`;
18440
+ };
18441
+ const error = (msg, context = void 0) => strapi.log.error(f(msg, context));
18442
+ const warn = (msg, context = void 0) => strapi.log.warn(f(msg, context));
18443
+ const info = (msg, context = void 0) => strapi.log.info(f(msg, context));
18444
+ const debug = (msg, context = void 0) => strapi.log.debug(f(msg, context));
18445
+ const log = { error, warn, info, debug };
18433
18446
  const populateIsWildcardEquivalent = async ({
18434
18447
  strapi: strapi2,
18435
18448
  schema: schema2,
@@ -18445,9 +18458,35 @@ const populateIsWildcardEquivalent = async ({
18445
18458
  );
18446
18459
  return populate2 === "*" || populate2 === true || JSON.stringify(expandedWildcardQuery) === JSON.stringify(populate2);
18447
18460
  };
18461
+ async function clearCacheForChangedSchemas(schemas) {
18462
+ await map$1(schemas, async (schema2) => {
18463
+ const deleted = await strapi.db.query("plugin::deep-populate.cache").deleteMany({
18464
+ where: {
18465
+ dependencies: { $contains: schema2 }
18466
+ }
18467
+ });
18468
+ log.info(`Deleted ${deleted.count} cached entries due to out of date schema '${schema2}'`);
18469
+ });
18470
+ }
18448
18471
  const register = async ({ strapi: strapi2 }) => {
18472
+ strapi2.hook("strapi::content-types.beforeSync").register(async () => {
18473
+ const databaseSchema = await strapi2.db.dialect.schemaInspector.getSchema();
18474
+ const storedSchema = await strapi2.db.schema.schemaStorage.read();
18475
+ const { status, diff } = await strapi2.db.schema.schemaDiff.diff({
18476
+ previousSchema: storedSchema?.schema,
18477
+ databaseSchema,
18478
+ userSchema: strapi2.db.schema.schema
18479
+ });
18480
+ if (status === "CHANGED") {
18481
+ const updatedTables = (diff.tables.updated ?? []).map((t) => t.name);
18482
+ const updatedSchemas = [...strapi2.db.metadata.values()].filter((m) => updatedTables.includes(m.tableName)).map((m) => m.uid);
18483
+ const tableName = strapi2.db.metadata.get("plugin::deep-populate.cache").tableName;
18484
+ const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
18485
+ if (hasTable) await clearCacheForChangedSchemas(updatedSchemas);
18486
+ }
18487
+ });
18449
18488
  strapi2.hook("strapi::content-types.afterSync").register(async () => {
18450
- const tableName = "populate_cache";
18489
+ const tableName = strapi2.db.metadata.get("plugin::deep-populate.cache").tableName;
18451
18490
  const columnName = "dependencies";
18452
18491
  const hasIndex = await hasDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
18453
18492
  const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
@@ -18522,13 +18561,7 @@ const register = async ({ strapi: strapi2 }) => {
18522
18561
  return result;
18523
18562
  });
18524
18563
  };
18525
- const version = "1.14.0";
18526
- const name = "@fourlights/strapi-plugin-deep-populate";
18527
- const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
18528
- const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
18529
- const info = (msg, context = void 0) => strapi.log.info(`[${name}] ${msg}`, context);
18530
- const debug = (msg, context = void 0) => strapi.log.debug(`[${name}] ${msg}`, context);
18531
- const log = { error, warn, info, debug };
18564
+ const majorMinorVersion = version.split(".").slice(0, -1).join(".");
18532
18565
  const sanitizeObject = (obj) => {
18533
18566
  if (obj === null || typeof obj !== "object") return obj;
18534
18567
  const dangerousProps = ["__proto__", "constructor", "prototype"];
@@ -18584,7 +18617,6 @@ const getConfig = (params) => {
18584
18617
  const localizations = params.localizations ?? contentTypeConfig.localizations ?? localizationsFallback;
18585
18618
  return { allow, deny, omitEmpty, localizations };
18586
18619
  };
18587
- const majorMinorVersion = version.split(".").slice(0, -1).join(".");
18588
18620
  const isEqualConfig = (lhs, rhs) => {
18589
18621
  const cleanedLhs = JSON.parse(JSON.stringify(lhs));
18590
18622
  const cleanedRhs = JSON.parse(JSON.stringify(rhs));
@@ -18616,7 +18648,7 @@ const cache = ({ strapi: strapi2 }) => ({
18616
18648
  data: { populate: populate2, dependencies: dependencies.join(",") }
18617
18649
  }) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
18618
18650
  } catch (error2) {
18619
- log.error("[Plugin: Deep Populate] Failed to save cached entry", { error: error2 });
18651
+ log.error("Failed to save cached entry", error2);
18620
18652
  return;
18621
18653
  }
18622
18654
  },
@@ -18784,6 +18816,7 @@ async function _populate({
18784
18816
  populate: populate2 = {},
18785
18817
  lookup = [],
18786
18818
  resolvedRelations,
18819
+ resolvedSchemas,
18787
18820
  omitEmpty,
18788
18821
  __deny,
18789
18822
  __allow,
@@ -18799,6 +18832,7 @@ async function _populate({
18799
18832
  let relations = getRelations(model);
18800
18833
  let currentPopulate = cloneDeep__default.default(populate2);
18801
18834
  resolvedRelations.set(params.documentId, true);
18835
+ resolvedSchemas.add(schema2);
18802
18836
  for (const [attrName, attr] of relations) {
18803
18837
  if (lookup.length > 0) {
18804
18838
  const parent = get__default.default(currentPopulate, lookup);
@@ -18870,6 +18904,7 @@ async function _populate({
18870
18904
  lookup,
18871
18905
  attrName,
18872
18906
  resolvedRelations,
18907
+ resolvedSchemas,
18873
18908
  omitEmpty,
18874
18909
  __deny,
18875
18910
  __allow,
@@ -18881,6 +18916,7 @@ async function _populate({
18881
18916
  contentType: attr.target,
18882
18917
  relation: value,
18883
18918
  resolvedRelations,
18919
+ resolvedSchemas,
18884
18920
  omitEmpty,
18885
18921
  locale: params.locale,
18886
18922
  status: params.status,
@@ -18896,6 +18932,7 @@ async function _populate({
18896
18932
  lookup,
18897
18933
  attrName,
18898
18934
  resolvedRelations,
18935
+ resolvedSchemas,
18899
18936
  omitEmpty,
18900
18937
  __deny,
18901
18938
  __allow,
@@ -18911,9 +18948,11 @@ async function _populate({
18911
18948
  async function populate$1(params) {
18912
18949
  const config2 = getConfig(params);
18913
18950
  const resolvedRelations = /* @__PURE__ */ new Map();
18951
+ const resolvedSchemas = /* @__PURE__ */ new Set();
18914
18952
  const populated = await _populate({
18915
18953
  schema: params.contentType,
18916
18954
  resolvedRelations,
18955
+ resolvedSchemas,
18917
18956
  omitEmpty: config2.omitEmpty,
18918
18957
  localizations: config2.localizations,
18919
18958
  __deny: config2.deny,
@@ -18922,7 +18961,11 @@ async function populate$1(params) {
18922
18961
  });
18923
18962
  populated.__deepPopulated = true;
18924
18963
  populated.__deepPopulateConfig = config2;
18925
- const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
18964
+ const dependencies = [
18965
+ ...[...resolvedRelations.keys()].filter((r) => !r.startsWith("api::")),
18966
+ // Remove content-types from resolved relations
18967
+ ...resolvedSchemas.values()
18968
+ ];
18926
18969
  return { populate: populated, dependencies };
18927
18970
  }
18928
18971
  const populate = ({ strapi: strapi2 }) => ({
@@ -1,7 +1,7 @@
1
1
  import isEmpty$1 from "lodash/isEmpty";
2
2
  import isObject$2 from "lodash/isObject";
3
3
  import ___default, { isNil as isNil$1, has as has$1, get as get$1, mergeWith } from "lodash";
4
- import { union as union$1, getOr, curry, isObject as isObject$3, isNil, clone as clone$2, isArray, pick as pick$1, isEmpty as isEmpty$2, cloneDeep, omit as omit$1, isString, trim as trim$1, pipe as pipe$2, split, map as map$2, flatten, first, constant, identity, join, eq, get } from "lodash/fp";
4
+ import { union as union$1, getOr, curry, isObject as isObject$3, isNil, clone as clone$2, isArray, pick as pick$1, isEmpty as isEmpty$2, cloneDeep, omit as omit$1, isString, trim as trim$1, pipe as pipe$2, split, map as map$3, flatten, first, constant, identity, join, eq, get } from "lodash/fp";
5
5
  import require$$1 from "crypto";
6
6
  import require$$0$1 from "child_process";
7
7
  import has from "lodash/has";
@@ -604,9 +604,9 @@ function requireDist() {
604
604
  t2.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
605
605
  }, function(t2, n2, r) {
606
606
  var e = r(2), o = r(6), i = r(7), c = r(5), u = "prototype", s = function(t3, n3, r2) {
607
- var f, a, p, l = t3 & s.F, v = t3 & s.G, h = t3 & s.S, d = t3 & s.P, y = t3 & s.B, _ = t3 & s.W, x = v ? o : o[n3] || (o[n3] = {}), m = x[u], w = v ? e : h ? e[n3] : (e[n3] || {})[u];
607
+ var f2, a, p, l = t3 & s.F, v = t3 & s.G, h = t3 & s.S, d = t3 & s.P, y = t3 & s.B, _ = t3 & s.W, x = v ? o : o[n3] || (o[n3] = {}), m = x[u], w = v ? e : h ? e[n3] : (e[n3] || {})[u];
608
608
  v && (r2 = n3);
609
- for (f in r2) a = !l && w && void 0 !== w[f], a && f in x || (p = a ? w[f] : r2[f], x[f] = v && "function" != typeof w[f] ? r2[f] : y && a ? i(p, e) : _ && w[f] == p ? (function(t4) {
609
+ for (f2 in r2) a = !l && w && void 0 !== w[f2], a && f2 in x || (p = a ? w[f2] : r2[f2], x[f2] = v && "function" != typeof w[f2] ? r2[f2] : y && a ? i(p, e) : _ && w[f2] == p ? (function(t4) {
610
610
  var n4 = function(n5, r3, e2) {
611
611
  if (this instanceof t4) {
612
612
  switch (arguments.length) {
@@ -622,7 +622,7 @@ function requireDist() {
622
622
  return t4.apply(this, arguments);
623
623
  };
624
624
  return n4[u] = t4[u], n4;
625
- })(p) : d && "function" == typeof p ? i(Function.call, p) : p, d && ((x.virtual || (x.virtual = {}))[f] = p, t3 & s.R && m && !m[f] && c(m, f, p)));
625
+ })(p) : d && "function" == typeof p ? i(Function.call, p) : p, d && ((x.virtual || (x.virtual = {}))[f2] = p, t3 & s.R && m && !m[f2] && c(m, f2, p)));
626
626
  };
627
627
  s.F = 1, s.G = 2, s.S = 4, s.P = 8, s.B = 16, s.W = 32, s.U = 64, s.R = 128, t2.exports = s;
628
628
  }, function(t2, n2) {
@@ -642,11 +642,11 @@ function requireDist() {
642
642
  } }).a;
643
643
  });
644
644
  }, function(t2, n2, r) {
645
- var e = r(28), o = r(23), i = r(57), c = r(5), u = r(8), s = r(10), f = r(45), a = r(18), p = r(52), l = r(1)("iterator"), v = !([].keys && "next" in [].keys()), h = "@@iterator", d = "keys", y = "values", _ = function() {
645
+ var e = r(28), o = r(23), i = r(57), c = r(5), u = r(8), s = r(10), f2 = r(45), a = r(18), p = r(52), l = r(1)("iterator"), v = !([].keys && "next" in [].keys()), h = "@@iterator", d = "keys", y = "values", _ = function() {
646
646
  return this;
647
647
  };
648
648
  t2.exports = function(t3, n3, r2, x, m, w, g) {
649
- f(r2, n3, x);
649
+ f2(r2, n3, x);
650
650
  var b, O, j, S = function(t4) {
651
651
  if (!v && t4 in T) return T[t4];
652
652
  switch (t4) {
@@ -677,7 +677,7 @@ function requireDist() {
677
677
  return i[t3] || (i[t3] = {});
678
678
  };
679
679
  }, function(t2, n2, r) {
680
- var e, o, i, c = r(7), u = r(41), s = r(25), f = r(16), a = r(2), p = a.process, l = a.setImmediate, v = a.clearImmediate, h = a.MessageChannel, d = 0, y = {}, _ = "onreadystatechange", x = function() {
680
+ var e, o, i, c = r(7), u = r(41), s = r(25), f2 = r(16), a = r(2), p = a.process, l = a.setImmediate, v = a.clearImmediate, h = a.MessageChannel, d = 0, y = {}, _ = "onreadystatechange", x = function() {
681
681
  var t3 = +this;
682
682
  if (y.hasOwnProperty(t3)) {
683
683
  var n3 = y[t3];
@@ -697,8 +697,8 @@ function requireDist() {
697
697
  p.nextTick(c(x, t3, 1));
698
698
  } : h ? (o = new h(), i = o.port2, o.port1.onmessage = m, e = c(i.postMessage, i, 1)) : a.addEventListener && "function" == typeof postMessage && !a.importScripts ? (e = function(t3) {
699
699
  a.postMessage(t3 + "", "*");
700
- }, a.addEventListener("message", m, false)) : e = _ in f("script") ? function(t3) {
701
- s.appendChild(f("script"))[_] = function() {
700
+ }, a.addEventListener("message", m, false)) : e = _ in f2("script") ? function(t3) {
701
+ s.appendChild(f2("script"))[_] = function() {
702
702
  s.removeChild(this), x.call(t3);
703
703
  };
704
704
  } : function(t3) {
@@ -762,7 +762,7 @@ function requireDist() {
762
762
  });
763
763
  }
764
764
  Object.defineProperty(n2, "__esModule", { value: true });
765
- var f = r(35), a = e(f);
765
+ var f2 = r(35), a = e(f2);
766
766
  n2.machineIdSync = u, n2.machineId = s;
767
767
  var p = r(70), l = r(71), v = process, h = v.platform, d = { native: "%windir%\\System32", mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32" }, y = { darwin: "ioreg -rd1 -c IOPlatformExpertDevice", win32: d[o()] + "\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid", linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :", freebsd: "kenv -q smbios.system.uuid || sysctl -n kern.hostuuid" };
768
768
  }, function(t2, n2, r) {
@@ -781,24 +781,24 @@ function requireDist() {
781
781
  var e = r(13), o = r(31), i = r(62);
782
782
  t2.exports = function(t3) {
783
783
  return function(n3, r2, c) {
784
- var u, s = e(n3), f = o(s.length), a = i(c, f);
784
+ var u, s = e(n3), f2 = o(s.length), a = i(c, f2);
785
785
  if (t3 && r2 != r2) {
786
- for (; f > a; ) if (u = s[a++], u != u) return true;
787
- } else for (; f > a; a++) if ((t3 || a in s) && s[a] === r2) return t3 || a || 0;
786
+ for (; f2 > a; ) if (u = s[a++], u != u) return true;
787
+ } else for (; f2 > a; a++) if ((t3 || a in s) && s[a] === r2) return t3 || a || 0;
788
788
  return !t3 && -1;
789
789
  };
790
790
  };
791
791
  }, function(t2, n2, r) {
792
- var e = r(7), o = r(44), i = r(43), c = r(3), u = r(31), s = r(64), f = {}, a = {}, n2 = t2.exports = function(t3, n3, r2, p, l) {
792
+ var e = r(7), o = r(44), i = r(43), c = r(3), u = r(31), s = r(64), f2 = {}, a = {}, n2 = t2.exports = function(t3, n3, r2, p, l) {
793
793
  var v, h, d, y, _ = l ? function() {
794
794
  return t3;
795
795
  } : s(t3), x = e(r2, p, n3 ? 2 : 1), m = 0;
796
796
  if ("function" != typeof _) throw TypeError(t3 + " is not iterable!");
797
797
  if (i(_)) {
798
- for (v = u(t3.length); v > m; m++) if (y = n3 ? x(c(h = t3[m])[0], h[1]) : x(t3[m]), y === f || y === a) return y;
799
- } else for (d = _.call(t3); !(h = d.next()).done; ) if (y = o(d, x, h.value, n3), y === f || y === a) return y;
798
+ for (v = u(t3.length); v > m; m++) if (y = n3 ? x(c(h = t3[m])[0], h[1]) : x(t3[m]), y === f2 || y === a) return y;
799
+ } else for (d = _.call(t3); !(h = d.next()).done; ) if (y = o(d, x, h.value, n3), y === f2 || y === a) return y;
800
800
  };
801
- n2.BREAK = f, n2.RETURN = a;
801
+ n2.BREAK = f2, n2.RETURN = a;
802
802
  }, function(t2, n2) {
803
803
  t2.exports = function(t3, n3, r) {
804
804
  var e = void 0 === r;
@@ -875,7 +875,7 @@ function requireDist() {
875
875
  }, function(t2, n2, r) {
876
876
  var e = r(2), o = r(30).set, i = e.MutationObserver || e.WebKitMutationObserver, c = e.process, u = e.Promise, s = "process" == r(11)(c);
877
877
  t2.exports = function() {
878
- var t3, n3, r2, f = function() {
878
+ var t3, n3, r2, f2 = function() {
879
879
  var e2, o2;
880
880
  for (s && (e2 = c.domain) && e2.exit(); t3; ) {
881
881
  o2 = t3.fn, t3 = t3.next;
@@ -888,20 +888,20 @@ function requireDist() {
888
888
  n3 = void 0, e2 && e2.enter();
889
889
  };
890
890
  if (s) r2 = function() {
891
- c.nextTick(f);
891
+ c.nextTick(f2);
892
892
  };
893
893
  else if (i) {
894
894
  var a = true, p = document.createTextNode("");
895
- new i(f).observe(p, { characterData: true }), r2 = function() {
895
+ new i(f2).observe(p, { characterData: true }), r2 = function() {
896
896
  p.data = a = !a;
897
897
  };
898
898
  } else if (u && u.resolve) {
899
899
  var l = u.resolve();
900
900
  r2 = function() {
901
- l.then(f);
901
+ l.then(f2);
902
902
  };
903
903
  } else r2 = function() {
904
- o.call(e, f);
904
+ o.call(e, f2);
905
905
  };
906
906
  return function(e2) {
907
907
  var o2 = { fn: e2, next: void 0 };
@@ -910,14 +910,14 @@ function requireDist() {
910
910
  };
911
911
  }, function(t2, n2, r) {
912
912
  var e = r(3), o = r(50), i = r(22), c = r(19)("IE_PROTO"), u = function() {
913
- }, s = "prototype", f = function() {
913
+ }, s = "prototype", f2 = function() {
914
914
  var t3, n3 = r(16)("iframe"), e2 = i.length, o2 = ">";
915
- for (n3.style.display = "none", r(25).appendChild(n3), n3.src = "javascript:", t3 = n3.contentWindow.document, t3.open(), t3.write("<script>document.F=Object<\/script" + o2), t3.close(), f = t3.F; e2--; ) delete f[s][i[e2]];
916
- return f();
915
+ for (n3.style.display = "none", r(25).appendChild(n3), n3.src = "javascript:", t3 = n3.contentWindow.document, t3.open(), t3.write("<script>document.F=Object<\/script" + o2), t3.close(), f2 = t3.F; e2--; ) delete f2[s][i[e2]];
916
+ return f2();
917
917
  };
918
918
  t2.exports = Object.create || function(t3, n3) {
919
919
  var r2;
920
- return null !== t3 ? (u[s] = e(t3), r2 = new u(), u[s] = null, r2[c] = t3) : r2 = f(), void 0 === n3 ? r2 : o(r2, n3);
920
+ return null !== t3 ? (u[s] = e(t3), r2 = new u(), u[s] = null, r2[c] = t3) : r2 = f2(), void 0 === n3 ? r2 : o(r2, n3);
921
921
  };
922
922
  }, function(t2, n2, r) {
923
923
  var e = r(12), o = r(3), i = r(54);
@@ -927,10 +927,10 @@ function requireDist() {
927
927
  return t3;
928
928
  };
929
929
  }, function(t2, n2, r) {
930
- var e = r(55), o = r(17), i = r(13), c = r(32), u = r(8), s = r(26), f = Object.getOwnPropertyDescriptor;
931
- n2.f = r(4) ? f : function(t3, n3) {
930
+ var e = r(55), o = r(17), i = r(13), c = r(32), u = r(8), s = r(26), f2 = Object.getOwnPropertyDescriptor;
931
+ n2.f = r(4) ? f2 : function(t3, n3) {
932
932
  if (t3 = i(t3), n3 = c(n3, true), s) try {
933
- return f(t3, n3);
933
+ return f2(t3, n3);
934
934
  } catch (t4) {
935
935
  }
936
936
  if (u(t3, n3)) return o(!e.f.call(t3, n3), t3[n3]);
@@ -943,10 +943,10 @@ function requireDist() {
943
943
  }, function(t2, n2, r) {
944
944
  var e = r(8), o = r(13), i = r(39)(false), c = r(19)("IE_PROTO");
945
945
  t2.exports = function(t3, n3) {
946
- var r2, u = o(t3), s = 0, f = [];
947
- for (r2 in u) r2 != c && e(u, r2) && f.push(r2);
948
- for (; n3.length > s; ) e(u, r2 = n3[s++]) && (~i(f, r2) || f.push(r2));
949
- return f;
946
+ var r2, u = o(t3), s = 0, f2 = [];
947
+ for (r2 in u) r2 != c && e(u, r2) && f2.push(r2);
948
+ for (; n3.length > s; ) e(u, r2 = n3[s++]) && (~i(f2, r2) || f2.push(r2));
949
+ return f2;
950
950
  };
951
951
  }, function(t2, n2, r) {
952
952
  var e = r(53), o = r(22);
@@ -995,8 +995,8 @@ function requireDist() {
995
995
  var e = r(20), o = r(15);
996
996
  t2.exports = function(t3) {
997
997
  return function(n3, r2) {
998
- var i, c, u = String(o(n3)), s = e(r2), f = u.length;
999
- return s < 0 || s >= f ? t3 ? "" : void 0 : (i = u.charCodeAt(s), i < 55296 || i > 56319 || s + 1 === f || (c = u.charCodeAt(s + 1)) < 56320 || c > 57343 ? t3 ? u.charAt(s) : i : t3 ? u.slice(s, s + 2) : (i - 55296 << 10) + (c - 56320) + 65536);
998
+ var i, c, u = String(o(n3)), s = e(r2), f2 = u.length;
999
+ return s < 0 || s >= f2 ? t3 ? "" : void 0 : (i = u.charCodeAt(s), i < 55296 || i > 56319 || s + 1 === f2 || (c = u.charCodeAt(s + 1)) < 56320 || c > 57343 ? t3 ? u.charAt(s) : i : t3 ? u.slice(s, s + 2) : (i - 55296 << 10) + (c - 56320) + 65536);
1000
1000
  };
1001
1001
  };
1002
1002
  }, function(t2, n2, r) {
@@ -1024,7 +1024,7 @@ function requireDist() {
1024
1024
  }, "values"), i.Arguments = i.Array, e("keys"), e("values"), e("entries");
1025
1025
  }, function(t2, n2) {
1026
1026
  }, function(t2, n2, r) {
1027
- var e, o, i, c = r(28), u = r(2), s = r(7), f = r(21), a = r(23), p = r(9), l = (r(3), r(14)), v = r(38), h = r(40), d = (r(58).set, r(60)), y = r(30).set, _ = r(48)(), x = "Promise", m = u.TypeError, w = u.process, g = u[x], w = u.process, b = "process" == f(w), O = function() {
1027
+ var e, o, i, c = r(28), u = r(2), s = r(7), f2 = r(21), a = r(23), p = r(9), l = (r(3), r(14)), v = r(38), h = r(40), d = (r(58).set, r(60)), y = r(30).set, _ = r(48)(), x = "Promise", m = u.TypeError, w = u.process, g = u[x], w = u.process, b = "process" == f2(w), O = function() {
1028
1028
  }, j = !!(function() {
1029
1029
  try {
1030
1030
  var t3 = g.resolve(1), n3 = (t3.constructor = {})[r(1)("species")] = function(t4) {
@@ -1058,9 +1058,9 @@ function requireDist() {
1058
1058
  var r2 = t3._c;
1059
1059
  _(function() {
1060
1060
  for (var e2 = t3._v, o2 = 1 == t3._s, i2 = 0, c2 = function(n4) {
1061
- var r3, i3, c3 = o2 ? n4.ok : n4.fail, u2 = n4.resolve, s2 = n4.reject, f2 = n4.domain;
1061
+ var r3, i3, c3 = o2 ? n4.ok : n4.fail, u2 = n4.resolve, s2 = n4.reject, f3 = n4.domain;
1062
1062
  try {
1063
- c3 ? (o2 || (2 == t3._h && I(t3), t3._h = 1), c3 === true ? r3 = e2 : (f2 && f2.enter(), r3 = c3(e2), f2 && f2.exit()), r3 === n4.promise ? s2(m("Promise-chain cycle")) : (i3 = E(r3)) ? i3.call(r3, u2, s2) : u2(r3)) : s2(e2);
1063
+ c3 ? (o2 || (2 == t3._h && I(t3), t3._h = 1), c3 === true ? r3 = e2 : (f3 && f3.enter(), r3 = c3(e2), f3 && f3.exit()), r3 === n4.promise ? s2(m("Promise-chain cycle")) : (i3 = E(r3)) ? i3.call(r3, u2, s2) : u2(r3)) : s2(e2);
1064
1064
  } catch (t4) {
1065
1065
  s2(t4);
1066
1066
  }
@@ -1162,8 +1162,8 @@ function requireDist() {
1162
1162
  }, function(t2, n2, r) {
1163
1163
  r(65);
1164
1164
  for (var e = r(2), o = r(5), i = r(10), c = r(1)("toStringTag"), u = ["NodeList", "DOMTokenList", "MediaList", "StyleSheetList", "CSSRuleList"], s = 0; s < 5; s++) {
1165
- var f = u[s], a = e[f], p = a && a.prototype;
1166
- p && !p[c] && o(p, c, f), i[f] = i.Array;
1165
+ var f2 = u[s], a = e[f2], p = a && a.prototype;
1166
+ p && !p[c] && o(p, c, f2), i[f2] = i.Array;
1167
1167
  }
1168
1168
  }, function(t2, n2) {
1169
1169
  t2.exports = require$$0$1;
@@ -1175,9 +1175,9 @@ function requireDist() {
1175
1175
  return dist$1.exports;
1176
1176
  }
1177
1177
  requireDist();
1178
- var map$1;
1178
+ var map$2;
1179
1179
  try {
1180
- map$1 = Map;
1180
+ map$2 = Map;
1181
1181
  } catch (_) {
1182
1182
  }
1183
1183
  var set$1;
@@ -1201,7 +1201,7 @@ function baseClone(src, circulars, clones) {
1201
1201
  if (Array.isArray(src)) {
1202
1202
  return src.map(clone$1);
1203
1203
  }
1204
- if (map$1 && src instanceof map$1) {
1204
+ if (map$2 && src instanceof map$2) {
1205
1205
  return new Map(Array.from(src.entries()));
1206
1206
  }
1207
1207
  if (set$1 && src instanceof set$1) {
@@ -3751,7 +3751,7 @@ function pipe$1(...fns) {
3751
3751
  return res;
3752
3752
  };
3753
3753
  }
3754
- curry(pMap);
3754
+ const map$1 = curry(pMap);
3755
3755
  const visitor$4 = ({ key, attribute }, { remove }) => {
3756
3756
  if (attribute?.type === "password") {
3757
3757
  remove(key);
@@ -4069,7 +4069,7 @@ const sort = traverseFactory().intercept(
4069
4069
  return Promise.all(sort2.map((nestedSort) => recurse(visitor2, options, nestedSort))).then((res) => res.filter((nestedSort) => !isEmpty$2(nestedSort)));
4070
4070
  }
4071
4071
  ).parse(isString, () => {
4072
- const tokenize = pipe$2(split("."), map$2(split(":")), flatten);
4072
+ const tokenize = pipe$2(split("."), map$3(split(":")), flatten);
4073
4073
  const recompose = (parts) => {
4074
4074
  if (parts.length === 0) {
4075
4075
  return void 0;
@@ -18402,6 +18402,19 @@ function asBoolean(value) {
18402
18402
  const normalized = value.toLowerCase().trim();
18403
18403
  return normalized !== "false" && normalized !== "0";
18404
18404
  }
18405
+ const version = "1.15.0-rc.0";
18406
+ const name = "@fourlights/strapi-plugin-deep-populate";
18407
+ const f = (msg, context = void 0) => {
18408
+ const prefix = `[${name}] `;
18409
+ const suffix = context !== void 0 ? `
18410
+ ${prefix}${context}` : "";
18411
+ return `${prefix}${msg}${suffix}`;
18412
+ };
18413
+ const error = (msg, context = void 0) => strapi.log.error(f(msg, context));
18414
+ const warn = (msg, context = void 0) => strapi.log.warn(f(msg, context));
18415
+ const info = (msg, context = void 0) => strapi.log.info(f(msg, context));
18416
+ const debug = (msg, context = void 0) => strapi.log.debug(f(msg, context));
18417
+ const log = { error, warn, info, debug };
18405
18418
  const populateIsWildcardEquivalent = async ({
18406
18419
  strapi: strapi2,
18407
18420
  schema: schema2,
@@ -18417,9 +18430,35 @@ const populateIsWildcardEquivalent = async ({
18417
18430
  );
18418
18431
  return populate2 === "*" || populate2 === true || JSON.stringify(expandedWildcardQuery) === JSON.stringify(populate2);
18419
18432
  };
18433
+ async function clearCacheForChangedSchemas(schemas) {
18434
+ await map$1(schemas, async (schema2) => {
18435
+ const deleted = await strapi.db.query("plugin::deep-populate.cache").deleteMany({
18436
+ where: {
18437
+ dependencies: { $contains: schema2 }
18438
+ }
18439
+ });
18440
+ log.info(`Deleted ${deleted.count} cached entries due to out of date schema '${schema2}'`);
18441
+ });
18442
+ }
18420
18443
  const register = async ({ strapi: strapi2 }) => {
18444
+ strapi2.hook("strapi::content-types.beforeSync").register(async () => {
18445
+ const databaseSchema = await strapi2.db.dialect.schemaInspector.getSchema();
18446
+ const storedSchema = await strapi2.db.schema.schemaStorage.read();
18447
+ const { status, diff } = await strapi2.db.schema.schemaDiff.diff({
18448
+ previousSchema: storedSchema?.schema,
18449
+ databaseSchema,
18450
+ userSchema: strapi2.db.schema.schema
18451
+ });
18452
+ if (status === "CHANGED") {
18453
+ const updatedTables = (diff.tables.updated ?? []).map((t) => t.name);
18454
+ const updatedSchemas = [...strapi2.db.metadata.values()].filter((m) => updatedTables.includes(m.tableName)).map((m) => m.uid);
18455
+ const tableName = strapi2.db.metadata.get("plugin::deep-populate.cache").tableName;
18456
+ const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
18457
+ if (hasTable) await clearCacheForChangedSchemas(updatedSchemas);
18458
+ }
18459
+ });
18421
18460
  strapi2.hook("strapi::content-types.afterSync").register(async () => {
18422
- const tableName = "populate_cache";
18461
+ const tableName = strapi2.db.metadata.get("plugin::deep-populate.cache").tableName;
18423
18462
  const columnName = "dependencies";
18424
18463
  const hasIndex = await hasDeepPopulateCacheFullTextIndex(strapi2.db, tableName, columnName);
18425
18464
  const hasTable = await strapi2.db.connection.schema.hasTable(tableName);
@@ -18494,13 +18533,7 @@ const register = async ({ strapi: strapi2 }) => {
18494
18533
  return result;
18495
18534
  });
18496
18535
  };
18497
- const version = "1.14.0";
18498
- const name = "@fourlights/strapi-plugin-deep-populate";
18499
- const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
18500
- const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
18501
- const info = (msg, context = void 0) => strapi.log.info(`[${name}] ${msg}`, context);
18502
- const debug = (msg, context = void 0) => strapi.log.debug(`[${name}] ${msg}`, context);
18503
- const log = { error, warn, info, debug };
18536
+ const majorMinorVersion = version.split(".").slice(0, -1).join(".");
18504
18537
  const sanitizeObject = (obj) => {
18505
18538
  if (obj === null || typeof obj !== "object") return obj;
18506
18539
  const dangerousProps = ["__proto__", "constructor", "prototype"];
@@ -18556,7 +18589,6 @@ const getConfig = (params) => {
18556
18589
  const localizations = params.localizations ?? contentTypeConfig.localizations ?? localizationsFallback;
18557
18590
  return { allow, deny, omitEmpty, localizations };
18558
18591
  };
18559
- const majorMinorVersion = version.split(".").slice(0, -1).join(".");
18560
18592
  const isEqualConfig = (lhs, rhs) => {
18561
18593
  const cleanedLhs = JSON.parse(JSON.stringify(lhs));
18562
18594
  const cleanedRhs = JSON.parse(JSON.stringify(rhs));
@@ -18588,7 +18620,7 @@ const cache = ({ strapi: strapi2 }) => ({
18588
18620
  data: { populate: populate2, dependencies: dependencies.join(",") }
18589
18621
  }) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
18590
18622
  } catch (error2) {
18591
- log.error("[Plugin: Deep Populate] Failed to save cached entry", { error: error2 });
18623
+ log.error("Failed to save cached entry", error2);
18592
18624
  return;
18593
18625
  }
18594
18626
  },
@@ -18756,6 +18788,7 @@ async function _populate({
18756
18788
  populate: populate2 = {},
18757
18789
  lookup = [],
18758
18790
  resolvedRelations,
18791
+ resolvedSchemas,
18759
18792
  omitEmpty,
18760
18793
  __deny,
18761
18794
  __allow,
@@ -18771,6 +18804,7 @@ async function _populate({
18771
18804
  let relations = getRelations(model);
18772
18805
  let currentPopulate = cloneDeep$1(populate2);
18773
18806
  resolvedRelations.set(params.documentId, true);
18807
+ resolvedSchemas.add(schema2);
18774
18808
  for (const [attrName, attr] of relations) {
18775
18809
  if (lookup.length > 0) {
18776
18810
  const parent = get$2(currentPopulate, lookup);
@@ -18842,6 +18876,7 @@ async function _populate({
18842
18876
  lookup,
18843
18877
  attrName,
18844
18878
  resolvedRelations,
18879
+ resolvedSchemas,
18845
18880
  omitEmpty,
18846
18881
  __deny,
18847
18882
  __allow,
@@ -18853,6 +18888,7 @@ async function _populate({
18853
18888
  contentType: attr.target,
18854
18889
  relation: value,
18855
18890
  resolvedRelations,
18891
+ resolvedSchemas,
18856
18892
  omitEmpty,
18857
18893
  locale: params.locale,
18858
18894
  status: params.status,
@@ -18868,6 +18904,7 @@ async function _populate({
18868
18904
  lookup,
18869
18905
  attrName,
18870
18906
  resolvedRelations,
18907
+ resolvedSchemas,
18871
18908
  omitEmpty,
18872
18909
  __deny,
18873
18910
  __allow,
@@ -18883,9 +18920,11 @@ async function _populate({
18883
18920
  async function populate$1(params) {
18884
18921
  const config2 = getConfig(params);
18885
18922
  const resolvedRelations = /* @__PURE__ */ new Map();
18923
+ const resolvedSchemas = /* @__PURE__ */ new Set();
18886
18924
  const populated = await _populate({
18887
18925
  schema: params.contentType,
18888
18926
  resolvedRelations,
18927
+ resolvedSchemas,
18889
18928
  omitEmpty: config2.omitEmpty,
18890
18929
  localizations: config2.localizations,
18891
18930
  __deny: config2.deny,
@@ -18894,7 +18933,11 @@ async function populate$1(params) {
18894
18933
  });
18895
18934
  populated.__deepPopulated = true;
18896
18935
  populated.__deepPopulateConfig = config2;
18897
- const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
18936
+ const dependencies = [
18937
+ ...[...resolvedRelations.keys()].filter((r) => !r.startsWith("api::")),
18938
+ // Remove content-types from resolved relations
18939
+ ...resolvedSchemas.values()
18940
+ ];
18898
18941
  return { populate: populated, dependencies };
18899
18942
  }
18900
18943
  const populate = ({ strapi: strapi2 }) => ({
@@ -1,3 +1,5 @@
1
+ import type { UID } from "@strapi/strapi";
2
+ export declare function clearCacheForChangedSchemas(schemas: UID.Schema[]): Promise<void>;
1
3
  declare const _default: ({ strapi }: {
2
4
  strapi: any;
3
5
  }) => Promise<void>;
@@ -1,11 +1,11 @@
1
- export declare const error: (msg: any, context?: any) => import("winston").Logger;
2
- export declare const warn: (msg: any, context?: any) => import("winston").Logger;
3
- export declare const info: (msg: any, context?: any) => import("winston").Logger;
4
- export declare const debug: (msg: any, context?: any) => import("winston").Logger;
1
+ export declare const error: (msg: string, context?: any) => import("winston").Logger;
2
+ export declare const warn: (msg: string, context?: any) => import("winston").Logger;
3
+ export declare const info: (msg: string, context?: any) => import("winston").Logger;
4
+ export declare const debug: (msg: string, context?: any) => import("winston").Logger;
5
5
  declare const _default: {
6
- error: (msg: any, context?: any) => import("winston").Logger;
7
- warn: (msg: any, context?: any) => import("winston").Logger;
8
- info: (msg: any, context?: any) => import("winston").Logger;
9
- debug: (msg: any, context?: any) => import("winston").Logger;
6
+ error: (msg: string, context?: any) => import("winston").Logger;
7
+ warn: (msg: string, context?: any) => import("winston").Logger;
8
+ info: (msg: string, context?: any) => import("winston").Logger;
9
+ debug: (msg: string, context?: any) => import("winston").Logger;
10
10
  };
11
11
  export default _default;
@@ -0,0 +1 @@
1
+ export declare const majorMinorVersion: string;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.14.0",
2
+ "version": "1.15.0-rc.0",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",