How to use the netlify-cms-lib-util.resolvePromiseProperties function in netlify-cms-lib-util

To help you get started, we’ve selected a few netlify-cms-lib-util 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 netlify / netlify-cms / packages / netlify-cms-backend-github / src / API.ts View on Github external
readUnpublishedBranchFile(contentKey: string) {
    const metaDataPromise = this.retrieveMetadata(contentKey).then(data =>
      data.objects.entry.path ? data : Promise.reject(null),
    );
    const repoURL = this.useOpenAuthoring
      ? `/repos/${contentKey
          .split('/')
          .slice(0, 2)
          .join('/')}`
      : this.repoURL;
    return resolvePromiseProperties({
      metaData: metaDataPromise,
      fileData: metaDataPromise.then(data =>
        this.readFile(data.objects.entry.path, null, {
          branch: data.branch,
          repoURL,
        }),
      ),
      isModification: metaDataPromise.then(data =>
        this.isUnpublishedEntryModification(data.objects.entry.path, this.branch),
      ),
    }).catch(() => {
      throw new EditorialWorkflowError('content is not under editorial workflow', true);
    });
  }
github netlify / netlify-cms / packages / netlify-cms-backend-bitbucket / src / implementation.js View on Github external
entriesByFolder(collection, extension) {
    const listPromise = this.api.listFiles(
      collection.get('folder'),
      getCollectionDepth(collection),
    );
    return resolvePromiseProperties({
      files: listPromise
        .then(({ entries }) => entries)
        .then(filterByPropExtension(extension, 'path'))
        .then(this.fetchFiles),
      cursor: listPromise.then(({ cursor }) => cursor),
    }).then(({ files, cursor }) => {
      files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
      return files;
    });
  }
github netlify / netlify-cms / packages / netlify-cms-backend-github / src / API.js View on Github external
readUnpublishedBranchFile(contentKey) {
    const metaDataPromise = this.retrieveMetadata(contentKey).then(
      data => (data.objects.entry.path ? data : Promise.reject(null)),
    );
    return resolvePromiseProperties({
      metaData: metaDataPromise,
      fileData: metaDataPromise.then(data =>
        this.readFile(data.objects.entry.path, null, data.branch),
      ),
      isModification: metaDataPromise.then(data =>
        this.isUnpublishedEntryModification(data.objects.entry.path, this.branch),
      ),
    }).catch(() => {
      throw new EditorialWorkflowError('content is not under editorial workflow', true);
    });
  }