open-index/open-npm huggingface dataset:
npm package: @solidgoldpig/fb-jwt-client-node
Description: Form Builder JSON Web Token Client (Node)
Author: github@alex.solidgoldpig.com
Latest version: 0.0.29

# Form Builder JSON Web Token client (Node)

Base client for making requests to Form Builder platform endpoints that require JSON Web Tokens for authenctication

## Requirements

Node

## Installation

`npm install @solidgoldpig/fb-jwt-client-node`

## Usage

### Loading and initialising basic client

``` javascript
// load client class
const FBJWTClient = require('@solidgoldpig/fb-jwt-client-node')

// initialise client
const jwtClient = new FBJWTClient(serviceSecret, serviceToken, serviceSlug, microserviceUrl, [errorClass])
```

#### `serviceSecret`

Constructor will throw an error if no service secret is passed

#### `serviceToken`

Constructor will throw an error if no service token is passed

#### `serviceSlug`

Constructor will throw an error if no service slug is passed

#### `microserviceUrl`

Constructor will throw an error if no service url is passed

#### `errorClass`

By default, uses FBJWTClientError

### Extending

``` javascript
// extend base class
class FBMyClient extends FBJWTClient {
  constructor (serviceSecret, serviceToken, serviceSlug, microserviceUrl, myVar) {
    super(serviceSecret, serviceToken, serviceSlug, microserviceUrl)
    // do something with additional constructor argument
    this.myVar = myVar
  }
}

const myClient = new FBMyClient('service_secret', 'service_token', 'myservice', 'http://myservice', 'my var')
```

``` javascript
// extend base class with custom error
class FBAnotherClient extends FBJWTClient {
  constructor (serviceSecret, serviceToken, serviceSlug, microserviceUrl) {
    // create custom error class
    class FBAnotherClientError extends FBJWTClient.prototype.ErrorClass {}
    super(serviceSecret, serviceToken, serviceSlug, microserviceUrl, FBAnotherClientError)
  }
}
```

### Methods

- generateAccessToken

  Generate JWT access token

- createEndpointUrl

  Return user-specific endpoint

- sendGet

  Handle client get requests

- sendPost

  Handle client post requests

- encrypt

  Encrypt data with AES 256

- decrypt

  Decrypt data
  
- encryptUserIdAndToken

  Encrypt user ID and token using service secret

- decryptUserIdAndToken

  Decrypt user ID and token using service secret

- handleRequestError

  Handle client response errors

- createRequestOptions

  Create request options

- throwRequestError

  Convenience function for throwing errors

## Further details

See documentation in code for further details and `fb-user-datastore-client-node` and `fb-submitter-client-node` for examples.
npm package: @solidgoldpig/fb-nunjucks-helpers
Description: Form Builder Nunjucks helpers
Author: github@alex.solidgoldpig.com
Latest version: 0.0.23

# fb-nunjucks-helpers

Form Builder Nunjucks helpers

## Usage

`npm install @ministryofjustice/fb-nunjucks-helpers`

### Set up

```
const fbNunjucksHelpers = require('fb-nunjucks-helpers')
let nunjucksEnv = nunjucks.configure(views, options)
nunjucksEnv = fbNunjucksHelpers.init(nunjucksEnv)

```

### Adding macros

```
nunjucksEnv.add(macroPaths)
```

Adding to a specific namespace

```
nunjucksEnv.add(macroPaths, namespace)
```

## Global methods available in Nunjucks templates

### callBlock

```
{{ callBlock(data) }}

{{ callBlock({
  _id: 'blockId;,
  _type: 'blockType',
  ...
}) }}
```

### callBlocks

```
{{ callBlocks([data, data2, data3]) }}
```

### callMacro

```
{{ callMacro(macroPath, data) }}
```

### setObject

```
{% set foo = setObject(foo, {prop: 'value'}) %}
```

### setObjectProperty

```
{% set foo = setObjectProperty(foo, 'prop', 'value') %}
```

### addGlobal

```
{% set varSink = addGlobal('globalProp', 'value') %}
```

## Test assets

