When working with payload cms, I sometimes need to check what is in the system collections of payload.
There is e.g. payload-preferences
or payload-migrations
. Since 3.0 there is also
payload-jobs
for the neat queue system and payload-locked-documents
for the document locking.
As a quick help for this I sometimes add this to the plugins
array of the payload config:
plugins: [
(
() =>
(incomingConfig: Config): Config => {
const config: Config = { ...incomingConfig }
config.onInit = async (payload: Payload) => {
if (incomingConfig.onInit) await incomingConfig.onInit(payload)
for (const collectionName of Object.keys(payload.collections)) {
if (payload.collections[collectionName as CollectionSlug].config?.admin?.hidden) {
payload.collections[collectionName as CollectionSlug].config.admin.hidden = false
payload.collections[collectionName as CollectionSlug].config.admin.group = 'System'
}
}
}
return config
}
)(),
],
This makes all initially admin.hidden
collections visible (in the onInit
execution).
I strongly suggest not to tinker with the data in it - but if you just need to look at it - it works.