This repository contains code and schemas for NHS Notify supplier configuration management.
- Configuration Model: Defines and manages supplier configuration for NHS Notify suppliers.
- Event Schemas: Domain models and event builders for publishing configuration changes as CloudEvents.
A phased approach will be used to improve supplier configuration management:
- Libraries & Validation: Standardise configuration and naming, reduce manual errors, and improve auditability.
- API Layer: Centralise access to supplier configuration data.
- Web UI: Enable operations/admin teams to manage supplier configuration with validation and audit trails.
Configuration entities include:
- Suppliers (print/letter suppliers with capacity and status)
- Volume Groups (time-based allocation periods)
- Pack Specifications (letter pack definitions with postage, assembly, and constraints)
- Letter Variants (channel and campaign-specific letter configurations)
- Supplier Allocations (percentage allocations per volume group)
- Supplier Packs (supplier approval status for pack specifications)
Configuration changes are validated, auditable, and published to environments via an event bus.
-
@supplier-config/event-builder- Builds CloudEvents from domain objects (LetterVariant, PackSpecification, Supplier, VolumeGroup, SupplierAllocation, SupplierPack) -
@nhsdigital/nhs-notify-event-schemas-supplier-config- Domain models and event schemas (Zod)
The event builder package provides functions to construct CloudEvents from domain objects.
import {
buildLetterVariantEvents,
buildPackSpecificationEvents,
buildSupplierEvents,
buildVolumeGroupEvents,
buildSupplierAllocationEvents,
buildSupplierPackEvents,
} from "@supplier-config/event-builder";
// Build events from domain objects
const letterVariantEvents = buildLetterVariantEvents(variants, startingCounter);
const packEvents = buildPackSpecificationEvents(packs, startingCounter);
const supplierEvents = buildSupplierEvents(suppliers, startingCounter);
const volumeGroupEvents = buildVolumeGroupEvents(volumeGroups, startingCounter);
const allocationEvents = buildSupplierAllocationEvents(allocations, startingCounter);
const supplierPackEvents = buildSupplierPackEvents(supplierPacks, startingCounter);Event source is configured via environment variables:
EVENT_ENV- Environment identifier (default:dev)EVENT_SERVICE- Service identifier (default:events)EVENT_DATASCHEMAVERSION- Schema version (default: from schema package)
Source format: /control-plane/supplier-config/<EVENT_ENV>/<EVENT_SERVICE>
npm install# Run all tests
npm run test:unit
# Test specific package
npm run test:unit --workspace @supplier-config/event-builder# Lint all packages
npm run lint
# Fix linting issues
npm run lint:fixnpm run typecheckAll events follow the CloudEvents specification with the following envelope:
specversion- CloudEvents spec version (1.0)id- Unique event ID (UUID)source- Event source path (e.g.,/control-plane/supplier-config/dev/events)subject- Entity path (e.g.,letter-variant/<id>)type- Event type based on entity and statustime- Event timestampdatacontenttype- application/jsondataschema- Schema URLdataschemaversion- Schema versiondata- Event payload (the domain object)traceparent- W3C trace contextrecordedtime- Recording timestampseveritytext- Severity level (INFO)severitynumber- Numeric severity (2)partitionkey- Partition key for orderingsequence- Sequence number for ordering
Describe or link templates on how to raise an issue, feature request or make a contribution to the codebase. Reference the other documentation files, like
- Environment setup for contribution, i.e.
CONTRIBUTING.md - Coding standards, branching, linting, practices for development and testing
- Release process, versioning, changelog
- Backlog, board, roadmap, ways of working
- High-level requirements, guiding principles, decision records, etc.
Provide a way to contact the owners of this project. It can be a team, an individual or information on the means of getting in touch via active communication channels, e.g. opening a GitHub discussion, raising an issue, etc.
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.
Any HTML or Markdown documentation is © Crown Copyright and available under the terms of the Open Government Licence v3.0.