contentful-management
Version:
Client for Contentful's Content Management API
15 lines • 583 B
JavaScript
import { freezeSys, toPlainObject } from 'contentful-sdk-core';
import copy from 'fast-copy';
import createUserUIConfigApi from '../create-user-ui-config-api';
import enhanceWithMethods from '../enhance-with-methods';
/**
* @private
* @param makeRequest - function to make requests via an adapter
* @param data - Raw data
* @return Wrapped UserUIConfig
*/
export function wrapUserUIConfig(makeRequest, data) {
const user = toPlainObject(copy(data));
const userWithMethods = enhanceWithMethods(user, createUserUIConfigApi(makeRequest));
return freezeSys(userWithMethods);
}