0.6.1 • Published 8 months ago

@1mill/journal v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@1mill/journal

Idempotently invoke AWS Lambda functions with Cloudevents.

Getting started

npm install @1mill/journal
// * index.js
import { Locker, withIdempotency } from '@1mill/journal'

const locker = new Locker({
  name:  'my-locker-db-name',
  table: 'my-collection-name',
  uri:   'mongodb://...:27017/',
})

const func = (cloudevent, ctx) => {
  console.log('Running once: ', cloudevent)
  return { cloudevent }
}

export const handler = async (cloudevent, ctx) => withIdempotency(cloudevent, ctx, { func, locker })

Locker

NameRequiredTypesDefaultEnvironmentDescription
expireAfterSecondsnumber86400 (1 day)MILL_JOURNAL_EXPIRE_AFTER_SECONDSHow long a Cloudevent idempotency key will keep-alive
nameyesstringMILL_JOURNAL_NAMEThe name of the database itself
optionsobject{}Options pass to the database client
tableyesstringMILL_JOURNAL_TABLEThe name of the table inside the database
uriyesstringMILL_JOURNAL_URIURI to connect to database

withIdempotency

NameRequiredTypesDefaultEnvironmentDescription
funcyesfunctionThe function containing business logic that will run
lockeryesLockerThe Locker in which idempotency keys will be checked against

References

0.3.0

8 months ago

0.5.0

8 months ago

0.4.1

8 months ago

0.4.0

8 months ago

0.6.1

8 months ago

0.6.0

8 months ago

0.2.5

2 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.1.0

3 years ago

0.2.0

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago