# elegant-tools

> A simple toolset for Node.js / TypeScript AWS lambda development

Latest version **1.0.21** (published 2023-08-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install elegant-tools
pnpm add elegant-tools
yarn add elegant-tools
bun add elegant-tools
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.21 |
| Published | 2023-08-30 |
| First published | 2023-06-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 137.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrey Chausenko |
| Maintainers | beh01der |
| Keywords | aws, lambda, tools, logging, context |

## Links

- npm: https://www.npmjs.com/package/elegant-tools
- Repository: https://github.com/Beh01der/node-elegant-tools
- Homepage: https://github.com/Beh01der/node-elegant-tools#readme
- Issues: https://github.com/Beh01der/node-elegant-tools/issues
- npm.io page: https://npm.io/package/elegant-tools

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.21 (latest) — 2023-08-30
- 1.0.20 — 2023-08-30
- 1.0.19 — 2023-08-30
- 1.0.18 — 2023-08-28
- 1.0.17 — 2023-08-23
- 1.0.16 — 2023-08-22
- 1.0.15 — 2023-08-01
- 1.0.14 — 2023-07-25
- 1.0.13 — 2023-07-25
- 1.0.12 — 2023-07-24
- 1.0.11 — 2023-07-07
- 1.0.10 — 2023-06-13
- 1.0.9 — 2023-06-13
- 1.0.8 — 2023-06-13
- 1.0.7 — 2023-06-13
- … 7 more at https://npm.io/package/elegant-tools/versions

## README

A simple toolset for Node.js / TypeScript AWS lambda development

** Context-aware logging
It will follow async calls and add values added to context to every log entry

```typescript
import { EventBridgeEvent } from "aws-lambda";
import { createHandler, getContext } from "elegant-tools";

export const handler = createHandler(async (event: EventBridgeEvent<string, any>) => {
  const { logger } = getContext();
  if (event["detail-type"] !== "supported-event-type") {
    logger.info(`Ignoring event: ${event["detail-type"]}`);
    return;
  }

  const input = SupportedEventSchema.parse(event.detail);
  logger.patchContext({
    correlationId: input.metadata["correlation-id"],
    ...
  });

  return await someDownstreamService(input);
});
```

---
_Source: https://npm.io/package/elegant-tools · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
