@tws-js/client
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

TWS - Type-Safe Web Server Client

Test NPM

TWS Logo
TWS Client is a tool to generate and consume types from a TWS server in your client code.

✅ 100% code coverage

Usage

Install the package:

npm install @tws-js/client

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

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

Finally use the generated types in your client code:

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

nvm use 18
npm install

Building

npm run build

Testing

npm run lint
npm test

Readme

Keywords

none

Package Sidebar

Install

npm i @tws-js/client

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

22.2 kB

Total Files

15

Last publish

Collaborators

  • sergiodeveloper