import copy from 'fast-copy' ; import { freezeSys , toPlainObject } from 'contentful-sdk-core' ; import enhanceWithMethods from '../enhance-with-methods' ; import createOrganizationApi , { ContentfulOrganizationAPI } from '../create-organization-api' ; import { wrapCollection } from '../common-utils' ; import { MetaSysProps , DefaultElements , MakeRequest } from '../common-types' ; export type Organization = DefaultElements < OrganizationProp > & OrganizationProp & ContentfulOrganizationAPI ; export type OrganizationProp = { /**
     * System metadata
     */ sys : MetaSysProps ; /**
     * Name
     */ name : string ; } ; private param makeRequest param data return { Organization } export function wrapOrganization ( makeRequest , data ) { const org = toPlainObject ( copy ( data ) ) ; const orgApi = createOrganizationApi ( makeRequest ) ; const enhancedOrganization = enhanceWithMethods ( org , orgApi ) ; return freezeSys ( enhancedOrganization ) ; } private export const wrapOrganizationCollection = wrapCollection ( wrapOrganization ) ;