open-index/open-npm huggingface dataset:
npm package: @spritz-finance/serverless-eventbridge-sqs
Description: serverless plugin to make serverless-eventbridge-sqs-lambda events
Author: Eliyahu Gusovsky
Latest version: 1.0.3

# Serverless Eventbridge Sqs Lambda

Introducing an SQS interface between AWS EventBridge and Lambda, as facilitated by this plugin, which enhances system resilience. While EventBridge alone can trigger Lambda functions, it lacks SQS's built-in capabilities for message buffering, deduplication, and fault tolerance. Without SQS, you're reliant solely on Lambda’s limited retry mechanisms. By using this plugin, you ensure that your architecture can gracefully handle surges in events and more effectively manage event-processing failures, making your serverless applications both scalable and robust.

# Table of Contents

- [Install](#install)
- [Setup](#setup)

## Installation

Install the plugin in the root directory of your Serverless project with the following npm command:

`$ npm install --save-dev @spritz-finance/serverless-eventbridge-sqs`

Next, incorporate the plugin into your serverless.yml file as demonstrated below:

```yml
plugins:
  - "@spritz-finance/serverless-eventbridge-sqs"
```

## Setup

To complete the setup, configure your Lambda function with the eventBridgeSqs event type in your serverless.yml file. Below is an example that illustrates how to set up the function with various options. Note that all settings are optional

```yml
functions:
  processEvent:
    handler: handler.handler
    events:
      - eventBridgeSqs:
          # EventBridge settings
          eventBus: MyEventBusARN # Defaults to listening on the default event bus
          pattern: # Defaults to listening to all events
            detail-type:
              - user.login
          inputTransformer: # Transform the incoming event data
            inputTemplate: '{"newAttribute": "$.oldAttribute"}'

          # SQS settings
          batchSize: 1 # The default batch size is 1
          visibilityTimeout: 120 # AWS default is 30 secs
          messageRetentionPeriod: 345600 # 4 days in seconds
          delaySeconds: 10 # Initial delay before delivering the message. Default is 0
          redrivePolicy: # Integrate with a Dead Letter Queue
            deadLetterTargetArn: MyDLQARN
          encryption: # Enable encryption for messages
            kmsMasterKeyId: alias/aws/sqs
            kmsDataKeyReusePeriodSeconds: 600

plugins:
  - "@spritz-finance/serverless-eventbridge-sqs"
```

The above configuration shows that the processEvent Lambda function is subscribed to an SQS queue that listens for events on the `MyEventBusARN` event bus. The function filters these events with a `detail-type` of `user.login`. Moreover, it sets a batch size of 1 and a visibility timeout of 120 seconds for processed messages.
npm package: @sprkl/require-in-the-middle
Description: Module to hook into the Node.js require function
Author: Thomas Watson Steen
Latest version: 5.2.1

# require-in-the-middle

Hook into the Node.js `require` function. This allows you to modify
modules on-the-fly as they are being required.

[![npm](https://img.shields.io/npm/v/require-in-the-middle.svg)](https://www.npmjs.com/package/require-in-the-middle)
[![Test status](https://github.com/elastic/require-in-the-middle/workflows/Test/badge.svg)](https://github.com/elastic/require-in-the-middle/actions)


## Installation

```
npm install require-in-the-middle --save
```

## Usage

```js
const path = require('path')
const Hook = require('require-in-the-middle')

// Hook into the express and mongodb module
Hook(['express', 'mongodb'], function (exports, name, basedir) {
  const version = require(path.join(basedir, 'package.json')).version

  console.log('loading %s@%s', name, version)

  // expose the module version as a property on its exports object
  exports._version = version

  // whatever you return will be returned by `require`
  return exports
})
```

## API

The require-in-the-middle module exposes a single function:

### `hook = Hook([modules][, options], onrequire)`

When called a `hook` object is returned.

Arguments:

- `modules` &lt;string[]> An optional array of module names to limit which modules
  trigger a call of the `onrequire` callback. If specified, this must be the
  first argument. Both regular modules (e.g. `react-dom`) and
  sub-modules (e.g. `react-dom/server`) can be specified in the array.
- `options` &lt;Object> An optional object containing fields that change when the
  `onrequire` callback is called. If specified, this must be the second
  argument.
  - `options.internals` &lt;boolean> Specifies whether `onrequire` should be called
    when module-internal files are loaded; defaults to `false`.
- `onrequire` &lt;Function> The function to call when a module is required.

The `onrequire` callback will be called the first time a module is
required. The function is called with three arguments:

- `exports` &lt;Object> The value of the `module.exports` property that would
  normally be exposed by the required module.
- `name` &lt;string> The name of the module being required. If `options.internals`
  was set to `true`, the path of module-internal files that are loaded
  (relative to `basedir`) will be appended to the module name, separated by
  `path.sep`.
- `basedir` &lt;string> The directory where the module is located, or `undefined`
  for core modules.

Return the value you want the module to expose (normally the `exports`
argument).

### `hook.unhook()`

Removes the `onrequire` callback so that it will not be triggerd by
subsequent calls to `require()`.

## License

[MIT](https://github.com/elastic/require-in-the-middle/blob/master/LICENSE)