Socket
Socket
Sign inDemoInstall

elasticsearch-dynamodb-stream-extension

Package Overview
Dependencies
3
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    elasticsearch-dynamodb-stream-extension

Library facilitating syncing dynamodb stream into elasticsearch


Version published
Maintainers
1
Install size
70.2 MB
Created

Readme

Source

elasticsearch-dynamodb-stream-extension

Library facilitate sync-ing dynamodb stream records into elasticsearch

Client Extension

All extension will be extended as ddbStream.<extension function name>

import { Client } from '@elastic/elasticsearch';
import { extendClient } from 'elasticsearch-dynamodb-stream-extension';

const client = new Client({ node: 'http://localhost:9200' });

const extendedClient = extendClient(client, {
  keyGen: record => record.dynamodb.Keys.id.S,
  index: () => 'test'
});

const fakeRecord = {...}

extendedClient.ddbStream.handleRecord(fakeRecord)
  .then(console.log)
  .catch(console.error)

Extension config

export interface ExtensionConfiguration {
  /**
   * genereate id, by default it hashes unmarshalled 'record.dynamodb.Keys'
   */
  keyGen?: (record: Record) => string,

  /**
   * specify which index to sync the record to
   */
  index: (record: Record) => string
}

Extension Functions

ddbStream.validateRecord(r: Record) => void

Validate a single record, throw error when record misses new image

ddbStream.handleRecord(r: Record) => Promise // same promise es js client returns

Handle sync-ing one single record

INSERT and MODIFY event corresponds to creating/overwriting a document

REMOVE event means deleting the document

Keywords

FAQs

Last updated on 24 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc