@fourlights/strapi-plugin-deep-populate 1.3.0 → 1.4.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 +31 -1
- package/dist/server/index.js +446 -11321
- package/dist/server/index.mjs +508 -11394
- package/dist/server/src/config/index.d.ts +20 -1
- package/dist/server/src/index.d.ts +2 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ It does not impose a limit on the level of nesting and can cache the populate ob
|
|
|
12
12
|
- Handles circular references and edge cases
|
|
13
13
|
- Includes caching for improved performance
|
|
14
14
|
- Honors `populateCreatorFields` setting
|
|
15
|
+
- Supports optional allow/deny lists for specific relations or components during population
|
|
15
16
|
|
|
16
17
|
## Installation
|
|
17
18
|
|
|
@@ -72,7 +73,36 @@ The plugin caches populate objects to improve performance. Cache can be disabled
|
|
|
72
73
|
|
|
73
74
|
The plugin automatically populates `createdBy` and `updatedBy` fields when `populateCreatorFields` is enabled in the content-type configuration.
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
### Allow / Deny Lists
|
|
77
|
+
|
|
78
|
+
Sometimes you may want to restrict the nested population of certain relations or components. For example if you have a `Page` contentType where a deeply nested `Link` component has a relation to another `Page`.
|
|
79
|
+
In those situations you can use the allow or deny lists to control where the plugin should stop resolving nested relations.
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
// config/plugins.js
|
|
83
|
+
module.exports = ({ env }) => ({
|
|
84
|
+
'deep-populate': {
|
|
85
|
+
enabled: true,
|
|
86
|
+
config: {
|
|
87
|
+
useCache: true,
|
|
88
|
+
replaceWildcard: true,
|
|
89
|
+
|
|
90
|
+
contentTypes: {
|
|
91
|
+
'api::page.page': {
|
|
92
|
+
deny: {
|
|
93
|
+
relations: ['api::page.page'] // prevent resolving nested pages when populating a page
|
|
94
|
+
// alternatively we could have denied the link component in this case
|
|
95
|
+
// components: ['shared.link']
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## How The Plugin Works
|
|
76
106
|
|
|
77
107
|
The plugin recursively:
|
|
78
108
|
1. Traverses the content-type schema
|