@baselime/paginate-aws
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

paginate-aws

Typesafe AWS Pagination using async generators

Useful when you need to paginate and AWS SDK call (v2/v3). Works with any aws operation with a paginationKey and uses typescript to help (but not guarantee) you have selected the correct pagination key

Pagination Key Help

Install

npm install @baselime/paginate-aws

Usage

import { paginate } from '@baselime/paginate-aws';

for await (const stacks of paginate((next) => cloudFormation.listStacks({ NextToken: next }).promise(), 'NextToken')) {
    console.log(stacks.StackSummaries)
    //=> [{ StackName: 'prod-just-ship-it-be-cool', ...}, ...]
}

API

paginate((next: string) => somePromise({ next }), paginationKey: string)

returns an async generator that paginates through the aws-sdk list method returning all the responses.

Package Sidebar

Install

npm i @baselime/paginate-aws

Weekly Downloads

81

Version

1.0.6

License

MIT

Unpacked Size

3.36 kB

Total Files

5

Last publish

Collaborators

  • ta_baselime
  • boristane