0.1.6 • Published 3 years ago

@last-rev/contentful-s3-loader v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Overview

This library exports a single default function which creates a set of data loaders and fetchers for loading contentful structured content from a last-rev configured s3 bucket.

Usage

import createLoaders from '@last-rev/contentful-s3-loader';

async function () {
  const {
    entryLoader,
    assetLoader,
    entriesByContentTypeLoader,
    fetchAllPages,
    fetchAllContentTypes
  } = await createLoaders(
    // TODO
  );
}

entryLoader, assetLoader, and entriesByContentTypeLoader are all instances of dataloader. entryLoader and assetLoader are both keyed by contentful ID (string), and entriesByContentTypeLoader is keyed by a Contentful content type ID (string).

const myEntry = await entryLoader('my-content-id-1234');
const myAsset = await assetLoader('my-asset-id-5432');
const myEntries =  await entriesByContentTypeLoader('pageGeneral');

the other two functions, fetchAllPages and fetchAllContent are just convenience functions that return a list of all page content items (entries which have a slug field) and all content types.

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago