How to use the contentful-sdk-core.freezeSys function in contentful-sdk-core

To help you get started, we’ve selected a few contentful-sdk-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github contentful / contentful.js / lib / paged-sync.js View on Github external
// clones response.items used in includes because we don't want these to be mutated
      if (resolveLinks) {
        response.items = resolveResponse(response, {removeUnresolved, itemEntryPoints: ['fields']})
      }
      // maps response items again after getters are attached
      const mappedResponseItems = mapResponseItems(response.items)

      if (response.nextSyncToken) {
        mappedResponseItems.nextSyncToken = response.nextSyncToken
      }

      if (response.nextPageToken) {
        mappedResponseItems.nextPageToken = response.nextPageToken
      }

      return freezeSys(mixinStringifySafe(toPlainObject(mappedResponseItems)))
    }, (error) => {
      throw error
github contentful / contentful-management.js / lib / entities / role.js View on Github external
export function wrapRole (http, data) {
  const role = toPlainObject(cloneDeep(data))
  enhanceWithMethods(role, createRoleApi(http))
  return freezeSys(role)
}
github contentful / contentful-management.js / lib / entities / role.js View on Github external
export function wrapRoleCollection (http, data) {
  const roles = toPlainObject(cloneDeep(data))
  roles.items = roles.items.map((entity) => wrapRole(http, entity))
  return freezeSys(roles)
}
github contentful / contentful-management.js / lib / entities / asset.js View on Github external
export function wrapAssetCollection (http, data) {
  const assets = toPlainObject(cloneDeep(data))
  assets.items = assets.items.map((entity) => wrapAsset(http, entity))
  return freezeSys(assets)
}
github contentful / contentful-management.js / lib / entities / environment.js View on Github external
export function wrapEnvironmentCollection (http, data) {
  const environments = toPlainObject(cloneDeep(data))
  environments.items = environments.items.map((entity) => wrapEnvironment(http, entity))
  return freezeSys(environments)
}
github contentful / contentful-management.js / lib / entities / asset.js View on Github external
export function wrapAsset (http, data) {
  const asset = toPlainObject(cloneDeep(data))
  enhanceWithMethods(asset, createAssetApi(http))
  return freezeSys(asset)
}
github contentful / contentful-management.js / lib / entities / personal-access-token.js View on Github external
export function wrapPersonalAccessToken (http, data) {
  const personalAccessToken = toPlainObject(cloneDeep(data))
  enhanceWithMethods(personalAccessToken, createPersonalAccessToken(http))
  return freezeSys(personalAccessToken)
}
github contentful / contentful-management.js / lib / entities / environment.js View on Github external
hostUpload,
    defaultHostnameUpload
  } = http.httpClientParams
  const environmentScopedHttpClient = http.cloneWithNewParams({
    baseURL: http.defaults.baseURL + 'environments/' + environment.sys.id
  })
  const environmentScopedUploadClient = http.cloneWithNewParams({
    space: environment.sys.space.sys.id,
    host: hostUpload || defaultHostnameUpload
  })
  const environmentApi = createEnvironmentApi({
    http: environmentScopedHttpClient,
    httpUpload: environmentScopedUploadClient
  })
  const enhancedEnvironment = enhanceWithMethods(environment, environmentApi)
  return freezeSys(enhancedEnvironment)
}
github contentful / contentful-management.js / lib / entities / webhook.js View on Github external
export function wrapWebhookCollection (http, data) {
  const webhooks = toPlainObject(cloneDeep(data))
  webhooks.items = webhooks.items.map((entity) => wrapWebhook(http, entity))
  return freezeSys(webhooks)
}
github contentful / contentful-management.js / lib / entities / space.js View on Github external
hostUpload,
    defaultHostnameUpload
  } = http.httpClientParams
  const spaceScopedHttpClient = http.cloneWithNewParams({
    space: space.sys.id
  })
  const spaceScopedUploadClient = http.cloneWithNewParams({
    space: space.sys.id,
    host: hostUpload || defaultHostnameUpload
  })
  const spaceApi = createSpaceApi({
    http: spaceScopedHttpClient,
    httpUpload: spaceScopedUploadClient
  })
  const enhancedSpace = enhanceWithMethods(space, spaceApi)
  return freezeSys(enhancedSpace)
}

contentful-sdk-core

Core modules for the Contentful JS SDKs

MIT
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis

Similar packages