UNPKG

contentful-management

Version:
15 lines 562 B
import { freezeSys, toPlainObject } from 'contentful-sdk-core'; import copy from 'fast-copy'; import createUIConfigApi from '../create-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 UIConfig */ export function wrapUIConfig(makeRequest, data) { const user = toPlainObject(copy(data)); const userWithMethods = enhanceWithMethods(user, createUIConfigApi(makeRequest)); return freezeSys(userWithMethods); }