open-index/open-npm huggingface dataset:
npm package: @pocket-tools/lambda-secrets
Description: Utilities for accessing lambda secrets from the lambda secret layer
Latest version: 1.6.0

# Lambda Secrets

This package is used to obtain a secret or parameter from the [Lambda Layer cache](https://aws.amazon.com/blogs/compute/using-the-aws-parameter-and-secrets-lambda-extension-to-cache-parameters-and-secrets/) when enabled.

## Secrets Manaager Usage

```typescript
import {fetchSecret} from '@pocket-tools/lambda-secrets';
const secret = fetchSecret('/Lambda/Super/Secret');
```

This also assumes that the secret stored in Secrets Manager is a JSON based value, which it almost always is.

## Parameter Store Usage

```typescript
import {fetchParameter} from '@pocket-tools/lambda-secrets';
const parameter = fetchParameter('/Lambda/Super/SecretParameter');
```
npm package: @pocket-tools/tracing
Description: Utilities for tracing
Latest version: 1.12.0

# Tracing

We use this package to implement tracing within our servers. Requires Sentry as our trace propogator.

# Local/Test Setup

We use a feature flag to control the percentage of traces which we sample and send to our collector.

When running locally, you can construct a mock Unleash client which mimics this feature flag:

```
const unleash = mockUnleash([
  {
    name: 'perm.backend.sentry-trace-sampler-rate',
    enabled: true,
    strategies: [
      {
        name: 'default',
        constraints: [],
        parameters: {
          rollout: '100',
          stickiness: 'default',
          groupId: 'perm.backend.sentry-trace-sampler-rate',
        },
        variants: [
          {
            name: 'samplePercent',
            weight: 1000,
            payload: { type: PayloadType.NUMBER, value: '1.0' },
          },
        ],
      },
    ],
  },
]).unleash;
```
npm package: @pocket-tools/ts-logger
Description: Basic Typescript Logger
Latest version: 1.13.0

# Typescript Logger

This repository contains a simple, baseline logger setup for use in various Typescript apps. It is meant to be extensible. It comes with an optional morgan middleware setup function as well, for logging HTTP requests and responses.

## Default Behavior

### `LOG_LEVEL`

When environment `LOG_LEVEL` is set, it will be used as the winston log level.

Levels:

```typescript
const levels = {
  error: 0,
  warn: 1,
  info: 2,
  http: 3, // optional level for http req & resp logging
  graphql: 4, // optional level for graphql req & resp logging
  debug: 5,
};
```

## Example Usage

### Generic Setup
You can use this logger in most generic Typescript functions.

```
TBD
```

### For server-level specific logs:
* will get & embed the RELEASE_SHA environment variable into the log message metadata, if present

```
TBD
```

### For lambda-level specific logs:
* will get & embed the RELEASE_SHA environment variable into the log message metadata, if present

```
TBD
```

### For HTTP request & response specific logs via Morgan Express Middleware:
* will get & embed the RELEASE_SHA environment variable into the log message metadata, if present
* message will have all http headers for requests & responses

```
TBD
```

### For HTTP specific logs via server context objects:
* will get & embed the RELEASE_SHA environment variable into the log message metadata, if present
* will get & embed the user id header, request id, and trace id request headers in log message metadata, if present

```
TBD
```

### For GraphQL specific logs via server context objects & Apollo hooks:
* will get & embed the RELEASE_SHA environment variable into the log message metadata, if present
* will get & embed the user id header, request id, and trace id request headers in log message metadata, if present

```
TBD
```
npm package: @pocket-tools/tsconfig
Description: TSConfig used across Pocket
Latest version: 2.0.2

# TSConfig config

These are settings for TSConfig used by Pocket.

## What it does

This setups up your Typescript tslint settings based on best practices. Check the [tsconfig.json](https://github.com/Pocket/tsconfig/blob/main/tsconfig.json) file to see what is included. Feel free to override the rules that make sense for you.

## Installing

1. In your project folder, run:

```
npm i -D @pocket-tools/tsconfig # or yarn install --dev @pocket-tools/tsconfig
```

2. You will see several dependencies were installed. Now, create (or update) a `tsconfig.json` file with the following content:

If you don't already have one the NPM post install script will create it for you.

```json
{
  "extends": "@pocket-tools/tsconfig",
  "compilerOptions": {
    "outDir": "dist",
    "rootDir": "src"
  },
  "exclude": [
    "node_modules/",
    "dist/"
  ],
  "include": [
    "src/**/*.ts",
    "src/config"
  ]
}
```

Concepts are used from <https://github.com/Chatie/tsconfig>