open-index/open-npm huggingface dataset:
npm package: @open-kappa/module-portability
Description: A library to simplify CJS and MJS support.
Author: Francesco Stefanni
Latest version: 0.0.2

# @open-kappa/module-portability

This package provides a library to simplify to write code suitable for both
CJS and MJS module systems. It is written in *typescript*.

## Links

* Project homepage: [hosted on GitLab Pages](
  https://open-kappa.gitlab.io/nodejs/module-portability)
* Project sources: [hosted on gitlab.com](
  https://gitlab.com/open-kappa/nodejs/module-portability)
* List of open-kappa projects: [hosted on GitLab Pages](
  https://open-kappa.gitlab.io)

## License

*@open-kappa/module-portability* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

## Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/mqtt-runner
Description: Simple scripts to run predefined commands.
Author: Francesco Stefanni
Latest version: 0.0.1

# @open-kappa/mqtt-runner

This package provides a library to allow to run predefined commands via MQTT.
It is written in *typescript*.

## Links

* Project homepage: [hosted on open-kappa.bitbucket.io](
  https://open-kappa.bitbucket.io/nodejs/mqtt-runner)
* Project sources: [hosted on bitbucket.com](
  https://bitbucket.org/open-kappa/mqtt-runner)
* List of [open-kappa projects on bitbucket](
  https://open-kappa.bitbucket.io)

## License

*@open-kappa/mqtt-runner* is released under the liberal MIT License.
Please refer to the LICENSE.md project file for further details.

## Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/myexe
Description: A lib to simplify writings of utility programs.
Author: Francesco Stefanni
Latest version: 0.0.5

# @open-kappa/myexe
This package provides a simple library to simplify writing of utility programs.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/nodejs/myexe)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/nodejs/myexe)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/myexe* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

# Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/myjson
Description: A simple JSON management library.
Author: Francesco Stefanni
Latest version: 0.2.1

# @open-kappa/myjson
This package provides a simple utility library, to manage JSON.
It supports also *typescript*.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/nodejs/myjson)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/nodejs/myjson)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/myjson* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

# Patrons

This node-red module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/mylog
Description: A simple log library.
Author: Francesco Stefanni
Latest version: 2.0.2

# @open-kappa/mylog

This package provides a simple logging library.
It supports also *node-red* and *typescript*.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/nodejs/mylog)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/nodejs/mylog)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/mylog* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

# Patrons

This node-red module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/mypromise
Description: A lib to simplify promise-based code.
Author: Francesco Stefanni
Latest version: 0.0.4

# @open-kappa/mypromise
This package provides a simple library to simplify promise-based code.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/nodejs/mypromise)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/nodejs/mypromise)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/mypromise* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

# Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/myscripts
Description: Simple scripts to simplify projects management.
Author: Francesco Stefanni
Latest version: 0.0.3

# @open-kappa/myscripts

This package provides a set of scripts to simplify projects management.
It supports *node* and *node-red* projects in *typescript*.

## Links

