# @koikorn/app-version

> KeystoneJS App Version Plugin

Latest version **1.0.2** (published 2020-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @koikorn/app-version
pnpm add @koikorn/app-version
yarn add @koikorn/app-version
bun add @koikorn/app-version
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-07-13 |
| First published | 2020-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9977 |
| Author | The KeystoneJS Development Team |
| Maintainers | lorenhaim |

## Links

- npm: https://www.npmjs.com/package/@koikorn/app-version
- Repository: https://github.com/keystonejs/keystone/tree/master/packages/app-version
- npm.io page: https://npm.io/package/@koikorn/app-version

## Dependencies (1)

- [@koikorn/access-control](https://npm.io/package/@koikorn/access-control.md) ^6.0.0

## Recent versions

- 1.0.2 (latest) — 2020-07-13

## README

<!--[meta]
section: api
subSection: utilities
title: App version plugin
[meta]-->

# App version plugin

[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/@koikorn/app-version)

This package provides support for including a version string both as an HTTP response header and as a graphQL query.

The function `appVersionMiddleware(version)` will return a piece of middleware which will set the `X-Keystone-App-Version` response header to `version` on all HTTP requests.

The graphQL provider `AppVersionProvider` will add an `{ appVersion }` query to your graphQL API which returns `version` as a string.

## Usage

### Indirectly

This package is designed to be used indirectly via the conveniance API on the `Keystone` class:

```javascript
const keystone = new Keystone({
  appVersion: {
    version: '1.0.0',
    addVersionToHttpHeaders: true,
    access: true,
  },
});
```

### Directly

It can also be used directly if you would like to manually manage your middleware stack of graphQL providers.

```javascript
const { AppVersionProvider, appVersionMiddleware } = require('@koikorn/app-version');

const version = '1.0.0';

app.use(appVersionMiddleware(version));

keystone._providers.push(
  new AppVersionProvider({
    version,
    access: true,
    schemaNames: ['public'],
  })
);
```

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