@fourlights/strapi-plugin-deep-populate 1.13.0-rc.0 → 1.14.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/README.md
CHANGED
|
@@ -149,7 +149,26 @@ Settings are applied in the following priority order (highest to lowest):
|
|
|
149
149
|
|
|
150
150
|
### Caching
|
|
151
151
|
|
|
152
|
-
The plugin caches populate objects to improve performance. Cache can be disabled
|
|
152
|
+
The plugin caches populate objects to improve performance. Cache can be disabled
|
|
153
|
+
via the `useCache` setting. Cache entires are persisted in the database and can
|
|
154
|
+
become stale after content-type updates. You can use the `cacheOptions > clearCacheOnStartup` to force cache purging on server start.
|
|
155
|
+
|
|
156
|
+
#### Cache Configuration
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
// config/plugins.js
|
|
160
|
+
module.exports = ({ env }) => ({
|
|
161
|
+
'deep-populate': {
|
|
162
|
+
enabled: true,
|
|
163
|
+
config: {
|
|
164
|
+
useCache: true, // Enable caching (default: true)
|
|
165
|
+
cacheOptions: {
|
|
166
|
+
clearCacheOnStartup: false, // Clear cache on server startup (default: false)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
```
|
|
153
172
|
|
|
154
173
|
### Creator Fields
|
|
155
174
|
|
|
@@ -194,3 +213,30 @@ The plugin recursively:
|
|
|
194
213
|
4. Returns a complete populate object
|
|
195
214
|
|
|
196
215
|
This process handles all relation types including dynamic zones and circular references.
|
|
216
|
+
|
|
217
|
+
----
|
|
218
|
+
|
|
219
|
+
## Troubleshooting
|
|
220
|
+
|
|
221
|
+
Due to the dynamic nature of Strapi, stuff becomes complex pretty quickly and it can sometimes become tricky to see the proverbial forest through the trees.
|
|
222
|
+
In that case, feel free to open up an issue and I'll try to help you out.
|
|
223
|
+
|
|
224
|
+
But first, make sure you:
|
|
225
|
+
|
|
226
|
+
1. use the latest version of the plugin
|
|
227
|
+
2. use the latest version of Strapi
|
|
228
|
+
3. see if disabling the cache fixes the problem
|
|
229
|
+
4. check if your content-types are still valid, e.g. no dynamic zones who reference deleted components etc.
|
|
230
|
+
5. check you don't have attributes/relations marked as private if you expect them in the API response
|
|
231
|
+
|
|
232
|
+
If that didn't fix it, open up that issue! Make sure you report the used versions (plugin & strapi) and preferably share the affected content-type definitions. Or even better, a reproduction of the problem.
|
|
233
|
+
|
|
234
|
+
----
|
|
235
|
+
|
|
236
|
+
## Star History
|
|
237
|
+
|
|
238
|
+
[](https://www.star-history.com/#Four-Lights-NL/strapi-plugin-deep-populate&type=date&legend=top-left)
|
|
239
|
+
|
|
240
|
+
Thanks for reading and using the plugin. If you like it, consider starring it to give me a nice little dopamine hit next time I'm working on it.
|
|
241
|
+
|
|
242
|
+
### Built with ☕ in [Deventer, NL](https://en.wikipedia.org/wiki/Deventer).
|
package/dist/server/index.js
CHANGED
|
@@ -54,6 +54,20 @@ const isEqual__default = /* @__PURE__ */ _interopDefault(isEqual);
|
|
|
54
54
|
const merge__default = /* @__PURE__ */ _interopDefault(merge$2);
|
|
55
55
|
const mergeWith__default = /* @__PURE__ */ _interopDefault(mergeWith);
|
|
56
56
|
const set__default = /* @__PURE__ */ _interopDefault(set$2);
|
|
57
|
+
const bootstrap = async ({ strapi: strapi2 }) => {
|
|
58
|
+
const { cacheOptions } = strapi2.config.get("plugin::deep-populate");
|
|
59
|
+
if (cacheOptions?.clearCacheOnStartup === true) {
|
|
60
|
+
try {
|
|
61
|
+
await strapi2.db.query("plugin::deep-populate.cache").deleteMany({
|
|
62
|
+
where: {
|
|
63
|
+
id: { $gt: 0 }
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
} catch (error2) {
|
|
67
|
+
strapi2.log.error("❌ Error during startup cache deletion:", error2);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
57
71
|
const config$1 = {
|
|
58
72
|
default: ({ env: env2 }) => ({ useCache: true, replaceWildcard: true, contentTypes: {} }),
|
|
59
73
|
validator: (config2) => {
|
|
@@ -18508,7 +18522,7 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18508
18522
|
return result;
|
|
18509
18523
|
});
|
|
18510
18524
|
};
|
|
18511
|
-
const version = "1.
|
|
18525
|
+
const version = "1.14.0";
|
|
18512
18526
|
const name = "@fourlights/strapi-plugin-deep-populate";
|
|
18513
18527
|
const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
|
|
18514
18528
|
const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
|
|
@@ -18927,6 +18941,7 @@ const services = {
|
|
|
18927
18941
|
cache
|
|
18928
18942
|
};
|
|
18929
18943
|
const index = {
|
|
18944
|
+
bootstrap,
|
|
18930
18945
|
config: config$1,
|
|
18931
18946
|
contentTypes,
|
|
18932
18947
|
services,
|
package/dist/server/index.mjs
CHANGED
|
@@ -26,6 +26,20 @@ import isEqual from "lodash/isEqual";
|
|
|
26
26
|
import merge$2 from "lodash/merge";
|
|
27
27
|
import mergeWith$1 from "lodash/mergeWith";
|
|
28
28
|
import set$2 from "lodash/set";
|
|
29
|
+
const bootstrap = async ({ strapi: strapi2 }) => {
|
|
30
|
+
const { cacheOptions } = strapi2.config.get("plugin::deep-populate");
|
|
31
|
+
if (cacheOptions?.clearCacheOnStartup === true) {
|
|
32
|
+
try {
|
|
33
|
+
await strapi2.db.query("plugin::deep-populate.cache").deleteMany({
|
|
34
|
+
where: {
|
|
35
|
+
id: { $gt: 0 }
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
} catch (error2) {
|
|
39
|
+
strapi2.log.error("❌ Error during startup cache deletion:", error2);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
29
43
|
const config$1 = {
|
|
30
44
|
default: ({ env: env2 }) => ({ useCache: true, replaceWildcard: true, contentTypes: {} }),
|
|
31
45
|
validator: (config2) => {
|
|
@@ -18480,7 +18494,7 @@ const register = async ({ strapi: strapi2 }) => {
|
|
|
18480
18494
|
return result;
|
|
18481
18495
|
});
|
|
18482
18496
|
};
|
|
18483
|
-
const version = "1.
|
|
18497
|
+
const version = "1.14.0";
|
|
18484
18498
|
const name = "@fourlights/strapi-plugin-deep-populate";
|
|
18485
18499
|
const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
|
|
18486
18500
|
const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
|
|
@@ -18899,6 +18913,7 @@ const services = {
|
|
|
18899
18913
|
cache
|
|
18900
18914
|
};
|
|
18901
18915
|
const index = {
|
|
18916
|
+
bootstrap,
|
|
18902
18917
|
config: config$1,
|
|
18903
18918
|
contentTypes,
|
|
18904
18919
|
services,
|
|
@@ -13,8 +13,12 @@ export type ContentTypeConfig = {
|
|
|
13
13
|
allow?: ContentTypeConfigAllow;
|
|
14
14
|
deny?: ContentTypeConfigDeny;
|
|
15
15
|
};
|
|
16
|
+
export type CacheOptions = {
|
|
17
|
+
clearCacheOnStartup?: boolean;
|
|
18
|
+
};
|
|
16
19
|
export type Config = {
|
|
17
20
|
useCache: boolean;
|
|
21
|
+
cacheOptions?: CacheOptions;
|
|
18
22
|
replaceWildcard: boolean;
|
|
19
23
|
omitEmpty?: boolean;
|
|
20
24
|
localizations?: boolean;
|
package/package.json
CHANGED