# dray-client

> Node.js wrapper for managing Dray jobs

Latest version **0.0.15** (published 2017-06-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install dray-client
pnpm add dray-client
yarn add dray-client
bun add dray-client
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.15 |
| Published | 2017-06-27 |
| First published | 2017-05-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | dmiddlecamp, mdma, monkbroc, stefan.moraru, suda |

## Links

- npm: https://www.npmjs.com/package/dray-client
- Repository: https://github.com/spark/dray-client
- Homepage: https://github.com/spark/dray-client#readme
- Issues: https://github.com/spark/dray-client/issues
- npm.io page: https://npm.io/package/dray-client

## Dependencies (11)

- [async](https://npm.io/package/async.md) ^2.0.0-rc.4
- [redis](https://npm.io/package/redis.md) ^2.6.2
- [verror](https://npm.io/package/verror.md) ^1.9.0
- [archiver](https://npm.io/package/archiver.md) ^1.0.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.1
- [superagent](https://npm.io/package/superagent.md) ^1.8.3
- [tar-stream](https://npm.io/package/tar-stream.md) ^1.5.4
- [gunzip-maybe](https://npm.io/package/gunzip-maybe.md) ^1.4.0
- [es6-promisify](https://npm.io/package/es6-promisify.md) ^4.0.0
- [superagent-prefix](https://npm.io/package/superagent-prefix.md) 0.0.2
- [superagent-promise](https://npm.io/package/superagent-promise.md) ^1.1.0

## Recent versions

- 0.0.15 (latest) — 2017-06-27
- 0.0.14 — 2017-06-16
- 0.0.13 — 2017-06-15
- 0.0.12 — 2017-06-07
- 0.0.11 — 2017-05-04

## README

[![Build Status](https://travis-ci.com/spark/dray-client.svg?token=M4rP8W5QPGszZyem6TGE&branch=master)](https://travis-ci.com/spark/dray-client) [![Coverage Status](https://coveralls.io/repos/github/spark/dray-client/badge.svg?branch=master&t=J9lNEW)](https://coveralls.io/github/spark/dray-client?branch=master)

## Usage

Before creating jobs, you need to initialize the job manager:

```js
import { DrayManager } from 'dray-client';

let manager = new DrayManager(
	'http://0.0.0.0:3000',   // Dray URL
	'redis://127.0.0.1:6379' // Redis URL
);
```

### Fire and forget

```js
let job = manager.createJob();

job.addStep('foo/bar') // Container to be run
   .submit(); // Fire and forget!
```

### Wait for result
```js
let job = manager.createJob();
job.setInput('foo') // Data passed to container
   .addStep('centurylink/upper'); // Container to be run
// Fire and wait for promise
job.submit().then((value) => {
	console.log("Result:", value);
}, (reason) => {
	console.error("Something bad happened:", reason)
});
```

### Start compilation job
```js
import { BuildpackJob } from 'dray-client';
let compilation = new BuildpackJob(manager);
compilation.addFiles([
	{name: 'foo.ino', data: new Buffer()}
]);
compilation.setEnvironment({
	PLATFORM_ID: 6
});
compilation.setBuildpacks([
	'particle/buildpack-wiring-preprocessor',
	'particle/buildpack-particle-firmware:0.5.1-photon'
]);
compilation.submit().then((binaries) => {
	// Do something with binaries
}, (reason) => {
	console.error("Compilation error:", reason)
});
```

## [API Reference](http://spark.github.io/dray-client/)

## Development

### Releasing

1. Prebuid `dist` directory using `npm build`
2. Bump version with `npm version <major|minor|patch>`
3. Push the repo
4. Publish on npm: `npm publish`

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