The macro files used for testing are located in `lib/spec/macros`
npm package: @solidgoldpig/fb-runner-node
Description: Form Builder Runner (Node version)
Author: github@alex.fu2k.org
Latest version: 0.0.163

# fb-runner-node
[![Build Status](https://travis-ci.org/ministryofjustice/fb-runner-node.svg?branch=master)](https://travis-ci.org/ministryofjustice/fb-runner-node)

Form Builder Runner is an application that provides generic backend code and templates to create forms from data representations.

For more details, read the [Runner’s documentation](https://github.com/ministryofjustice/form-builder/blob/master/documentation/running/running.md)


## Pre-requisites

  [Node](https://nodejs.org)

## Installing

```
git clone git@github.com:ministryofjustice/fb-runner-node.git
cd fb-runner-node
npm install
```

## Usage

Set the `SERVICE_PATH` environment variable to point the path of form data on your filesystem.

```sh
SERVICE_PATH=/path/to/form npm start
```

An example form can be checked out from `https://github.com/ministryofjustice/fb-example-service`

By default, Form Builder Runner will use port 3000. If you want to run on a different port, set the `PORT` environment variable.

```sh
PORT=4321 SERVICE_PATH=/path/to/form npm start
```

### Components usage

By default the runner uses the module `@solidgoldpig/fb-components-core`, using the version defined in `lib/constants/constant.js`

[Read more about components usage](components.md)

### Using the fb-runnner-node with a mocked backend

Use [fb-mock-services](https://github.com/ministryofjustice/fb-mock-services) to mock out the services which your local instance of fb-runner-node (this repo) communicates with.

* In one terminal tab, run the [fb-mock-services](https://github.com/ministryofjustice/fb-mock-services) project according to its instructions (e.g. `MOCKENV=yes npm start`)
* Create an `.envmocks` file within this project, the contents of which are:

```sh
export USER_DATASTORE_URL=http://localhost:44444
export USER_FILESTORE_URL=http://localhost:44445
export SUBMITTER_URL=http://localhost:44446
export SERVICE_SECRET=sekrit
export SERVICE_TOKEN=token
export SERVICE_SLUG=slug
export MODULE__ministryofjustice_fb_components_core='/path/to/your/form-builder/fb-components-core'
```

* Within this `fb-runner-node` repo, run this command: `source .envmocks && SERVICE_PATH=/path/to/your/form npm start`

If you are not developing runner features, consider using the [Form Builder Editor Console](https://github.com/ministryofjustice/fb-editor-console-electron) instead.

## Testing

```
npm test
```

Run unit tests only

```
npm run test:unit
```

Run a single unit test

```
./node_modules/.bin/multi-tape lib/controller/page/type/page.summary/page.summary.controller.unit.spec.js
```

Run linting only
```
npm run lint
```

## To deploy and run on Cloud Platforms

See [deployment instructions](DEPLOY.md)
npm package: @solidgoldpig/fb-runtime-node
Description: Transforms Form Builder edit-time service instances into run-time ones
Author: github@alex.solidgoldpig.com
Latest version: 0.1.22

# fb-runtime-node

Transforms Form Builder edit-time service instances into run-time ones

## Installing

```
npm install @solidgoldpig/fb-runtime-node
```

## Testing

``` shell
npm test
# Test output is in [TAP](https://testanything.org/) format
```

Run unit tests only

``` shell
npm run test:unit
```

Run linting only

``` shell
npm run lint
```
npm package: @solidgoldpig/fb-specification
Description: Form Builder specification library
Author: github@alex.solidgoldpig.com
Latest version: 0.3.5

# Form Builder Specifications

JSON Schemas defining Form Builder core components

## Usage

In your components module

```
npm install @solidgoldpig/fb-specifications --save-dev
```

To lint schemas and schema test data and validate the schemas

```
test-specifications
```

## Specifications

Location

```
specifications/${name}/${name}.schema.json
```

### Definitions

Location

```
specifications/definition/${name}/${name}.definition.schema.json
```


## Specification examples

Examples for the schemas are JSON files located in a
data directory at the same level as the schema file.

Valid examples should be in

```
specifications/${name}/data/valid/
```

data.invalid/*.json

```
specifications/${name}/data/invalid/
```

## Validating schemas

NB. All of the following commands should be run from the *fb-specification* root directory:

### Validate all the schemas

Check that test data in each specification’s directory validates against the corresponding schema.

```
npm run test:schemas
```

### Validating a single schema

This command will use the data in the specified schema’s examples directory

```
node validate.js -s {schemaName}
```

### Validating other files

Validate a single file or directory

```
node validate.js {path}
```

### Testing for invalidity

Pass the -i flag (or --invalid)

```
node validate.js {path} -i
```

### Other options for the command line validator

By default, all errors encountered are displayed. To show only the first error encountered, use the --n-a flag (or --no-allErrors)

```
node validate.js {path} --help
```


## Validating/linting data

```
npm run lint
```

this runs

- `lint:schemas`
- `lint:data`

which checks that the files are valid JSON

To format the JSON files

- `format:schemas`
- `format:data`



## Generating documentation

General documentation is located in the documentation directory.

Schemas that have a corresponding .schema.md file will have that content included in the schema’a documentation.

Data test files that have a corresponding .md file will be included in a spec's documentation as examples

1. Check out fb-documentation
2. node expandAll.js
3. cd fb-documentation
4. npm run build
5. Commit and push resulting changes
npm package: @solidgoldpig/fb-submitter-client-node
Description: Form Builder Submitter Client (for Node)
Author: github@alex.solidgoldpig.com
Latest version: 0.0.29

# Deprecated/Unsupported! 
This package has been incorporated into its only dependant 
https://github.com/ministryofjustice/fb-submitter

<hr/>

# Form Builder Submitter Client (Node)

Client for making requests to Form Builder platform submitter endpoints

## Requirements

Node

## Installation

`npm install @solidgoldpig/fb-submitter-client-node`

## Usage

### Loading and initialising

```js
// load client
const FBSubmitterClient = require('@solidgoldpig/fb-submitter-client-node')

// initialise client
const submitterClient = new FBSubmitterClient(serviceSecret, serviceToken, submitterUrl, serviceSlug)
```

### Fetching and storing

```js
// get submission status
const status = await submitterClient.getStatus(submissionId)

// submit 
const status = await submitterClient.submit(userId, userToken, submissions)
```
npm package: @solidgoldpig/fb-user-datastore-client-node
Description: Form Builder User Data Store Client (Node)
Author: github@alex.solidgoldpig.com
Latest version: 0.0.29

# Form Builder User Data Store client (Node)

Client for making requests to Form Builder platform user datastore endpoints

## Requirements

Node

## Installation

`npm install @solidgoldpig/fb-user-datastore-client-node`

## Usage

### Loading and initialising

``` javascript
// load client
const FBUserDataStoreClient = require('@solidgoldpig/fb-user-datastore-client-node')

// initialise client
const userDataStoreClient = new FBUserDataStoreClient(serviceSecret, serviceToken, serviceSlug, userDataStoreUrl)
```

### Fetching and storing

``` javascript
// fetch user data
const userData = await userDataStoreClient.getData(userId, userToken)

// store user data
await userDataStoreClient.setData(userId, userToken, userData)
```
npm package: @solidgoldpig/fb-user-filestore-client-node
Description: Form Builder User File Store Client (Node)
Author: github@alex.solidgoldpig.com
Latest version: 0.0.29

# Form Builder User File Store client (Node)

Client for making requests to Form Builder platform user filestore endpoints

## Requirements

Node

## Installation

`npm install @solidgoldpig/fb-user-filestore-client-node`

## Usage

### Loading and initialising

``` javascript
// load client
const FBUserFileStoreClient = require('@solidgoldpig/fb-user-filestore-client-node')

// initialise client
const userFileStoreClient = new FBUserFileStoreClient(serviceSecret, serviceToken, serviceSlug, userFileStoreUrl)
```

### Fetching and storing

``` javascript
// fetch user file
userFile = await userFileStoreClient.fetch(userId, userToken, fingerprint)
// userFile => { file }

// store user file
policy = { [max_size], [expires], [allowed_types] }
uploadDetails = await userFileStoreClient.store(userId, userToken, file, policy)
// uploadDetails => { fingerpint, url, size, type, date }

// store user file from file path
uploadDetails = await userFileStoreClient.storeFromPath(userId, userToken, filePath, policy)
```
npm package: @solidgoldpig/fb-utils-node
Description: Form Builder utility methods
Author: github@alex.solidgoldpig.com
Latest version: 0.1.7

# fb-utils-node

Form Builder utility methods

## Installing

``` shell
npm install @solidgoldpig/fb-utils-node
```

## Usage

``` js
const FBUtils = require('@solidgoldpig/fb-utils-node')
```

## Methods

### logger

``` js
FBUtils.logger(...args)
```

### clone

Returns a shallow copy of any object

``` js
const clonedObj = FBUtils.clone(obj)
```

Objects can be of any type.

By default, the object copy is shallow.

To create a deep copy, pass 

``` js
const deeplyClonedObj = FBUtils.clone(obj, true)
```

### FBError

Base class for errors

``` js
class MyError extends FBError {}

throw new MyError('An error occurred', {
  data: additionalData
})

```


## Testing

``` shell
npm test
# Test output is in [TAP](https://testanything.org/) format
```

Run unit tests only

``` shell
npm run test:unit
```

Run linting only

``` shell
npm run lint
```
npm package: @solidgoldpig/solidgoldpig-eslint-config
Description: Default SGP eslint config
Author: github@alex.solidgoldpig.com
Latest version: 1.1.3

# eslint-config-fb

Standard Form Builder eslint config.

Based on Standard JS.

## Install

```
npm install @ministryofjustice/eslint-config-fb --save-dev
```

## Usage

Example `.eslintrc` file

```
{
  "extends": "@ministryofjustice/eslint-config-fb"
}
```
npm package: @solidgrounds/react
Description: React integration with solidgrounds
Author: Eric Pinxteren
Latest version: 0.0.1

# Table of Contents

- [Installation](#installation)
- [Solidgrounds react](#solidgrounds-react)
- [Thanks](#thanks)
- [Reads](#reads)

![Licence](https://img.shields.io/npm/l/solidgrounds-logger.svg) [![Build Status](https://travis-ci.org/epinxteren/solidgrounds-logger.svg?branch=master)](https://travis-ci.org/epinxteren/solidgrounds-logger) [![npm version](https://badge.fury.io/js/solidgrounds-logger.svg)](https://badge.fury.io/js/solidgrounds-logger) ![coverage](https://github.com/epinxteren/solidgrounds-logger/raw/master/docs/coverage.svg?sanitize=true)

# Installation

To install the stable version:

```
yarn add @solidgrounds\react
```

This assumes you are using [yarn](https://yarnpkg.com) as your package manager.

or

```
npm install @solidgrounds\react
```

# Solidgrounds react

Exposes solidgrounds service container to react components based on react context consumer and providers.

# Thanks

Special thanks to:

- Eric Pinxteren

# Reads

[solidgrounds](https://github.com/solidgrounds/solidgrounds)
npm package: @solidgrounds/redux
Description: Redux setup with solidgrounds
Author: Eric Pinxteren
Latest version: 0.0.1

# Table of Contents

- [Installation](#installation)
- [Solidgrounds redux](#solidgrounds-redux)
- [Thanks](#thanks)
- [Reads](#reads)

![Licence](https://img.shields.io/npm/l/solidgrounds-logger.svg) [![Build Status](https://travis-ci.org/epinxteren/solidgrounds-logger.svg?branch=master)](https://travis-ci.org/epinxteren/solidgrounds-logger) [![npm version](https://badge.fury.io/js/solidgrounds-logger.svg)](https://badge.fury.io/js/solidgrounds-logger) ![coverage](https://github.com/epinxteren/solidgrounds-logger/raw/master/docs/coverage.svg?sanitize=true)

# Installation

To install the stable version:

```
yarn add @solidgrounds\redux
```

This assumes you are using [yarn](https://yarnpkg.com) as your package manager.

or

```
npm install @solidgrounds\redux
```

# Solidgrounds redux

Exposes redux createStore as solidgrounds feature

# Thanks

Special thanks to:

- Eric Pinxteren

# Reads

[solidgrounds](https://github.com/epinxteren/solidgrounds)