New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dazn/chaos-squirrel-runner-middy

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dazn/chaos-squirrel-runner-middy - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.9.0](https://github.com/getndazn/chaos-squirrel/compare/v0.8.0...v0.9.0) (2020-08-25)
### Features
* **runner-middy:** allow creating a custom logger for each context ([406ccf1](https://github.com/getndazn/chaos-squirrel/commit/406ccf1fbbe69c9bae48261c324ebc25368e3ac2))
# [0.8.0](https://github.com/getndazn/chaos-squirrel/compare/v0.7.0...v0.8.0) (2020-08-24)

@@ -8,0 +19,0 @@

5

dist/index.d.ts
import middy from '@middy/core';
import { Context } from 'aws-lambda';
import Runner from '@dazn/chaos-squirrel-runner';
import Runner, { Logger } from '@dazn/chaos-squirrel-runner';
export interface ChaosContext extends Context {

@@ -10,5 +10,6 @@ chaosRunner?: Runner;

wait?: boolean;
createLogger?: (context: Context) => Logger;
}
declare type ChaosMiddleware = middy.MiddlewareObject<unknown, unknown, ChaosContext>;
declare const _default: ({ createRunner, wait, }: MiddyRunnerOptions) => ChaosMiddleware;
declare const _default: ({ createRunner, wait, createLogger, }: MiddyRunnerOptions) => ChaosMiddleware;
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ({ createRunner, wait = true, }) => {
exports.default = ({ createRunner, wait = true, createLogger, }) => {
const stop = async (runner, wait) => {

@@ -15,2 +15,5 @@ if (runner) {

const runner = createRunner();
if (createLogger) {
runner.logger = createLogger(context);
}
context.chaosRunner = runner;

@@ -17,0 +20,0 @@ const start = runner.start();

6

package.json
{
"name": "@dazn/chaos-squirrel-runner-middy",
"version": "0.8.0",
"version": "0.9.0",
"description": "Chaos Squirrel - Runner - Middy",

@@ -30,7 +30,7 @@ "main": "dist/index.js",

"devDependencies": {
"@dazn/chaos-squirrel-runner": "^0.2.0",
"@dazn/chaos-squirrel-runner": "^0.9.0",
"@middy/core": "^1.1.0",
"@types/aws-lambda": "^8.10.60"
},
"gitHead": "419799defafab35e98adde6e7110d80025f74943"
"gitHead": "dfd26badce77beeaee204391364d12bd0b54bd59"
}

@@ -32,2 +32,8 @@ # @dazn/chaos-squirrel-runner-middy

wait: true,
createLogger: (context) => {
return (level, message, details) => {
// call a logger which is attached to the lambda context
context.logger[level](message, details);
};
},
})

@@ -38,1 +44,9 @@ );

```
## Middy Runner Arguments
| Parameter | Type | Default | Description |
| -------------- | ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `createRunner` | `Function` | - | A function which returns a new instance of ChaosRunner |
| `wait` | `Boolean` | `true` | Whether to wait for async chaos functions to complete, for example waiting for all files to be created for the open files attack |
| `createLogger` | `Function` | - | Optional. A function which is called with the Lambda `context`, which must return a valid `logger` function (see Chaos Runner for logger docs). This is useful when the `context` has a custom logger or correlation IDs attached, which you want to include in any logs |
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc