@fourlights/strapi-plugin-deep-populate 1.11.1 → 1.13.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.
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.13.0-rc.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) }
|
|
@@ -18680,7 +18681,14 @@ async function _populateDynamicZone({
|
|
|
18680
18681
|
...params
|
|
18681
18682
|
});
|
|
18682
18683
|
const currentPopulate = get__default.default(resolvedPopulate, [component]);
|
|
18683
|
-
|
|
18684
|
+
let mergedComponentPopulate;
|
|
18685
|
+
if (currentPopulate === void 0) {
|
|
18686
|
+
mergedComponentPopulate = typeof componentPopulate === "boolean" ? componentPopulate : sanitizeObject(componentPopulate);
|
|
18687
|
+
} else if (typeof currentPopulate === "boolean") {
|
|
18688
|
+
mergedComponentPopulate = typeof componentPopulate === "boolean" ? currentPopulate || componentPopulate : currentPopulate;
|
|
18689
|
+
} else if (typeof currentPopulate === "object") {
|
|
18690
|
+
mergedComponentPopulate = typeof componentPopulate === "object" ? merge__default.default(currentPopulate, sanitizeObject(componentPopulate)) : currentPopulate;
|
|
18691
|
+
}
|
|
18684
18692
|
set__default.default(resolvedPopulate, [component], mergedComponentPopulate);
|
|
18685
18693
|
}
|
|
18686
18694
|
if (isEmpty(resolvedPopulate)) return void 0;
|
|
@@ -18900,7 +18908,8 @@ async function populate$1(params) {
|
|
|
18900
18908
|
});
|
|
18901
18909
|
populated.__deepPopulated = true;
|
|
18902
18910
|
populated.__deepPopulateConfig = config2;
|
|
18903
|
-
|
|
18911
|
+
const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
|
|
18912
|
+
return { populate: populated, dependencies };
|
|
18904
18913
|
}
|
|
18905
18914
|
const populate = ({ strapi: strapi2 }) => ({
|
|
18906
18915
|
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.13.0-rc.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) }
|
|
@@ -18652,7 +18653,14 @@ async function _populateDynamicZone({
|
|
|
18652
18653
|
...params
|
|
18653
18654
|
});
|
|
18654
18655
|
const currentPopulate = get$2(resolvedPopulate, [component]);
|
|
18655
|
-
|
|
18656
|
+
let mergedComponentPopulate;
|
|
18657
|
+
if (currentPopulate === void 0) {
|
|
18658
|
+
mergedComponentPopulate = typeof componentPopulate === "boolean" ? componentPopulate : sanitizeObject(componentPopulate);
|
|
18659
|
+
} else if (typeof currentPopulate === "boolean") {
|
|
18660
|
+
mergedComponentPopulate = typeof componentPopulate === "boolean" ? currentPopulate || componentPopulate : currentPopulate;
|
|
18661
|
+
} else if (typeof currentPopulate === "object") {
|
|
18662
|
+
mergedComponentPopulate = typeof componentPopulate === "object" ? merge$2(currentPopulate, sanitizeObject(componentPopulate)) : currentPopulate;
|
|
18663
|
+
}
|
|
18656
18664
|
set$2(resolvedPopulate, [component], mergedComponentPopulate);
|
|
18657
18665
|
}
|
|
18658
18666
|
if (isEmpty(resolvedPopulate)) return void 0;
|
|
@@ -18872,7 +18880,8 @@ async function populate$1(params) {
|
|
|
18872
18880
|
});
|
|
18873
18881
|
populated.__deepPopulated = true;
|
|
18874
18882
|
populated.__deepPopulateConfig = config2;
|
|
18875
|
-
|
|
18883
|
+
const dependencies = [...resolvedRelations.keys()].filter((r) => !r.startsWith("api::"));
|
|
18884
|
+
return { populate: populated, dependencies };
|
|
18876
18885
|
}
|
|
18877
18886
|
const populate = ({ strapi: strapi2 }) => ({
|
|
18878
18887
|
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