# datasource-ksql

An Apollo [`DataSource`](https://github.com/apollographql/apollo-server/tree/f63fc5adcd092db682c0d62b904e9077d206ebd8/packages/apollo-datasource)
for interacting with [ksql](https://ksql.apache.org/)

## Usage

### Configuring

```js
const config = {
    ksqlUrl: 'https://dev-ksqldb-server.dev.theorchard.io'
    ksqlAuthToken: 'foobar'
};

const ksql = new KsqlDataSource(config);
```

### Extending `KsqlDataSource`

```js
import { KsqlDataSource } from '@theorchard/datasource-ksql';

class Ksql extends KsqlDataSource {
    async getFileProgress(filename: string) {
        const query = `SELECT PROCESSED, TOTAL FROM TABLE_PUBLISHING_INGESTION WHERE FILENAME = '${filename}';`;
        return this.sendQuery(query);
    }
}

export default Ksql;
```

As long as your `config` object has ksqlUrl & ksqlAuthToken this should work without adding a `constructor` to the class.
