# @directsp/client-js

> DirectSp Client js

Latest version **2.1.2** (published 2020-10-23) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2020-10-23 |
| First published | 2018-12-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 79.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mohammad Nikravan |
| Maintainers | madnik7 |
| Keywords | DirectSp |

## Links

- npm: https://www.npmjs.com/package/@directsp/client-js
- npm.io page: https://npm.io/package/@directsp/client-js

## Dependencies (5)

- [jest](https://npm.io/package/jest.md) ^26.6.0
- [ts-jest](https://npm.io/package/ts-jest.md) ^26.4.1
- [requirejs](https://npm.io/package/requirejs.md) ^2.3.6
- [typescript](https://npm.io/package/typescript.md) ^4.0.3
- [@types/jest](https://npm.io/package/@types/jest.md) ^26.0.15

## Recent versions

- 2.1.2 (latest) — 2020-10-23
- 2.0.1 — 2020-09-14
- 2.0.0 — 2020-09-14
- 1.0.17 — 2020-05-22
- 1.0.15 — 2020-05-22
- 1.0.14 — 2020-05-22
- 1.0.13 — 2020-05-22
- 1.0.12 — 2019-06-07
- 1.0.11 — 2019-04-26
- 1.0.10 — 2019-04-26
- 1.0.9 — 2019-03-18
- 1.0.8 — 2019-03-18
- 1.0.7 — 2019-02-01
- 1.0.6 — 2019-01-22
- 1.0.5 — 2019-01-12
- … 5 more at https://npm.io/package/@directsp/client-js/versions

## README

# DirectSpClientJs
DirectSp client for JavaScript

## Usage

1. Install by NPM
``` NPM
npm i @directsp/client-js
```

2. Create and intialize object
```javascript
import { directSp } from "../node_modules/@directsp/client-js";

// Creating a global DirectSpClient object
window.dspClient = new directSp.DirectSpClient({
  resourceApiUri: "http:/your_directsp_host_url/api",
  isLogEnabled: true,
  isUseAppErrorHandler: true
});

// Initializing the object
dspClient.init();

// Handle authentication if any
// update this property as soon as your authorization provider gives you a new token
dspClient.authHeader = "a bearer authorization token such as google user token";

3. Invoke procedures

```javascript
// without options
dspClient.invoke("MyMethod", { param1: "value1", param2: "value2" })
  .then(data => {
    console.log(data);
    console.log(data.returnValue);
    console.log(data.outParam1);
    console.log(data.outParam2);
    console.log(data.recordset);
  });

// with options
dspClient.invoke("MyMethod", { param1: "value1", param2: "value2" }, { recordIndex: 0, recordCount: 10 })
  .then(data => {
    console.log(data);
  });
```
## Authentication
You can bypass authentication system by setting auth to null

## Runtime API Help
in your browser console just run
```javascript
dspClient.help()
```

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