# @tws-js/client

> Type-Safe Web Server Client

Latest version **1.1.0** (published 2024-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tws-js/client
pnpm add @tws-js/client
yarn add @tws-js/client
bun add @tws-js/client
```

Provides the command `tws-types`.

## 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.1.0 |
| Published | 2024-09-02 |
| First published | 2023-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 21.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sergiodeveloper |

## Links

- npm: https://www.npmjs.com/package/@tws-js/client
- Repository: https://github.com/sergiodeveloper/tws-client
- Homepage: https://github.com/sergiodeveloper/tws-client#readme
- Issues: https://github.com/sergiodeveloper/tws-client/issues
- npm.io page: https://npm.io/package/@tws-js/client

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^1.3.6
- [json5](https://npm.io/package/json5.md) ^2.2.3
- [@tws-js/common](https://npm.io/package/@tws-js/common.md) ^1.0.0

## Recent versions

- 1.1.0 (latest) — 2024-09-02
- 1.0.6 — 2024-08-12
- 1.0.4 — 2024-08-12
- 1.0.3 — 2023-04-23
- 1.0.2 — 2023-04-22
- 1.0.1 — 2023-04-22
- 1.0.0 — 2023-04-22

## README

# TWS - Type-Safe Web Server Client

[![Test](https://github.com/sergiodeveloper/tws-client/actions/workflows/test.yml/badge.svg)](https://github.com/sergiodeveloper/tws-client/actions/workflows/test.yml)
[![NPM](https://img.shields.io/npm/v/@tws-js/client)](https://www.npmjs.com/package/@tws-js/client)

<p align="center">
  <img alt="TWS Logo" height="150" src="https://user-images.githubusercontent.com/7635171/232378489-e32588ea-e76b-4fd9-9cad-14bfb045e7b3.svg" />
  <br>
  <b>TWS Client is a tool to generate and consume types from a TWS server in your client code.</b>
</p>

✅ 100% code coverage

## Usage

Install the package:

```bash
npm install @tws-js/client
```

Generate the types passing the URL of a TWS server schema:

```bash
npx tws-types --server http://localhost:3000/tws/schema --output server-types.ts
```

Finally use the generated types in your client code:

```typescript
import { TwsClient } from '@tws-js/client';
import { TwsTypes } from './server-types';

const client = new TwsClient<TwsTypes>({
  // The URL of your TWS server. Also works with remote servers.
  url: 'http://localhost:3000/tws',
});

// Response and input types are automatically inferred
const response = await client.execute('myOperation', {
  name: 'TWS',
});
```

## Collaborating

### Setup

```bash
nvm use 18
npm install
```

### Building

```bash
npm run build
```

### Testing

```bash
npm run lint
npm test
```

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