UNPKG

contentful-management

Version:
27 lines (25 loc) 782 B
import { freezeSys, toPlainObject } from 'contentful-sdk-core'; import copy from 'fast-copy'; import { wrapCollection } from '../common-utils'; import enhanceWithMethods from '../enhance-with-methods'; /** * @private */ function createPreviewApiKeyApi() { return {}; } /** * @private * @param makeRequest - function to make requests via an adapter * @param data - Raw api key data * @return Wrapped preview api key data */ export function wrapPreviewApiKey(_makeRequest, data) { const previewApiKey = toPlainObject(copy(data)); const previewApiKeyWithMethods = enhanceWithMethods(previewApiKey, createPreviewApiKeyApi()); return freezeSys(previewApiKeyWithMethods); } /** * @private */ export const wrapPreviewApiKeyCollection = wrapCollection(wrapPreviewApiKey);