@fourlights/strapi-plugin-deep-populate 1.11.1-rc.0 → 1.12.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.
package/dist/server/index.js
CHANGED
|
@@ -18467,11 +18467,11 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18467
18467
|
context.fields = ["documentId", "status", "locale"];
|
|
18468
18468
|
const result = await next();
|
|
18469
18469
|
if (!result) return result;
|
|
18470
|
-
if (["create", "update"].includes(context.action)) {
|
|
18470
|
+
if (["create", "update", "publish"].includes(context.action)) {
|
|
18471
18471
|
const { documentId, publishedAt, locale: locale2 } = result;
|
|
18472
18472
|
const status = publishedAt !== null ? "published" : "draft";
|
|
18473
|
-
|
|
18474
|
-
|
|
18473
|
+
const refreshCache = useCache && ["update", "publish"].includes(context.action);
|
|
18474
|
+
if (refreshCache) await cacheService.clear({ ...context.params, status, contentType: context.uid });
|
|
18475
18475
|
if (useCache || returnDeeplyPopulated) {
|
|
18476
18476
|
const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
|
|
18477
18477
|
if (returnDeeplyPopulated)
|
|
@@ -18508,7 +18508,7 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18508
18508
|
return result;
|
|
18509
18509
|
});
|
|
18510
18510
|
};
|
|
18511
|
-
const version = "1.
|
|
18511
|
+
const version = "1.12.0";
|
|
18512
18512
|
const name = "@fourlights/strapi-plugin-deep-populate";
|
|
18513
18513
|
const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
|
|
18514
18514
|
const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
|
|
@@ -18615,8 +18615,9 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
18615
18615
|
await this.refreshDependents(params.documentId);
|
|
18616
18616
|
return retval;
|
|
18617
18617
|
},
|
|
18618
|
-
async refreshDependents(documentId) {
|
|
18619
|
-
|
|
18618
|
+
async refreshDependents(documentId, status) {
|
|
18619
|
+
let entries = await strapi2.documents("plugin::deep-populate.cache").findMany({ filters: { dependencies: { $contains: documentId } }, fields: ["documentId", "params"] });
|
|
18620
|
+
if (status !== void 0) entries = entries.filter((entry) => entry.params.status === status);
|
|
18620
18621
|
const deleted = await strapi2.db.query("plugin::deep-populate.cache").deleteMany({
|
|
18621
18622
|
where: {
|
|
18622
18623
|
documentId: { $in: entries.map((x) => x.documentId) }
|
|
@@ -18643,15 +18644,10 @@ async function _populateComponent({
|
|
|
18643
18644
|
}) {
|
|
18644
18645
|
const componentLookup = lookup.length === 0 ? [attrName] : [...lookup, inDynamicZone ? "on" : "populate", attrName];
|
|
18645
18646
|
if (strapi.getModel(schema2) === void 0) {
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
{ lookup }
|
|
18651
|
-
);
|
|
18652
|
-
} else {
|
|
18653
|
-
log.warn(`[Plugin: Deep Populate] Could not find component: '${schema2}'`);
|
|
18654
|
-
}
|
|
18647
|
+
log.warn(
|
|
18648
|
+
inDynamicZone ? `The dynamic zone '${lookup[lookup.length - 1]}' is referencing a non-existing component '${schema2}'. You should fix this.` : `Could not find component: '${schema2}'`,
|
|
18649
|
+
{ lookup }
|
|
18650
|
+
);
|
|
18655
18651
|
return true;
|
|
18656
18652
|
}
|
|
18657
18653
|
const componentPopulate = populate2;
|
|
@@ -18775,7 +18771,8 @@ async function _populate({
|
|
|
18775
18771
|
const newPopulate = {};
|
|
18776
18772
|
const model = strapi.getModel(schema2);
|
|
18777
18773
|
if (!model) {
|
|
18778
|
-
log.warn(`Could not find model for contentType: '${schema2}'`);
|
|
18774
|
+
strapi.log.warn(`[Plugin: Deep Populate] Could not find model for contentType: '${schema2}'`);
|
|
18775
|
+
strapi.log.warn("Please create a bug report and share the troublesome contentType.");
|
|
18779
18776
|
return {};
|
|
18780
18777
|
}
|
|
18781
18778
|
let relations = getRelations(model);
|
|
@@ -18904,7 +18901,8 @@ async function populate$1(params) {
|
|
|
18904
18901
|
});
|
|
18905
18902
|
populated.__deepPopulated = true;
|
|
18906
18903
|
populated.__deepPopulateConfig = config2;
|
|
18907
|
-
|
|
18904
|
+
const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
|
|
18905
|
+
return { populate: populated, dependencies };
|
|
18908
18906
|
}
|
|
18909
18907
|
const populate = ({ strapi: strapi2 }) => ({
|
|
18910
18908
|
async get(params) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -18439,11 +18439,11 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18439
18439
|
context.fields = ["documentId", "status", "locale"];
|
|
18440
18440
|
const result = await next();
|
|
18441
18441
|
if (!result) return result;
|
|
18442
|
-
if (["create", "update"].includes(context.action)) {
|
|
18442
|
+
if (["create", "update", "publish"].includes(context.action)) {
|
|
18443
18443
|
const { documentId, publishedAt, locale: locale2 } = result;
|
|
18444
18444
|
const status = publishedAt !== null ? "published" : "draft";
|
|
18445
|
-
|
|
18446
|
-
|
|
18445
|
+
const refreshCache = useCache && ["update", "publish"].includes(context.action);
|
|
18446
|
+
if (refreshCache) await cacheService.clear({ ...context.params, status, contentType: context.uid });
|
|
18447
18447
|
if (useCache || returnDeeplyPopulated) {
|
|
18448
18448
|
const deepPopulate = await populateService.get({ contentType: context.uid, documentId, status, locale: locale2 });
|
|
18449
18449
|
if (returnDeeplyPopulated)
|
|
@@ -18480,7 +18480,7 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18480
18480
|
return result;
|
|
18481
18481
|
});
|
|
18482
18482
|
};
|
|
18483
|
-
const version = "1.
|
|
18483
|
+
const version = "1.12.0";
|
|
18484
18484
|
const name = "@fourlights/strapi-plugin-deep-populate";
|
|
18485
18485
|
const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
|
|
18486
18486
|
const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
|
|
@@ -18587,8 +18587,9 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
18587
18587
|
await this.refreshDependents(params.documentId);
|
|
18588
18588
|
return retval;
|
|
18589
18589
|
},
|
|
18590
|
-
async refreshDependents(documentId) {
|
|
18591
|
-
|
|
18590
|
+
async refreshDependents(documentId, status) {
|
|
18591
|
+
let entries = await strapi2.documents("plugin::deep-populate.cache").findMany({ filters: { dependencies: { $contains: documentId } }, fields: ["documentId", "params"] });
|
|
18592
|
+
if (status !== void 0) entries = entries.filter((entry) => entry.params.status === status);
|
|
18592
18593
|
const deleted = await strapi2.db.query("plugin::deep-populate.cache").deleteMany({
|
|
18593
18594
|
where: {
|
|
18594
18595
|
documentId: { $in: entries.map((x) => x.documentId) }
|
|
@@ -18615,15 +18616,10 @@ async function _populateComponent({
|
|
|
18615
18616
|
}) {
|
|
18616
18617
|
const componentLookup = lookup.length === 0 ? [attrName] : [...lookup, inDynamicZone ? "on" : "populate", attrName];
|
|
18617
18618
|
if (strapi.getModel(schema2) === void 0) {
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
{ lookup }
|
|
18623
|
-
);
|
|
18624
|
-
} else {
|
|
18625
|
-
log.warn(`[Plugin: Deep Populate] Could not find component: '${schema2}'`);
|
|
18626
|
-
}
|
|
18619
|
+
log.warn(
|
|
18620
|
+
inDynamicZone ? `The dynamic zone '${lookup[lookup.length - 1]}' is referencing a non-existing component '${schema2}'. You should fix this.` : `Could not find component: '${schema2}'`,
|
|
18621
|
+
{ lookup }
|
|
18622
|
+
);
|
|
18627
18623
|
return true;
|
|
18628
18624
|
}
|
|
18629
18625
|
const componentPopulate = populate2;
|
|
@@ -18747,7 +18743,8 @@ async function _populate({
|
|
|
18747
18743
|
const newPopulate = {};
|
|
18748
18744
|
const model = strapi.getModel(schema2);
|
|
18749
18745
|
if (!model) {
|
|
18750
|
-
log.warn(`Could not find model for contentType: '${schema2}'`);
|
|
18746
|
+
strapi.log.warn(`[Plugin: Deep Populate] Could not find model for contentType: '${schema2}'`);
|
|
18747
|
+
strapi.log.warn("Please create a bug report and share the troublesome contentType.");
|
|
18751
18748
|
return {};
|
|
18752
18749
|
}
|
|
18753
18750
|
let relations = getRelations(model);
|
|
@@ -18876,7 +18873,8 @@ async function populate$1(params) {
|
|
|
18876
18873
|
});
|
|
18877
18874
|
populated.__deepPopulated = true;
|
|
18878
18875
|
populated.__deepPopulateConfig = config2;
|
|
18879
|
-
|
|
18876
|
+
const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
|
|
18877
|
+
return { populate: populated, dependencies };
|
|
18880
18878
|
}
|
|
18881
18879
|
const populate = ({ strapi: strapi2 }) => ({
|
|
18882
18880
|
async get(params) {
|
|
@@ -81,7 +81,7 @@ declare const _default: {
|
|
|
81
81
|
dependencies: string[];
|
|
82
82
|
}): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
83
83
|
clear(params: import("./services/populate").PopulateParams): Promise<any>;
|
|
84
|
-
refreshDependents(documentId: string): Promise<void>;
|
|
84
|
+
refreshDependents(documentId: string, status?: "published" | "draft"): Promise<void>;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
register: ({ strapi }: {
|
|
@@ -9,6 +9,6 @@ declare const _default: ({ strapi }: {
|
|
|
9
9
|
get(params: PopulateParams): Promise<any>;
|
|
10
10
|
set({ populate, dependencies, ...params }: SetPopulateParams): Promise<Modules.Documents.AnyDocument>;
|
|
11
11
|
clear(params: PopulateParams): Promise<any>;
|
|
12
|
-
refreshDependents(documentId: string): Promise<void>;
|
|
12
|
+
refreshDependents(documentId: string, status?: "draft" | "published" | undefined): Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
export default _default;
|
|
@@ -22,7 +22,7 @@ declare const _default: {
|
|
|
22
22
|
dependencies: string[];
|
|
23
23
|
}): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
24
24
|
clear(params: import("./populate").PopulateParams): Promise<any>;
|
|
25
|
-
refreshDependents(documentId: string): Promise<void>;
|
|
25
|
+
refreshDependents(documentId: string, status?: "published" | "draft"): Promise<void>;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.12.0",
|
|
3
3
|
"keywords": [
|
|
4
4
|
"strapi",
|
|
5
5
|
"strapi-plugin",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"verify": "strapi-plugin verify",
|
|
28
28
|
"test": "npm-run-all --parallel test:*",
|
|
29
29
|
"test:ts:back": "tsc -p server/tsconfig.json",
|
|
30
|
-
"test:integration": "vitest
|
|
30
|
+
"test:integration": "vitest",
|
|
31
31
|
"ci": "biome ci server",
|
|
32
32
|
"release": "release-it",
|
|
33
33
|
"playground:install": "cd playground && $npm_execpath install"
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@biomejs/biome": "^2.
|
|
40
|
-
"@strapi/database": "^5.
|
|
39
|
+
"@biomejs/biome": "^2.3.6",
|
|
40
|
+
"@strapi/database": "^5.31.0",
|
|
41
41
|
"@strapi/sdk-plugin": "^5.3.2",
|
|
42
|
-
"@strapi/strapi": "^5.
|
|
43
|
-
"@strapi/typescript-utils": "^5.
|
|
44
|
-
"@strapi/utils": "^5.
|
|
42
|
+
"@strapi/strapi": "^5.31.0",
|
|
43
|
+
"@strapi/typescript-utils": "^5.31.0",
|
|
44
|
+
"@strapi/utils": "^5.31.0",
|
|
45
45
|
"@types/supertest": "^6.0.3",
|
|
46
46
|
"better-sqlite3": "^12.4.1",
|
|
47
47
|
"npm-run-all": "^4.1.5",
|
|
48
|
-
"release-it": "^19.0.
|
|
49
|
-
"simple-git": "^3.
|
|
48
|
+
"release-it": "^19.0.6",
|
|
49
|
+
"simple-git": "^3.30.0",
|
|
50
50
|
"supertest": "^7.1.4",
|
|
51
51
|
"ts-node": "^10.9.2",
|
|
52
|
-
"typescript": "^5.9.
|
|
53
|
-
"vite": "^7.
|
|
54
|
-
"vitest": "^
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"vite": "^7.2.2",
|
|
54
|
+
"vitest": "^4.0.10"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"@strapi/sdk-plugin": "^5",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
61
|
"vite": "$vite",
|
|
62
|
-
"esbuild": "
|
|
62
|
+
"esbuild": "0.27.0"
|
|
63
63
|
},
|
|
64
64
|
"strapi": {
|
|
65
65
|
"kind": "plugin",
|