open-index/open-npm huggingface dataset:
npm package: @santriseus/zod-lambda-mapper
Description: Use zod schema as mapper definition to extract data from aws lambda events
Author: santriseus
Latest version: 0.0.3

# @santriseus/zod-lambda-mapper

Extends a [Zod](https://github.com/colinhacks/zod) schema with additional functions allowing to declare mapping and extract required fields from AWS API Gateway Lambda Events `APIGatewayProxyEventV2`and `APIGatewayProxyEventV2WithJWTAuthorizer`

----

## Installation

Zod is a peer dependency.

```shell
npm install zod @santriseus/zod-lambda-mapper
```

----

## Usage

### Extend a Zod schema with additional methods
- `fromBody(path?: string)` (path is [lodash get](https://lodash.com/docs#get) path, if not specified whole parsed body object is assigned)
- `fromQuery(name?: string)` (name is query parameter name, if not specified whole query object is assigned)
- `fromParams(name?: string)` (name is url parameter name, if not specified whole params object is assigned)
- `fromJwtClaims(name?: string)` (name is jwt claim name, if not specified whole claims object is assigned)

```typescript
import { extendZodWithLambdaEventMapper, extract } from '@santriseus/zod-lambda-mapper';
import {z} from 'zod';

extendZodWithLambdaEventMapper(z);

const schema = z.object({
  order: z.object({
    customerId: z.string().fromJwtClaims('uid'),
    orderId: z.string().fromParams('orderId'),
    products: z.array(z.object({
      name: z.string(),
      quantity: z.number(),
    })).fromBody('products'),
    pagination: z.object({
      skip: z.number(),
      take: z.number()
    }).fromQuery()
  }),
  comment: z.string().fromBody('additionalInfo.comment'),
});
const event: APIGatewayProxyEventV2WithJWTAuthorizer = {
//   ...  
  requestContext: {
//   ...
    authorizer: {
//   ...    
      jwt: {
        claims: {
          uid: '12345',
        },
      },
    },
  },
//   ...
  body: JSON.stringify({
    products: [
      {
        name: 'cucumbers',
        quantity: 3,
      },
      {
        name: 'tomatoes',
        quantity: 2,
      }
    ],
    additionalInfo: {
      comment: 'some comment',
      note: 'some note'
    }
  }),
//   ...
  pathParameters: {
    orderId: '54321',
  },
//   ...  
  queryStringParameters:  {
    take: '2',
    skip: '5',
  },
//  ...  
};

const extracted = extract(event, schema)
// ...
```

This will extract  following object:

```javascript
const extracted = {
  order: {
    customerId: "12345",
    orderId: "54321",
    products: [
      {
        name: "cucumbers",
        quantity: 3,
      },
      {
        name: "tomatoes",
        quantity: 2,
      },
    ],
    pagination: {
      take: "2",
      skip: "5",
    },
  },
  comment: "some comment"
}
```
npm package: @santry/browser
Description: Santry for browser
Author: eunbinn
Latest version: 1.3.24

<div align="center">
	<br>
	<br>
	<img height="220" src="https://raw.githubusercontent.com/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK/master/media/santry-1.png" alt="Santry">
	<h2 align="center">에러 및 로그 모니터링 플랫폼
	</h2>
	<p align="center"><sup>Thanks for BoostCamp2020</sup></p>
	<br>
	<br>

<!--레포 정보-->
![](https://img.shields.io/github/commit-activity/w/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/repo-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/languages/code-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/issues/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/last-commit/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)

![](https://i.imgur.com/j94i246.png)

</div>

---
## @santry/browser

clone project of sentry 

## Install
```jsx
npm install @santry/browser
```

## Usage
After generating an error, place the function in the catch.

```jsx
const { init, captureError } = require('@santry/browser');

const dsn = '[token]@[url]';

init(dsn);

const testError = () => {
  try {
    throw new Error('testing Error');
  } catch (error) {
    captureError(error);
  }
};

testError();
```

## Functions
### init([dsn] [, options])
If you want to use functions, use it first.

#### options
- **traceSampleRate** Set the percentage to collect errors or messages. This can be a number between 0 and 1.
- **release** Set the release version of your code.
- **environment** Set the environment of your code.
- **unhandleRejectionLevel** Set the level when an unhandleRejection error occurs. This is the setting for the whole unhandleRejection error.
- **uncaughtExceptionLevel** Set the level when an uncaughtException error occurs. This is the setting for the whole uncaughtException error.

### captureError([error] [, level])
Errors can be collected.

### setContext([context])
Set context of error or mesaage
npm package: @santry/core
Description: Santry for core
Author: Hera
Latest version: 1.4.24

<div align="center">
	<br>
	<br>
	<img height="220" src="https://raw.githubusercontent.com/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK/master/media/santry-1.png" alt="Santry">
	<h2 align="center">에러 및 로그 모니터링 플랫폼
	</h2>
	<p align="center"><sup>Thanks for BoostCamp2020</sup></p>
	<br>
	<br>

<!--레포 정보-->
![](https://img.shields.io/github/commit-activity/w/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/repo-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/languages/code-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/issues/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/last-commit/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)

![](https://i.imgur.com/j94i246.png)

</div>

---
## @santry/core

clone project of sentry
npm package: @santry/types
Description: Santry for types
Author: Hera
Latest version: 1.4.16

<div align="center">
	<br>
	<br>
	<img height="220" src="https://raw.githubusercontent.com/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK/master/media/santry-1.png" alt="Santry">
	<h2 align="center">에러 및 로그 모니터링 플랫폼
	</h2>
	<p align="center"><sup>Thanks for BoostCamp2020</sup></p>
	<br>
	<br>

<!--레포 정보-->
![](https://img.shields.io/github/commit-activity/w/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/repo-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/languages/code-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/issues/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/last-commit/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)

![](https://i.imgur.com/j94i246.png)

</div>

---
## @santry/types

clone project of sentry
npm package: @santry/utils
Description: Santry for utils
Author: Hera
Latest version: 1.4.23

<div align="center">
	<br>
	<br>
	<img height="220" src="https://raw.githubusercontent.com/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK/master/media/santry-1.png" alt="Santry">
	<h2 align="center">에러 및 로그 모니터링 플랫폼
	</h2>
	<p align="center"><sup>Thanks for BoostCamp2020</sup></p>
	<br>
	<br>

<!--레포 정보-->
![](https://img.shields.io/github/commit-activity/w/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/repo-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/languages/code-size/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/issues/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)
![](https://img.shields.io/github/last-commit/boostcamp-2020/Project11-A-Web-FE-Performance-Monitoring-SDK)

![](https://i.imgur.com/j94i246.png)

</div>

---
## @santry/utils

clone project of sentry