@websolutespa/payload-plugin-bowl
Version:
Bowl PayloadCms plugin of the BOM Repository
27 lines (26 loc) • 1 kB
JavaScript
import { deepMerge, withGlobalHook } from '@websolutespa/payload-utils';
import { options } from '../../options';
import { roles } from '../../types';
import { isRole } from '../access';
import { afterGlobalReadHook } from '../api/global.service';
import { translateGlobal } from '../translations';
export const GlobalDefault = {
admin: {
group: options.group.config
},
access: {
read: isRole(roles.Admin, roles.Contributor, roles.Editor, roles.Guest, roles.User),
update: isRole(roles.Admin, roles.Contributor, roles.Editor)
}
};
/**
*
* @param {GlobalConfig} config
* @returns {GlobalConfig} Return a `GlobalConfig` with inherited fields: `id`, `createdAt`, `updatedAt`.
*/ export const withGlobal = (config)=>{
const globalConfig = deepMerge(GlobalDefault, config);
withGlobalHook(globalConfig, 'afterRead', afterGlobalReadHook(globalConfig));
translateGlobal(globalConfig);
return globalConfig;
};
//# sourceMappingURL=withGlobal.js.map