open-index/open-npm huggingface dataset:
npm package: @ministryofjustice/eslint-config-fb
Description: Form Builder ESLint configuration
Author: Form Builder Team
Latest version: 1.1.9
Deprecated: This package will not receive ongoing development

# eslint-config-fb

The Form Builder ESLint configuration implements [Standard JS](https://standardjs.com/) and additional rules, outlined below.

## Installation

Install from NPM:

```
npm i -D @ministryofjustice/eslint-config-fb
```

## Usage

Create an `.eslintrc` file in the root of your package:

```
{
  "extends": "@ministryofjustice/eslint-config-fb"
}
```

## Rules

* array-bracket-newline
* array-bracket-spacing
* no-extra-parens
* no-var
* object-curly-spacing
* prefer-template
* quote-props
* quotes
* template-curly-spacing

### array-bracket-newline

[Enforces line breaks after opening and before closing array brackets](https://eslint.org/docs/rules/array-bracket-newline)

### array-bracket-spacing

[Enforces consistent spacing inside array brackets](https://eslint.org/docs/rules/array-bracket-spacing)

### no-extra-parens

[Ignores extra parentheses](https://eslint.org/docs/rules/no-extra-parens) (according to conditions)

### no-var

[Discourages the use of `var` and encourages the use of `const` or `let`](https://eslint.org/docs/rules/no-var)

### object-curly-spacing

[Enforces consistent spacing inside braces of object literals, destructuring assignments, and `import`/`export` specifiers](https://eslint.org/docs/rules/object-curly-spacing)

### prefer-template

[Flags usage of `+` operators with strings](https://eslint.org/docs/rules/prefer-template)

### quote-props

[Requires quotes around object literal property names](https://eslint.org/docs/rules/quote-props)

### quotes

[Enforces the consistent use of either backticks, double, or single quotes](https://eslint.org/docs/rules/quotes)

### template-curly-spacing

[Maintains consistency around the spacing inside of template literal](https://eslint.org/docs/rules/template-curly-spacing)
npm package: @ministryofjustice/fb-components-core
Description: Form Builder core components
Author: Form Builder Team
Latest version: 3.4.1
Deprecated: This package will not receive ongoing development

# fb-components-core

Components for Form Builder.

## Installation

```
npm install @ministryofjustice/fb-components-core
```

## Overview

Components for Form Builder are described with the [JSON Schema](https://json-schema.org/) vocabulary in discrete JSON files. They are contained in the directory `specifications`.

Some data objects (which satisfy the schemas and are consumed by the Form Builder application) are contained in the directory `metadata`.

## `$id` and `$ref`

Each schema has an `$id`. Many schemas have one or more `$ref` attributes. Superficially, both are URIs, but they require additional processing at runtime to resolve.

For instance, the definition for a button component may resemble this schema:


```
{
  "$id": "http://gov.uk/schema/v1.0.0/definition/button",
  "_name": "definition.button",
  "title": "Button component definition"
}
```
And that definition may be referenced elsewhere:

```
{
  "$id": "http://gov.uk/schema/v1.0.0/button",
  "_name": "button",
  "title": "Button component",
  "allOf: [
    {
      "$ref": "http://gov.uk/schema/v1.0.0/definition/button"
    }
  ]
}
```

But neither the `$id` nor the `$ref` URIs resolve to a _location_ accessible with HTTP.

Instead these URIs must be transformed and mapped to the location of the schema, wherever it is.

That location can be determined in two steps:

1. The fragment `http://gov.uk/schema/v1.0.0` of the URI should map to the `specifications` directory wherever `@ministryofjustice/fb-components-core` is installed or hosted. (The location may be on the file system or at a resource on the internet)

2. The remainder of the URI should be used to compute the path to that particular JSON Schema file, such that `/definition/button` becomes `/definition/button/definition.button.schema.json`

While these patterns are internally consistent and the schemas can be validated with some tools, such as [AJV](https://www.npmjs.com/package/ajv), they cannot be dereferenced by other tools, such as [JSON Schema $Ref Parser](https://www.npmjs.com/package/json-schema-ref-parser), without an additional processing step.

## Circularity and recursion

The schemas are highly referential and some represent tree structures which validators can interpret as circular. Circular references cannot easily be transformed to JSON and the schemas may fail validation, depending on the tool.

Recursion is isolated to schemas which define _conditional_ behaviour, and specifically conditions which can themselves have conditions:

* `/specifications/definition/conditional/boolean/definition.conditional.boolean.schema.json`
* `/specifications/definition/conditions/any/definition.conditions.all.schema.json`
* `/specifications/definition/conditions/all/definition.conditions.any.schema.json`
* `/specifications/definition/conditions/exactly/definition.conditions.exactly.schema.json`

These conditions are tree structures which can resolve.
npm package: @ministryofjustice/fb-deploy-utils
Description: Utility scripts to deploy Form Builder applications
Author: Form Builder Team
Latest version: 1.1.0

# fb-deploy-utils

Utility scripts to aid deployment of Form Builder platform applications

## Install

```bash
npm install @ministryofjustice/fb-deploy-utils --save-dev
```

## Scripts

The following helper scripts are available
`node_modules/@ministryofjustice/fb-deploy-utils/bin`

They are intended to be called by corresponding scripts for a specific application

`build_platform_images.sh`

Builds all images for the application, retrieves the AWS secrets for each image repo, and pushes the images to the ECR repo

`deploy_platform.sh`

Generates kubernetes config files from and applies to the 

`restart_platform_pods.sh`

Deletes application pods which Kubernetes will then recreate as specified by the application's deployment 


All script args and options can viewed by passing the `-h` option

All scripts take the `-p` parameter to specify the platform environment

All scripts take the `-n` parameter to perform a dry run
npm package: @ministryofjustice/fb-editor-node
Description: Form Builder Editor (for Node)
Author: Form Builder Team
Latest version: 0.2.14

# fb-editor-node

**Form Builder Editor** creates forms as configuration data for **[Form Builder Runner](https://github.com/ministryofjustice/fb-runner-node)**.

## Pre-requisites

[Node](https://nodejs.org) >= 12.4.0

## Installation

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

## Usage

The `SERVICE_PATH` environment variable describes the location on your file system of the form for **Editor** to use.

To set the `SERVICE_PATH` environment variable, open a terminal and change into the root directory of **Runner**, then execute the command:

```sh
SERVICE_PATH=[path to form] npm start
```

(Where `[path to form]` is a path to the location on your file system of the form. An Example Service form can be cloned from `https://github.com/ministryofjustice/fb-example-service`.)

By default, **Editor** will start on localhost port `3000`.

To run on a different port, set the `PORT` environment variable:

```sh
PORT=4321 SERVICE_PATH=[path to form] npm start
```

## Testing

```
npm test
```

### Linting

```
npm run lint
```

## Module Aliases

Some module paths are _aliased_.

At runtime they are resolved with [`@ministryofjustice/module-alias`](https://www.npmjs.com/package/@ministryofjustice/module-alias). (Its definitions can be found in the `_moduleAliases {}` field on `package.json`.)

During development aliases can be resolved in different ways according to needs of the developer's IDE. A solution we provide is via Webpack, [which is supported automatically in WebStorm and related IDEs](https://blog.jetbrains.com/webstorm/2017/06/webstorm-2017-2-eap-172-2827/), or with some [manual steps](https://stackoverflow.com/questions/34943631/path-aliases-for-imports-in-webstorm).

At start-up WebStorm will report in the *Event Log* that "Module resolution rules from `webpack.config.js` are now used for coding assistance" if the configuration is automatically identified -- if not, follow the manual steps:

1. Right-click on the `lib` directory and select `Mark Directory as > Resource root`
2. From the application menu select `Preferences > Languages & Frameworks > JavaScript > Webpack` then in the right-hand pane use the file browser to select `webpack.config.js` from the package root

You shouldn't need to restart but it won't hurt.
npm package: @ministryofjustice/fb-jwt-client-node
Description: Form Builder JSON Web Token Client (Node)
Author: Form Builder Team
Latest version: 0.0.35
Deprecated: This package will not receive ongoing development

# 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 @ministryofjustice/fb-jwt-client-node`

## Usage

### Loading and initialising basic client

``` javascript
// load client class
const FBJWTClient = require('@ministryofjustice/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: @ministryofjustice/fb-nunjucks-helpers
Description: Form Builder Nunjucks helpers
Author: Form Builder Team
Latest version: 0.0.25
Deprecated: This package will not receive ongoing development

# 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: @ministryofjustice/fb-runtime-node
Description: Ingests and transforms service instances for Form Builder.
Author: Form Builder Team
Latest version: 0.1.24
Deprecated: This package will not receive ongoing development

# @ministryofjustice/fb-runtime-node

Ingests and transforms service instances for Form Builder.

A dependency of `@ministryofjustice/fb-runner-node`.

## Installation

```
npm i -P @ministryofjustice/fb-runtime-node
```
npm package: @ministryofjustice/fb-specification
Description: Form Builder specification library
Author: Form Builder Team
Latest version: 0.3.8
Deprecated: This package will not receive ongoing development

# Form Builder Specifications

JSON Schemas defining Form Builder core components

## Usage

In your components module

```
npm install @ministryofjustice/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: @ministryofjustice/fb-submitter-client-node
Description: Form Builder Submitter Client (for Node)
Author: Form Builder Team
Latest version: 0.0.28
Deprecated: This package will not receive ongoing development

# Form Builder Submitter Client (Node)

Client for making requests to Form Builder platform submitter endpoints

## Requirements

Node

## Installation

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

## Usage

### Loading and initialising

```js
// load client
const FBSubmitterClient = require('@ministryofjustice/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: @ministryofjustice/fb-user-datastore-client-node
Description: Form Builder User Data Store Client (for Node)
Author: Form Builder Team
Latest version: 0.0.34
Deprecated: This package will not receive ongoing development

# Form Builder User Data Store client (Node)

Client for making requests to Form Builder platform user datastore endpoints

## Requirements

Node

## Installation

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

## Usage

### Loading and initialising

``` javascript
// load client
const FBUserDataStoreClient = require('@ministryofjustice/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: @ministryofjustice/fb-user-filestore-client-node
Description: Form Builder User File Store Client (for Node)
Author: Form Builder Team
Latest version: 0.0.34
Deprecated: This package will not receive ongoing development

# Form Builder User File Store client (Node)

Client for making requests to Form Builder platform user filestore endpoints

## Requirements

Node

## Installation

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

## Usage

### Loading and initialising

``` javascript
// load client
const FBUserFileStoreClient = require('@ministryofjustice/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: @ministryofjustice/fb-utils-node
Description: Form Builder utilities
Author: Form Builder Team
Latest version: 0.1.8
Deprecated: This package will not receive ongoing development

# fb-utils-node

Form Builder utility methods

## Installing

```sh
npm install @ministryofjustice/fb-utils-node
```

## Usage

```js
const FBUtils = require('@ministryofjustice/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 `true`:

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

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

Run unit tests only

```sh
npm run test:unit
```

Run linting only

```sh
npm run lint
```
npm package: @ministryofjustice/frontend-types
Description: Provides typescript definitions as ambient modules for these client-side libraries/components:
Author: hmpps-developers
Latest version: 1.0.0-alpha.2

# @ministryofjustice/frontend-types

Provides typescript definitions as ambient modules for these client-side libraries/components:

- [GOV.UK frontend](https://design-system.service.gov.uk)
- [MoJ frontend](https://design-patterns.service.justice.gov.uk)
- [Accessible Autocomplete](https://github.com/alphagov/accessible-autocomplete)

## Status

**This library is currently: ready to trial.**
Teams are welcome to trial this library. Please provide feedback via slack to the `#typescript` channel.

## Usage

Usage will be best demonstrated by the [HMPPS typescript template](https://github.com/ministryofjustice/hmpps-template-typescript)
once this package is published and [incorporated](https://github.com/ministryofjustice/hmpps-template-typescript/pull/681).

Note the `tsconfig.json` in the /assets/js folder, particularly the `lib` and `typeRoots` properties.

```typescript
import * as govukFrontend from 'govuk-frontend'
import * as mojFrontend from '@ministryofjustice/frontend'

govukFrontend.initAll()
mojFrontend.initAll()

class MyPrintButton extends govukFrontend.Component {
  static moduleName = 'my-print-btn'

  constructor(root: HTMLElement) {
    super(root)
    root.addEventListener('click', event => {
      event.preventDefault()
      window.print()
    })
  }
}

govukFrontend.createAll(MyPrintLink)
```

```html
<a href="#" data-module="my-print-link">Print</a>
```

## Developing this package

Type definitions in the `src/@types` folder must be ambient typescript modules. All of these are concatenated into
one file during build; sources and tests are not included.

When adding or updating type defitions, the target version or version ranges should be updated
in the `peerDependencies` property in package.json. These peer dependencies should be marked as optional so that
client projects aren’t required to install them.

The `devDependencies` property should contain a precise version
(which is compatible with the peer dependency version ranges) so that this package can be tested in isolation.
npm package: @ministryofjustice/hmpps-connect-dps-shared-items
Description: A package to share Connect DPS functionality across applications
Author: hmpps-developers
Latest version: 3.7.4

# hmpps-connect-dps-shared-items

[![repo standards badge](https://img.shields.io/badge/endpoint.svg?&style=flat&logo=github&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-connect-dps-shared-items-package)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/hmpps-connect-dps-shared-items-package "Link to report")
[![Test, lint & publish](https://github.com/ministryofjustice/hmpps-connect-dps-shared-items-package/actions/workflows/pipeline.yml/badge.svg?branch=main)](https://github.com/ministryofjustice/hmpps-connect-dps-shared-items-package/actions/workflows/pipeline.yml)

A library for sharing DPS Components across applications.

## Contents

1. [Using the library](#using-the-library)
2. [Library components](#library-components)
3. [For library developers](#for-library-developers)


## Using the library

### Installation

To install the package, run the following command:

```bash
npm install @ministryofjustice/hmpps-connect-dps-shared-items
```

### Nunjucks macro usage

Add the `hmpps-connect-dps-shared-items` assets directory to nunjucks configuration in your application:

```javascript
    const njkEnv = nunjucks.configure(
  [
    path.join(__dirname, '../../server/views'),
    ...,
    'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/',
  ],
  {
    autoescape: true,
    express: app,
  },
)
```

then import the component into your nunjucks file:
```nunjucks
{% from "dps/components/alert-flag/macro.njk" import alertFlag %}
```

### Styling
Include the package scss within the `index.scss` file. You can either import all:
```scss
  @import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/scss/all';
```
or import the specific component scss you are using, e.g:
```scss
  @import 'node_modules/@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/dps/components/alert-flag/alert-flag';
```

### Client side javascript

In your client side javascript, include:
```js
import * as connectDps from '@ministryofjustice/hmpps-connect-dps-shared-items/dist/assets/js/all'

connectDps.initAll()
```

## Library Components:

1. [Alert Flag](readme/components/alertFlag/alert-flag.md)
2. [Address Autosuggest](readme/components/addressAutosuggest/address-autosuggest.md)
3. [Webcam Upload](readme/components/webcamCapture/webcam-capture.md)

## For Library Developers

1. [Publishing to NPM](readme/publishing.md)
npm package: @ministryofjustice/hmpps-court-cases-release-dates-design
Description: A shared frontend library for HMPPS Court cases and release dates product set services
Author: HMPPS Digital Studio
Latest version: 5.0.1

# HMPPS Court cases and release dates frontend

## Add to prototype

Install the package:

`npm install @ministryofjustice/hmpps-court-cases-release-dates-design`

Add the macro to your template.html file:

```nunjucks{% from "hmpps/components/mini-profile/macro.njk" import miniProfile %}```

Use the macro:

```nunjucks
{% set person = {
    firstName: 'Neil',
    lastName: 'Rudge',
    prisonerNumber: 'A1234BC',
    dateOfBirth: '1932-02-02',
    status: 'On remand',
    prisonName: 'HMP Kirkham',
    cellLocation: 'A-1-1'
} %}

{{ miniProfile(person, '/plugin-assets/@ministryofjustice/hmpps-court-cases-release-dates-design/hmpps/assets/images/prisoner-profile-image.png', '#') }}
```
npm package: @ministryofjustice/hmpps-prisoner-auth
Description: Middleware for providing authentication against Launchpad Auth
Author: hmpps-launchpad-devs
Latest version: 0.0.5

# Prisoner Auth

## Installation

### Quick installation

The following steps will give an opinionated out of the box setup for applications where a launchpad user will be the main user in the system.

1. Add the package `@ministryofjustice/hmpps-prisoner-auth` to your `package.json`
```sh
npm add --save @ministryofjustice/hmpps-prisoner-auth
npm i
```

2. Copy the contents of [src/misc/install.diff](src/misc/install.diff) to your local folder
```sh
curl https://raw.githubusercontent.com/ministryofjustice/hmpps-prisoner-facing-typescript-lib/refs/heads/main/packages/prisoner-auth/src/misc/install.diff > install.diff
```

3. Apply the diff to carry out all the required changes
```sh
git apply install.diff
```

4. Make sure to look through the applied changes and remove the diff file before committing.

5. Fill in the configuration options in `server/middleware/setUpPrisonerAuth.ts`:

See [PrisonerAuthOptions](https://raw.githubusercontent.com/ministryofjustice/hmpps-prisoner-facing-typescript-lib/refs/heads/main/packages/prisoner-auth/src/main/prisonerAuth.ts) for full documentation on the avaialble options

### Manual installation

NOTE: see [install.diff](https://raw.githubusercontent.com/ministryofjustice/hmpps-prisoner-facing-typescript-lib/refs/heads/main/packages/prisoner-auth/src/misc/install.diff) for an authorititive list of changes to be made.

1. Add the package `@ministryofjustice/hmpps-prisoner-auth` to your `package.json`
```sh
npm add --save @ministryofjustice/hmpps-prisoner-auth
npm i
```

2. Modify `interfaces/hmppsUser.ts` to make the following additions:
```ts
# add prisoner-auth to the AuthSource type
export type AuthSource = 'nomis' | 'delius' | 'external' | 'azuread' | 'prisoner-auth'

# add LaunchpadUser to the HmppsUser type
export type HmppsUser = PrisonUser | ProbationUser | ExternalUser | AzureADUser | LaunchpadUser
```
These changes will help smooth over alot of assumptions made in the typescript template about the type of fields the user will have.

3. Add `server/middleware/setUpPrisonerAuth.ts` middlware:

```sh
curl https://raw.githubusercontent.com/ministryofjustice/hmpps-prisoner-facing-typescript-lib/refs/heads/main/packages/prisoner-auth/src/misc/setUpPrisonerAuth.ts.example > server/middleware/setUpPrisonerAuth.ts
```
Make sure to fill in the appropriate values.

See [PrisonerAuthOptions](https://raw.githubusercontent.com/ministryofjustice/hmpps-prisoner-facing-typescript-lib/refs/heads/main/packages/prisoner-auth/src/main/prisonerAuth.ts) for full documentation on the avaialble options

4. Modify `server/app.ts`:
  - ADD `setUpPrisonerAuth()` to enable the middlware.
  - REMOVE reference to `authorisationMiddleware()` - this checks the users `ROLE_` which a launchpad user will not have.
  - REMOVE reference to `setUpCurrentUser()` - this sets up the `res.locals.user` fields which a launchpad will have already (`name`, `displayName` etc).
npm package: @ministryofjustice/hmpps-prisoner-facing-components
Description: A collection of components for use when developing prisoner facing applications
Author: hmpps-launchpad-devs
Latest version: 0.0.8

# Prisoner Facing Services Components

This module defines a number of components intened for use when developing prisoner facing applications.

## Front end components

- [launchpad-footer](src/assets/pfs/components/launchpad-footer)
- [launchpad-header](src/assets/pfs/components/launchpad-header)
- [lazy-load](src/assets/pfs/components/lazy-load)

## Installation

1. Add the npm module

```bash
npm install --save @ministryofjustice/hmpps-prisoner-facing-components
```

2. Configure nunjucks for importing macros (usually found in `server/utils/nunjucksSetup.ts`)

```ts
const njkEnv = nunjucks.configure(
  [
    ...,
    'node_modules/@ministryofjustice/hmpps-prisoner-facing-components/dist/assets/',
  ],
  {
    autoescape: true,
    express: app,
    ...
  },
)
```

Then you can import the component you wish to use

```njk
{% from "pfs/components/launchpad-header/macro.njk" import launchpadHeader %}
```

3. Setup the styling in your `assets/scss/index.scss`

Either add all styles

```scss
  @import 'node_modules/@ministryofjustice/hmpps-prisoner-facing-components/dist/assets/scss/all';
```

or just the components you wish to use

```scss
  @import 'node_modules/@ministryofjustice/hmpps-prisoner-facing-components/dist/assets/pfs/components/launchpad-header';
```

4. Add any client side javascript you wish to use

Within your client side javascript, include:

```js
import * as pfsComponents from '@ministryofjustice/hmpps-prisoner-facing-components/dist/assets/js/all'
pfsComponents.initAll()
```

or just the components you wish to use:

```js
import { lazyLoad } from '@ministryofjustice/hmpps-prisoner-facing-components/dist/assets/js/all'
lazyLoad.initAll()
```
npm package: @ministryofjustice/module-alias
Description: Module aliases (based on work by Nick Gavrilov artnikpro@gmail.com)
Author: Form Builder Team
Latest version: 1.1.1

# @ministryofjustice/module-alias

**Module Alias** creates _aliases_ to the location of any package on your file system from configuration in `package.json`.

Not:

```js
require('../../../../some/very/deep/module')
```

But:
```js
const module = require('@deep/module')
```

Or you can register _directories_ that will behave like `node_modules`.

## Install

```
npm i -P @ministryofjustice/module-alias
```

## Usage

Add configuration to `package.json`:

### Aliases

```js
{
  "_moduleAliases": {
    "@root"      : ".",
    "@deep"      : "src/some/very/deep/directory/or/file",
    "@my_module" : "lib/some-file.js",
    "something"  : "src/foo"
  }
}
```

### Directories
```js
{
  "_moduleDirectories": [
    "src/node_modules_custom"
  ]
}

```

**Module Alias** will resolve the location of `package.json` and register any aliases contained in it before applying the alias to `require` during execution.

### Registering from an _entry point_

Include this line at the top of your _entry point_ JS file:

```js
require('@ministryofjustice/module-alias/register')
```
The path to `package.json` is determined from the location of the _process current working directory_. (Ordinarily, this is _root_ directory of the application.)

### Registering from a _module_

Include this line at the top of _any_ JS file:
```js
require('@ministryofjustice/module-alias/register-module')(module)
```
The path to `package.json` is derived from the location of the _module_. (This is useful when the path to `package.json` cannot be determined from the location of the _process current working directory_.)



## About this package

`@ministryofjustice/module-alias` is a fork of [`module-alias`](https://www.npmjs.com/package/module-alias) with an improved mechanism for resolving the location of `package.json` and the removal of some features we do not use.
npm package: @minisylar/shopify-app-session-storage-better-sqlite
Description: A session storage implementation for Shopify apps using better-sqlite3.
Author: Mini-Sylar
Latest version: 1.1.3

# shopify-app-session-storage-better-sqlite

A drop‑in SQLite session storage implementation for Shopify apps.

Designed primarily to power the [shopify-app-vue-template](https://github.com/Mini-Sylar/shopify-app-vue-template)
during local development, this package implements the same interface used by
`@shopify/shopify-app-session-storage` but persists sessions to a lightweight
SQLite file. It's useful when you want minimal dependencies and don't need a
remote database in the early stages of building a Shopify app.

> ⚠️ **For production use or more complex requirements** consider one of the
> officially supported stores such as the [Drizzle](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-drizzle) or
> [Prisma](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-prisma) adapters; they work well with hosted
> databases and scale more easily. This package is mainly for local demos,
> prototypes, or when you deliberately choose a self‑contained file‑based
> store.

## Usage

```ts
import { SQLiteSessionStorage } from "shopify-app-session-storage-better-sqlite";

const storage = new SQLiteSessionStorage({
  databasePath: "./sessions.sqlite", // or ':memory:' for in‑memory
});

// pass `storage` to whatever initializes your Shopify API client
```

Refer to the upstream [`@shopify/shopify-app-session-storage`](https://github.com/Shopify/shopify-app-session-storage)
readme for the full API – this module implements the same methods and behaviours.

## Development

```bash
# install deps
pnpm install

# run unit tests (Vitest)
pnpm test

# build the package
pnpm run build
```

Tests live under `tests/` and use the `*.test.ts` suffix. They exercise the
storage class against a battery of session‑management scenarios and are
already passing.

> Because the implementation now exists, running `pnpm test` should give you
> a clean green output.

## Publishing

Releases are driven by [semantic-release](https://semantic-release.gitbook.io/),
triggered by GitHub Actions. Pushing a `vX.Y.Z` tag to **main** will build,
update the changelog, create a GitHub release, and publish to npm. The
workflow is defined in `.github/workflows/release.yml`.

---

Feel free to use this store locally and swap to a different adapter later as
your needs change. Happy building!