@lamware/sqs-json-parser
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published
NPM Discord Apache-2.0

Lamware - SQS JSON Parser

This Lamware Middleware allows you to automatically parse an SQS Queue payload and optionally provide TypeScript typings for the records.

Installation

This package is available via NPM:

yarn add @lamware/sqs-json-parser

# or

npm install @lamware/sqs-json-parser

Usage

import { sqsJsonParser } from '@lamware/sqs-json-parser';
import type { SQSHandler } from 'aws-lambda';
import { lamware } from '@lamware/core';

interface MyRecord {
  title: string;
  content: string;
}

const { handler } = lamware<SQSHandler>()
  .use(sqsJsonParser<MyRecord>({
    // [optional] Whether to throw an error if the JSON fails to parse (default: true)
    throwOnError: false,
  }))
  .execute(async ({ state }) => {
    console.log(state.items); // MyRecord[]
  });

export { handler };

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.14latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.14
2.0.02
1.4.23
1.4.12
1.4.01
1.3.11
1.3.01
1.2.232
1.2.220
1.2.213
1.2.201
1.2.190
1.2.181
1.2.171
1.2.163
1.2.153
1.2.142
1.2.133
1.2.120
1.2.115
1.2.101
1.2.91
1.2.81
1.2.71
1.2.61
1.2.51
1.2.41
1.2.31
1.2.11
1.2.01

Package Sidebar

Install

npm i @lamware/sqs-json-parser

Weekly Downloads

40

Version

2.0.1

License

GPL-3.0-only

Unpacked Size

39.3 kB

Total Files

7

Last publish

Collaborators

  • devlsh