* Project homepage: [hosted on bitbucket.com](
  https://bitbucket.org/open-kappa/myscripts)
* Project sources: [hosted on bitbucket.com](
  https://bitbucket.org/open-kappa/myscripts)
* List of [open-kappa projects on bitbucket](
  https://open-kappa.bitbucket.io)

## License

*@open-kappa/myscripts* is released under the liberal MIT License.
Please refer to the LICENSE.md project file for further details.

## Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/mytest
Description: A simple library to simplify test writing.
Author: Francesco Stefanni
Latest version: 2.0.7

# @open-kappa/mytest

This package provides a library to simplify test management.
It supports also *node-red* and *typescript*.

## Links

* Project homepage: [hosted on GitLab Pages](
  https://open-kappa.gitlab.io/nodejs/mytest)
* Project sources: [hosted on gitlab.com](
  https://gitlab.com/open-kappa/nodejs/mytest)
* List of open-kappa projects: [hosted on GitLab Pages](
  https://open-kappa.gitlab.io)

## License

*@open-kappa/mytest* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

## Patrons

This node module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/node-red-contrib-mydb
Description: Simple DB access node for node-red
Author: Francesco Stefanni
Latest version: 1.6.2

# @open-kappa/node-red-contrib-mydb

This package provides two node-red nodes:
* An input/output node for DB queries
* A DB connection configuration node

At the moment only Postgres is supported, but maybe other DB's will be supported in the future.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/node-red/node-red-contrib-mydb)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/node-red/node-red-contrib-mydb)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/node-red-contrib-mydb* is released under the liberal MIT License.
Please refer to the LICENSE.txt project file for further details.

# Credits

All the stuff into this package as been created from scratch, with the following
exceptions:

* The node icon has been taken from the original *postgrestor* node.
* The node HTML has been takend and adapted from the original *postgrestor* node.

# Patrons

This node-red module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).

# Contributors

* Francesco Stefanni
* Martin Rubli
npm package: @open-kappa/node-red-contrib-myutils
Description: An utility library for custom node-red nodes.
Author: Francesco Stefanni
Latest version: 0.7.2

# @open-kappa/node-red-contrib-myutils
This package provides a simple utility library, to simplify node-red custom
nodes creation.

# Links

 * Project homepage: [hosted on GitLab Pages](
   https://open-kappa.gitlab.io/node-red/node-red-contrib-myutils)

 * Project sources: [hosted on gitlab.com](
   https://gitlab.com/open-kappa/node-red/node-red-contrib-myutils)

 * List of open-kappa projects, [hosted on GitLab Pages](
   https://open-kappa.gitlab.io)

# License

*@open-kappa/node-red-contrib-myutils* is released under the liberal MIT
License. Please refer to the LICENSE.txt project file for further details.

# Patrons

This node-red module has been sponsored by [Gizero Energie s.r.l.](
www.gizeroenergie.it).
npm package: @open-kappa/omni-query-filter
Description: This is a simple package of utils to parse and manage a `omnibox` search filter.
Author: Francesco Stefanni
Latest version: 0.2.1

# omni-query-filter

This is a simple package of utils to parse and manage a `omnibox` search filter.

A `omnibox` is the usual generic search field common in web applications as
`Drive`, but it is also the same concept of the search bar of a search engine.

This implementation has the following features:

* **Typecript**: written in Typescript, so types are a built-in feature.
* **Operators**: supports the following operators: `AND`, `OR`, `NOT` and the
    parenthesis `()` for the priority.
* **Tags**: supports tags for search specialization: `tag:value`. Their
    semantics is up to the specific query builder.
* **Search customization options**: quite complete set of options to change the
    search behavior, such as: case sensitivity, dictionary for translations,
    etc.

## Installation

```bash
npm install @open-kappa/colors
// Or
bun install @open-kappa/colors
```

## Architecture

There are few classes:

* **Parser**: it perform the parsing of the omnibox string.
* **Fields**: the description of the searchable "fields". For example, they
    could be the columns of a database table.
* **Builder**: visit the AST returned by the parser to build the search
    criteria.

Builders must be implemented by extending the `Builder` class.

## Example

```typescript
const builder = new MyBuilder()

const filter = OmniQueryFilter.create(builder)
    .fields
    .string("name")
    .string("surname")
    .currency("income")
    .enum("status", ["active", "inactive"])

const result = filter.parseAndBuild(omniString)
```

## License

**@open-kappa/omni-query-filter** is released under the liberal
**MIT License**. Please refer to the `LICENSE.txt` project file for further
details.

## Links

* **Project Homepage:** [GitLab Pages](https://open-kappa.gitlab.io/nodejs/omni-query-filter)
* **Source Code:** [GitLab](https://gitlab.com/open-kappa/nodejs/omni-query-filter)
* **Open-Kappa Projects:** [Index](https://open-kappa.gitlab.io)
npm package: @open-keystone/access-control
Description: KeystoneJS Access Control parsing and validating utilities.
Author: The KeystoneJS Development Team
Latest version: 8.0.1

<!--[meta]
title: Access Control
[meta]-->

# Access Control

> 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/@open-keystone/access-control)

This package is an internal helper package used by Keystone to parse and validate access control expressions.

You should probably not use this directly in your Keystone projects.

For more information on how to configure access control for you Keystone application, please consult the [Access Control Guide](/docs/guides/access-control.md).
npm package: @open-keystone/adapter-knex
Description: KeystoneJS Knex Database Adapter
Author: The KeystoneJS Development Team
Latest version: 14.0.20

<!--[meta]
section: api
subSection: database-adapters
title: Knex adapter
[meta]-->

# Knex database adapter

> 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/@open-keystone/adapter-knex)

The [Knex](https://knexjs.org/#changelog) adapter is a general purpose adapter which can be used to connect to a range of different database backends.
At present, the only fully tested backend is `Postgres`, however Knex gives the potential for `MSSQL`, `MySQL`, `MariaDB`, `SQLite3`, `Oracle`, and `Amazon Redshift` to be supported.

## Usage

```javascript
const { KnexAdapter } = require('@open-keystone/adapter-knex');

const keystone = new Keystone({
  adapter: new KnexAdapter({...}),
});
```

## Config

### `schemaName`

_**Default:**_ `'public'`

All postgres tables are grouped within a schema and `public` is the default schema.

### `dropDatabase`

_**Default:**_ `false`

Allow the adapter to drop the entire database and recreate the tables / foreign keys based on the list schema in your application. This option is ignored in production, i.e. when the environment variable NODE_ENV === 'production'.

### `knexOptions`

These options are passed directly through to Knex.

See the [knex docs](https://knexjs.org/#Installation-client) for more details.

_**Default:**_

```javascript
{
  client: 'postgres',
  connection: process.env.CONNECT_TO || process.env.DATABASE_URL || process.env.KNEX_URI
}
```

## Debugging

To log all Knex queries, run the server with the environment variable `DEBUG=knex:query`.

## Setup

Before running Keystone with the Knex adapter you should configure a database. By default Knex will look for a Postgres database on the default port, matching the project name, as the current user.

In most cases this database will not exist and you will want to configure a user and database for your application.

Assuming you're on MacOS and have Postgres installed the `build-test-db.sh` does this for you:

```shell
./build-test-db.sh
```

Otherwise, you can run these steps manually:

```shell allowCopy=false showLanguage=false
createdb -U postgres keystone
psql keystone -U postgres -c "CREATE USER keystone5 PASSWORD 'change_me_plz'"
psql keystone -U postgres -c "GRANT ALL ON DATABASE keystone TO keystone5;"
```

If using the above, you will want to set a connection string of: `postgres://keystone5:change_me_plz@localhost:5432/keystone`
npm package: @open-keystone/adapter-mongoose
Description: KeystoneJS Mongoose Database adapter.
Author: The KeystoneJS Development Team
Latest version: 13.0.14

<!--[meta]
section: api
subSection: database-adapters
title: Mongoose adapter
[meta]-->

# Mongoose database adapter

> 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/@open-keystone/adapter-mongoose)

## Usage

```javascript
const { MongooseAdapter } = require('@open-keystone/adapter-mongoose');

const keystone = new Keystone({
  adapter: new MongooseAdapter({...}),
});
```

## Config

### `mongoUri` (required)

This is used as the `uri` parameter for `mongoose.connect()`.

_**Default:**_ Environment variable (see below) or `'mongodb://localhost/<DATABASE_NAME>'`

If not specified, KeystoneJS will look for one of the following environment variables:

- `CONNECT_TO`
- `DATABASE_URL`
- `MONGO_URI`
- `MONGODB_URI`
- `MONGO_URL`
- `MONGODB_URL`
- `MONGOLAB_URI`
- `MONGOLAB_URL`

### Mongoose options (optional)

Additional Mongoose config options are passed directly through to `mongoose.connect()`.

_**Default:**_

```javascript
{
  useNewUrlParser: true,
  useFindAndModify: false,
  useUnifiedTopology: true,
}
```

See the [Mongoose docs](https://mongoosejs.com/docs/api.html#mongoose_Mongoose-connect) for a detailed list of options.
npm package: @open-keystone/app-graphql
Description: KeystoneJS GraphQL App.
Author: The KeystoneJS Development Team
Latest version: 7.0.3

<!--[meta]
section: api
subSection: apps
title: GraphQL app
[meta]-->

# GraphQL app

> 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/@open-keystone/app-graphql)

A KeystoneJS app that creates a GraphQL API and [GraphiQL](https://github.com/graphql/graphiql/blob/master/packages/graphiql/README.md) playground.

> **Note:** The GraphiQL playground is disabled in production mode.

For information about writing queries and mutations for KeystoneJS see the [Introduction to KeystoneJS' GraphQL API](https://keystonejs.com/guides/intro-to-graphql).

## Usage

```javascript
const { Keystone } = require('@open-keystone/keystone');
const { GraphQLApp } = require('@open-keystone/app-graphql');
const { AdminUIApp } = require('@open-keystone/app-admin-ui');

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp({
      // All config keys are optional. Default values are shown here for completeness.
      apiPath: '/admin/api',
      graphiqlPath: '/admin/graphiql',
      schemaName: 'admin',
      apollo: {},
    }),
    new AdminUIApp(),
  ],
};
```

## Config

| Option         | Type     | Default           | Description                                      |
| -------------- | -------- | ----------------- | ------------------------------------------------ |
| `apiPath`      | `String` | `/admin/api`      | Change the API path                              |
| `graphiqlPath` | `String` | `/admin/graphiql` | Change the GraphiQL playground path              |
| `schemaName`   | `String` | `admin`           | Change the graphQL schema name (not recommended) |
| `apollo`       | `Object` | `{}`              | Options passed directly to Apollo Server         |

## Setting a custom schemaName

To use a custom `schemaName`, please ensure it is also passed in to the [keystone constructor](https://www.keystonejs.com/keystonejs/keystone/#schemanames) at initialization.
npm package: @open-keystone/app-graphql-playground
Description: KeystoneJS GraphQL Playground App.
Author: The KeystoneJS Development Team
Latest version: 6.0.3

<!--[meta]
section: api
subSection: apps
title: GraphQL Playground App
draft: true
[meta]-->

# GraphQL Playground App

> 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/@open-keystone/app-graphql-playground)

A KeystoneJS App that creates an Apollo GraphQL playground.

## Usage

```javascript
const { Keystone } = require('@open-keystone/keystone');
const { GraphQLApp } = require('@open-keystone/app-graphql');
const { GraphQLPlaygroundApp } = require('@open-keystone/app-graphql-playground');
const { AdminUIApp } = require('@open-keystone/app-admin-ui');

// Ensure that the GraphQLApp and GraphQLAppPlayground are referring to the same endpoint
const apiPath = '/admin/api';

module.exports = {
  keystone: new Keystone(),
  apps: [
    // This should come before the GraphQLApp, as it sets up the dev query middleware
    new GraphQLPlaygroundApp({ apiPath })
    // Disable the default playground on this app
    new GraphQLApp({ apiPath, graphiqlPath: undefined }),
    new AdminUIApp()
  ],
};
```

## Config

| Option         | Type     | Default           | Description                               |
| -------------- | -------- | ----------------- | ----------------------------------------- |
| `apiPath`      | `String` | `/admin/api`      | Change the API path                       |
| `graphiqlPath` | `String` | `/admin/graphiql` | Change the Apollo GraphQL playground path |
npm package: @open-keystone/app-next
Description: KeystoneJS Next.js App.
Author: The KeystoneJS Development Team
Latest version: 9.0.2

<!--[meta]
section: api
subSection: apps
title: Next.js app
[meta]-->

# Next.js app

> 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/@open-keystone/app-next)

A KeystoneJS app for serving a [Next.js](https://nextjs.org/) application.

## Usage

```javascript
const { NextApp } = require('@open-keystone/app-next');

module.exports = {
  keystone,
  apps: [
    new GraphQLApp(),
    new AdminUIApp({ enableDefaultRoute: false }),
    new NextApp({ dir: 'app' }),
  ],
  distDir,
};
```

### Config

| Option | Type     | Default | Required | Description                       |
| ------ | -------- | ------- | -------- | --------------------------------- |
| `dir`  | `String` | `null`  | `true`   | The directory of the Next.js app. |
npm package: @open-keystone/app-nuxt
Description: KeystoneJS Nuxt.js App.
Author: The KeystoneJS Development Team
Latest version: 6.0.1

<!--[meta]
section: api
subSection: apps
title: Nuxt.js app
[meta]-->

# Nuxt.js app

> 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/@open-keystone/app-nuxt)

## Usage

```javascript
const { NuxtApp } = require('@open-keystone/app-nuxt');

const config = {
  srcDir: 'src',
  buildDir: 'dist',
};

module.exports = {
  keystone,
  apps: [new GraphQLApp(), new AdminUIApp(), new NuxtApp(config)],
};
```

### Config

A config object can be passed to the `NuxtApp` instance. Documentation for the `nuxtConfig` options is available on the [NuxtJS documentation website](https://nuxtjs.org/guide/configuration).
npm package: @open-keystone/app-schema-router
Description: KeystoneJS GraphQL App.
Author: The KeystoneJS Development Team
Latest version: 6.0.1

<!--[meta]
section: api
subSection: apps
title: GraphQL Schema Router
[meta]-->

# GraphQL Schema Router

> 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/@open-keystone/app-schema-router)

A KeystoneJS App that route requests to different GraphQL schemas.

The `SchemaRouterApp` allows you to define a `routerFn` which takes `(req, res)` and returns
a `routerId`, which is used to pick between different GraphQL schemas which exist at the same
`apiPath`.

## Usage

```javascript
const { Keystone } = require('@open-keystone/keystone');
const { GraphQLAppPlayground } = require('@open-keystone/app-graphql-playground');
const { SchemaRouterApp } = require('@open-keystone/app-schema-router');
const { GraphQLApp } = require('@open-keystone/app-graphql');
const { AdminUIApp } = require('@open-keystone/app-admin-ui');

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLAppPlayground({ apiPath })
    new SchemaRouterApp({
      apiPath,
      routerFn: (req) => req.session.keystoneItemId ? 'private' : 'public',
      apps: {
        public: new GraphQLApp({ apiPath, schemaName: 'public', graphiqlPath: undefined }),
        private: new GraphQLApp({ apiPath, schemaName: 'private', graphiqlPath: undefined }),
      },
    }),
    new AdminUIApp()
  ],
};
```

## Config

| Option     | Type       | Default      | Description                                                    |
| ---------- | ---------- | ------------ | -------------------------------------------------------------- |
| `apiPath`  | `String`   | `/admin/api` | The GraphQL API path                                           |
| `routerFn` | `Function` | `() => {}`   | A function which takes `(req, res)` and returns a `routerId`   |
| `apps`     | `Object`   | `{}`         | An object with `routerId`s as keys and `GraphQLApp`s as values |
npm package: @open-keystone/app-static
Description: KeystoneJS Static File App.
Author: The KeystoneJS Development Team
Latest version: 6.0.1

<!--[meta]
section: api
subSection: apps
title: Static file app
[meta]-->

# Static file app

> 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/@open-keystone/app-static)

A KeystoneJS app to serve static files such as images, CSS and JavaScript with support for client side routing.

## Usage

```js title=index.js
const { Keystone } = require('@open-keystone/keystone');
const { GraphQLApp } = require('@open-keystone/app-graphql');
const { AdminUIApp } = require('@open-keystone/app-admin-ui');
const { StaticApp } = require('@open-keystone/app-static');

module.exports = {
  keystone: new Keystone(),
  apps: [
    new GraphQLApp(),
    new AdminUIApp(),
    new StaticApp({
      path: '/',
      src: 'public',
      fallback: 'index.html',
    }),
  ],
};
```

## Config

| Option     | Type     | Required | Description                                                                                       |
| ---------- | -------- | -------- | ------------------------------------------------------------------------------------------------- |
| `path`     | `string` | `true`   | The path to serve files from.                                                                     |
| `src`      | `string` | `true`   | The path to the folder containing static files.                                                   |
| `fallback` | `string` | `false`  | The path to the file to serve if none is found. This path is resolved relative to the `src` path. |
npm package: @open-keystone/app-version
Description: KeystoneJS App Version Plugin
Author: The KeystoneJS Development Team
Latest version: 3.0.1

<!--[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/@open-keystone/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('@open-keystone/app-version');

const version = '1.0.0';

app.use(appVersionMiddleware(version));

keystone._providers.push(
  new AppVersionProvider({
    version,
    access: true,
    schemaNames: ['public'],
  })
);
```
npm package: @open-keystone/field-views-loader
Description: A webpack loader used to load all the field views used in an app
Author: The Keystone Development Team
Latest version: 7.0.1

<!--[meta]
title: Field Views Loader
[meta]-->

# Field Views Loader

> 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.

This packages contains a [webpack loader](https://webpack.js.org/api/loaders) which makes the field type UI components available to the Admin UI.

This package is an internal helper package used by Keystone. It contains a [webpack loader](https://webpack.js.org/api/loaders) which makes the field type UI components available to the Admin UI.

You should probably not use this directly in your Keystone projects.
npm package: @open-keystone/fields-authed-relationship
Description: KeystoneJS AuthedRelationship Field Type
Author: The KeystoneJS Development Team
Latest version: 2.0.20

<!--[meta]
section: api
subSection: field-types
title: AuthedRelationship
[meta]-->

# AuthedRelationship

> 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.

An extension on the `Relationship` field which is automatically set to the
currently authenticated item during a create mutation.

Great for setting fields like `Post.author` or `Product.owner`, etc.

## Usage

### Basic

```js
const { AuthedRelationship } = require('@open-keystone/fields-authed-relationship');
const { Text } = require('@open-keystone/fields');

keystone.createList('User', {
  fields: {
    name: { type: Text },
  },
});

keystone.createList('Post', {
  fields: {
    // Automatically set to the currently logged in user on create
    author: {
      type: AuthedRelationship,
      ref: 'User',
    },
  },
});
```

### Complete example

This example allows "admins" to overwrite the value

```js
const { AuthedRelationship } = require('@open-keystone/fields-authed-relationship');
const { Checkbox, Text } = require('@open-keystone/fields');

keystone.createList('User', {
  fields: {
    name: { type: Text },
    isAdmin: { type: Checkbox, default: false },
  },
});

const isAdmin = ({ authentication: { item } }) => !!item && item.isAdmin;

keystone.createList('Post', {
  fields: {
    author: {
      type: AuthedRelationship,
      ref: 'User',
      access: {
        create: isAdmin,
        update: isAdmin,
      },
    },
  },
});
```

### Config

| Option       | Type      | Default | Description                      |
| ------------ | --------- | ------- | -------------------------------- |
| `isRequired` | `Boolean` | `false` | Does this field require a value? |

## Differences from `Relationship`

- No `many: true`. This field is purely for a to-single relationship and cannot
  be used to refer to more than one item.
- Cannot specify a `defaultValue`. The entire purpose of this field is to
  provide that method for you.
- When setting `isRequired`, it will be checked during the "default value" phase
  of the mutation lifecycle. This means it may throw an error earlier than other
  fields
- Default access control set to `{ create: false, read: true, update: false }`
- Access control _does not_ respect any Keystone-level `defaultAccess`
npm package: @open-keystone/fields-color
Description: KeystoneJS Color Field Type
Author: The KeystoneJS Development Team
Latest version: 3.0.9

<!--[meta]
section: api
subSection: field-types
title: Color
[meta]-->

# Color

> 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.

Stores hexadecimal RGBA (Red, Green, Blue, Alpha) color values.
Presented in the Admin UI as an interactive color picker.

## Usage

```js
const { Color } = require('@open-keystone/fields-color');

keystone.createList('Product', {
  fields: {
    heroColor: { type: Color },
  },
});
```

## Config

| Option       | Type      | Default | Description                                                     |
| ------------ | --------- | ------- | --------------------------------------------------------------- |
| `isRequired` | `Boolean` | `false` | Does this field require a value?                                |
| `isUnique`   | `Boolean` | `false` | Adds a unique index that allows only unique values to be stored |
npm package: @open-keystone/fields-location-google
Description: KeystoneJS LocationGoogle field type.
Author: The KeystoneJS Development Team
Latest version: 6.0.9

<!--[meta]
section: api
subSection: field-types
title: LocationGoogle
[meta]-->

# LocationGoogle

> 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.

The LocationGoogle Field Type enables storing data from the Google Maps API.

## Usage

```javascript
const { LocationGoogle } = require('@open-keystone/fields-location-google');
const { Keystone } = require('@open-keystone/keystone');

const keystone = new Keystone({...});

keystone.createList('Event', {
  fields: {
    venue: {
      type: LocationGoogle,
      googleMapsKey: 'GOOGLE_MAPS_KEY',
    },
  },
});
```

## GraphQL

```graphql
query {
  allEvents {
    venue {
      id
      googlePlaceID
      formattedAddress
      lat
      lng
    }
  }
}
```

Will yield:

```javascript
{
  "data": {
    "allEvents": [
      {
        "venue": {
          "id": "1",
          "googlePlaceID": "ChIJOza7MD-uEmsRrf4t12uji6Y",
          "formattedAddress": "10/191 Clarence St, Sydney NSW 2000, Australia",
          "lat": -33.869374,
          "lng": 151.205097
        }
      }
    ]
  }
}
```

### Mutations

To create a `Location`, pass the Google `place_id` for the desired field path.

```graphql
mutation {
  createEvent(data: { venue: "ChIJOza7MD-uEmsRrf4t12uji6Y" }) {
    venue {
      id
      googlePlaceID
      formattedAddress
      lat
      lng
    }
  }
}
```

Results in:

```javascript
{
  "createEvent": {
    "venue": {
      "id": "1",
      "googlePlaceID": "ChIJOza7MD-uEmsRrf4t12uji6Y",
      "formattedAddress": "10/191 Clarence St, Sydney NSW 2000, Australia",
      "lat": -33.869374,
      "lng": 151.205097
    }
  }
}
```
npm package: @open-keystone/fields-markdown
Description: KeystoneJS Markdown Field Type
Author: The KeystoneJS Development Team
Latest version: 7.0.9

<!--[meta]
section: api
subSection: field-types
title: Markdown
[meta]-->

# Markdown

> 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.

This field inserts a string path into your schema based on the `Text` field type implementation, and renders a Markdown editor using [CodeMirror](https://codemirror.net/).

## Usage

This package isn't included with the keystone fields package and needs to be installed:

```shell allowCopy=false showLanguage=false
yarn add @open-keystone/fields-markdown
# or
npm install @open-keystone/fields-markdown
```

Then import it, and use it like any other field:

```js
const { Markdown } = require('@open-keystone/fields-markdown');

keystone.createList('Post', {
  fields: {
    content: {
      type: Markdown,
    },
  },
});
```

## Credit

The `Editor` implementation is based on [SquidDev/MirrorMark](https://github.com/SquidDev/MirrorMark).
npm package: @open-keystone/fields-wysiwyg-tinymce
Description: KeystoneJS WYSIWYG HTML Field Type, powered by TinyMCE
Author: The KeystoneJS Development Team
Latest version: 7.0.9

<!--[meta]
section: api
subSection: field-types
title: Wysiwyg
[meta]-->

# Wysiwyg

> 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.

This field inserts a string path into your schema based on the `Text` field type implementation, and renders a WYSIWYG editor in the Admin UI using [TinyMCE](https://www.tiny.cloud/)

## Usage

This package isn't included with the keystone fields package and needs to be installed with `yarn add @open-keystone/fields-wysiwyg-tinymce` or `npm install @open-keystone/fields-wysiwyg-tinymce`

Then import it, and use it like any other field:

```js
const { Wysiwyg } = require('@open-keystone/fields-wysiwyg-tinymce');
```

## Config

### `editorConfig`

**Default:** `{}`

Accepts any [TinyMCE config options](https://www.tiny.cloud/docs/configure/). These will be passed to `tinymce.init` and can be used to override Keystone.js' default editor appearance and functionality.
npm package: @open-keystone/session
Description: Tools to assist with setting up session management in your Keystone system.
Author: The KeystoneJS Development Team
Latest version: 8.4.1

<!--[meta]
section: api
subSection: utilities
title: Session
[meta]-->

# Session

> 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.

<!-- TODO -->

This package contains functions to assist with setting up session management in your KeystoneJS system.
npm package: @open-keystone/test-utils
Description: Common utilities used while testing @open-keystone/* packages.
Author: The KeystoneJS Development Team
Latest version: 14.0.14

<!--[meta]
section: api
subSection: utilities
title: Test utils
[meta]-->

# Test utils

> 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.

This package is an internal KeystoneJS package which contains utility functions to assist in running tests against the GraphQL API.

## Installation

```shell
yarn add @open-keystone/test-utils
```

<!--- TODO: The contents of this file should be generated by JSDoc --->
npm package: @open-keystone/utils
Description: Common utility functions used throughout @open-keystone packages.
Author: The KeystoneJS Development Team
Latest version: 6.1.4

<!--[meta]
title: Utilities
[meta]-->

# Utilities

> 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.

This package is an internal Keystone package which contains various helper functions which are used throughout the monorepo.

You should probably not use this directly in your Keystone projects.