# telescope-sdk

> This project is a work in progress.

Latest version **1.0.0** (published 2019-02-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install telescope-sdk
pnpm add telescope-sdk
yarn add telescope-sdk
bun add telescope-sdk
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-02-24 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 348.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | danm |

## Links

- npm: https://www.npmjs.com/package/telescope-sdk
- npm.io page: https://npm.io/package/telescope-sdk

## Recent versions

- 1.0.0 (latest) — 2019-02-24

## README

# Telescope Server Development Kit

This project is a work in progress.

## How to use
You need to be a member of the BBC NPM organisation. To get access visit https://github.com/bbc/npm

## Packages
### TLS
A function to return TLS config using client cosmos certs  
```bash
npm i @bbc/telescope-sdk-tls
```

```js
import tls from '@bbc/telescope-sdk-tls';
import request from 'request';
request({
  method: 'GET',
  uri: '',
  agentOptions: tls(),
}, (err, res, body) => {
  // handle callback
});
```

### Content Store
A class to retrieve data from the Content Store
```
npm i @bbc/telescope-sdk-content-store
```

```js
import ContentStore from '@bbc/telescope-content-store';
const cs = new ContentStore({
  key: 'APIKEY',
});
await cs.getAssetByCurie('curie');
await cs.getAssetByCPSID('id');
await cs.getAssetByUri('uri');
```

### Creative Works
A class to retrieve data from Creative Works
```
npm i @bbc/telescope-sdk-creative-works
```

```js
import CreativeWorks from '@bbc/telescope-creative-works';
const cs = new CreativeWorks({
  key: 'APIKEY',
});
await cs.getTagByGuid('guid');
CreativeWorks.getTagByGuid('guid', { key: 'APIKEY' });
```

### CPS
A class to retrieve the author of a piece of work
```
npm i @bbc/telescope-sdk-cps
```
```js
import CPS from '@bbc/telescope-sdk-cps';
const cps = new CPS();
await cps.getByAssetId('assetid');
```

### Redis
A helper class for our Redis implemnation
```
npm i @bbc/telescope-sdk-redis
```
```js
import Redis from '@bbc/telescope-sdk-redis';
const redis =new Redis({
  host: '0.0.0.0',
})
await redis.get('item');
```

### Config
A helper function for gathering enviroment variables
```
npm i @bbc/telescope-sdk-config
```
```js
import config from '@bbc/telescope-config';
const config = config();
```

### Things
A class to retrieve data on a tag
```
npm i @bbc/telescope-sdk-things
```
```js
import Thing from '@bbc/telescope-sdk-things';
const thing = new Thing({
  key: 'API-KEY',
});
const res = thing.getTagByGuid('guid');
```

### Pipeline
A class to handle a asyncronious tasks
```
npm i @bbc/telescope-sdk-pipeline
```
```js
import Pipeline from '@bbc/telescope-sdk-pipeline';
const pipeline = new Pipeline({}, 'context');
pipeline(
  func1,
  func2,
  func3,
  func4,
);
```

## Nitro 
A class to handle retreiving video metadata. Accepts an eight character Programme ID.
```
npm i @bbc/telescope-sdk-nitro
```
```js
import Nitro from '@bbc/telescope-sdk-nitro';
const nitro = new Nitro({
  key: 'API-KEY',
});
const res = nitro.pid('pid');
```

### SQS Parse
A helper function to parse SQS messages exposing the body of the payload
```
npm i @bbc/telescope-sdk-sqs-parse
```
```js
const parsedMessage = sqsParse(sqsRawMessage);
```

## Develop
Telescope-SDK uses Lerna, Jest and Typescript all of which need to be installed locally

### Clone and install dependancies
To modify or create any services clone the repo
```
git clone https://github.com/bbc/telescope-sdk.git
npm i
```

### Create a new package
If you need to create a new package, use Lerna to adminster the change from the root directory
```
lerna create {packagename}
```

### Publish packages
Once you have finished creating or editing packages, create a pull request and merge into master.
Your code should not not have any type any implicity and include 100% code coverages for tests

Once the PR has been merged, this will kick off a `lerna publish` event which will reversion the packages and publish to NPM

### Package laylout
Each package within the SDK could have a JEST config file, TSLint rules, TSconfig and a babel config.

root  
-src (where your typescript lives)  
-lib (where your typescript compiles to JS lives + exported typedefinitions)  
-test (test director)  
-package.json  
-tsconfig.json  
-jest.json  
-.babelrc  

Only commit the lib to your NPM package.

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