open-index/open-npm huggingface dataset:
npm package: @netizen-experience/auth-infra
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.2.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# infra

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build infra` to build the library.
npm package: @netizen-experience/error-utils
Description: A utility library for creating and managing custom error-utils with additional context and codes.
Latest version: 0.1.1

# Error Utils

A utility library for creating and managing custom error-utils with additional context and codes.

## Table of Contents

- [Installation](#installation)
- [Usage and Examples](#usage-and-examples)
  - [Creating a Custom Error](#creating-a-custom-error)
  - [Accessing Error Properties](#accessing-error-properties)
  - [Using `ErrorContext`](#using-errorcontext)

## Installation

To install this package, run:

```sh
npm install @netizen-experience/error-utils
```

## Usage and Examples

### Creating a Custom Error

You can create a custom error by extending the `BaseError` class:

```typescript
import { BaseError, ErrorContext } from "@netizen-experience/error-utils";

class CustomError extends BaseError {
  constructor(
    message: string,
    options?: { prefix?: string; code?: string | number; context?: ErrorContext; cause?: Error },
  ) {
    super(message, options);
  }
}

const error = new CustomError("Something went wrong", { code: 123, context: { userId: 1 } });
console.error(error);
```

### Accessing Error Properties

The `BaseError` class provides additional properties like `code`, `context`, and `prefix`:

```typescript
const error = new CustomError("Something went wrong", { code: 123, context: { userId: 1 }, prefix: "ERR" });
console.log(error.code); // 123
console.log(error.context); // { userId: 1 }
console.log(error.prefix); // 'ERR'
console.log(error.codedError()); // 'ERR 123'
```

### Using `ErrorContext`

The `ErrorContext` type defines the structure that is convertible to JSON format that can be passed to the error. This allows you to add additional information to the error, making it easier to debug and handle.

```typescript
import { ErrorContext } from "@netizen-experience/error-utils";

// Adding user information to the error context
const userContext: ErrorContext = {
  userId: 42,
  userName: "john_doe",
  userRole: "admin",
};
```
npm package: @netizen-experience/logger
Description: This library provides a structured logging utility using [Winston](https://github.com/winstonjs/winston).
Latest version: 0.1.1

# Logger

This library provides a structured logging utility using [Winston](https://github.com/winstonjs/winston).

## Table of Contents

- [Installation](#installation)
- [Usage and Examples](#usage-and-examples)
- [Configuration](#configuration)

## Installation

To install the package, run:

```sh
npm install @netizen-experience/logger
```

## Usage and Examples

First, initialize the logger:

```typescript
import { initLogger } from "logger";

const log = initLogger();
```

Then, use the logger to log messages at the default info log level.

```typescript
log({ message: "info", session: "abcdef123456", origin: ["user", "getProfile"] });
```

You can also use the logger to log messages at different logger levels:

```typescript
log.error(new Error("Error message"));
log.debug({ message: "debug", session: "abcdef123456", origin: ["user", "userLookupFromIdentity"] });
```

## Configuration

You can configure the logger using environment variables:

- `LOGGER_LEVEL`: Sets the logging level (e.g., `info`, `debug`, `error`). Default is `info`.