# @4players/odin-common

[![npm](https://img.shields.io/npm/v/@4players/odin-common.svg)][npm-badge-url]
[![npm](https://img.shields.io/npm/l/@4players/odin-common.svg)][license-url]
[![npm](https://img.shields.io/npm/dm/@4players/odin-common.svg)][npm-badge-url]

A collection of commonly used type definitions and schemas across ODIN web
projects.

## Entrypoints

The package is split into three entrypoints:

### `@4players/odin-common`

Lightweight utilities with no heavy dependencies. Includes logging, a `Result` type, video 
codec helpers, async primitives (sleep, task queues, promise racing), base64/byte array encoding, 
UUID generation, environment detection, type guards, URL helpers and the backend plugin API types.

```ts
import { Logger, LogFilter } from '@4players/odin-common';
```

### `@4players/odin-common/api`

Zod-based schemas for the ODIN Voice protocol (rooms, peers, media, tokens, channels) 
and RPC command/notification definitions. Importing from this entrypoint will pull in Zod.

```ts
import { TokenClaims, TokenClaimsSchema } from '@4players/odin-common/api';
```

### `@4players/odin-common/zod`

Re-exports the Zod library for consumers that need to create their own schemas without 
adding a separate Zod dependency.

```ts
import { z } from '@4players/odin-common/zod';
```

## Troubleshooting

Contact us through the listed methods below to receive answers to your questions and learn more about ODIN.

### Discord

Join our official Discord server to chat with us directly and become a part of the 4Players ODIN community.

[![Join us on Discord](https://www.4players.io/images/join_discord.png)](https://4np.de/discord)

### Twitter

Have a quick question? Tweet us at [@ODIN4Players](https://twitter.com/ODIN4Players) and we’ll help you resolve any issues.

### Email

Don’t use Discord or Twitter? Send us an [email](mailto:odin@4players.io) and we’ll get back to you as soon as possible.

[npm-badge-url]: https://www.npmjs.com/package/@4players/odin-common
[license-url]: https://github.com/4Players/odin-sdk-web/blob/master/LICENSE
