# @keystonejs/app-version

> KeystoneJS App Version Plugin

Latest version **2.1.2** (published 2021-05-26) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2021-05-26 |
| First published | 2020-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10.0.0 |
| Dependencies | 3 |
| Unpacked size | 16.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 68 |
| Author | The KeystoneJS Development Team |
| Maintainers | bladey, jedwatson, molomby, jesstelford, mitchellhamilton, timl, madebymike |

## Links

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

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.17.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.14.0
- [@keystonejs/access-control](https://npm.io/package/@keystonejs/access-control.md) ^7.1.2

## Recent versions

- 2.1.2 (latest) — 2021-05-26
- 1.0.2 (buttress) — 2020-06-02
- 2.1.1 — 2021-04-14
- 2.1.0 — 2021-02-24
- 2.0.1 — 2021-02-22
- 2.0.0 — 2021-02-14
- 1.0.1 — 2020-04-06
- 1.0.0 — 2020-03-17

## README

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

# App version plugin

> This is the last active development release of this package as **Keystone 5** is now in a 6 to 12 month active maintenance phase. For more information please read our [Keystone 5 and beyond](https://github.com/keystonejs/keystone-5/issues/21) post.

[![View changelog](https://img.shields.io/badge/changelogs.xyz-Explore%20Changelog-brightgreen)](https://changelogs.xyz/@keystonejs/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('@keystonejs/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/@keystonejs/app-version · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
