@fourlights/strapi-plugin-deep-populate 1.2.3 → 1.2.4
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 +7 -1
- package/dist/server/index.mjs +7 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -200,7 +200,13 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
200
200
|
return entry ? entry.populate : null;
|
|
201
201
|
},
|
|
202
202
|
async set({ populate: populate2, dependencies, ...params }) {
|
|
203
|
-
|
|
203
|
+
const documentService = strapi2.documents("plugin::deep-populate.cache");
|
|
204
|
+
const hash = getHash(params);
|
|
205
|
+
const entry = await documentService.findFirst({ filters: { hash: { $eq: hash } } });
|
|
206
|
+
return entry ? await documentService.update({
|
|
207
|
+
documentId: entry.documentId,
|
|
208
|
+
data: { populate: populate2, dependencies: dependencies.join(",") }
|
|
209
|
+
}) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
|
|
204
210
|
},
|
|
205
211
|
async clear(params) {
|
|
206
212
|
const entry = await strapi2.documents("plugin::deep-populate.cache").findFirst({ filters: { hash: { $eq: getHash(params) } } });
|
package/dist/server/index.mjs
CHANGED
|
@@ -186,7 +186,13 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
186
186
|
return entry ? entry.populate : null;
|
|
187
187
|
},
|
|
188
188
|
async set({ populate: populate2, dependencies, ...params }) {
|
|
189
|
-
|
|
189
|
+
const documentService = strapi2.documents("plugin::deep-populate.cache");
|
|
190
|
+
const hash = getHash(params);
|
|
191
|
+
const entry = await documentService.findFirst({ filters: { hash: { $eq: hash } } });
|
|
192
|
+
return entry ? await documentService.update({
|
|
193
|
+
documentId: entry.documentId,
|
|
194
|
+
data: { populate: populate2, dependencies: dependencies.join(",") }
|
|
195
|
+
}) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
|
|
190
196
|
},
|
|
191
197
|
async clear(params) {
|
|
192
198
|
const entry = await strapi2.documents("plugin::deep-populate.cache").findFirst({ filters: { hash: { $eq: getHash(params) } } });
|
package/package.json
CHANGED