Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cefa6f8
Feature: Add initial schemas and events for supplier configuration
m-houston Nov 14, 2025
550cf6d
Fix: dependencies
m-houston Nov 14, 2025
8bc340b
Remove domain prefix from subject in event envelope
m-houston Nov 14, 2025
9a6caf0
Remove documentation examples
m-houston Nov 20, 2025
1cc5b99
Merge branch 'main' into CCM-12869-supplier-config-events
m-houston Nov 20, 2025
94afeb4
Remove generated files from git
m-houston Nov 20, 2025
3512e44
Add contract events
m-houston Nov 20, 2025
c9a9894
Remove stray readme
m-houston Nov 20, 2025
5c440bf
Add supplier model events
m-houston Nov 20, 2025
21f3557
Refactor contract references to volume group in schemas and events
m-houston Nov 26, 2025
3aaf40d
Add volume group events and update JSON generation
m-houston Nov 26, 2025
7977cad
Refactor status handling to use $EnvironmentStatus across configurations
m-houston Jan 15, 2026
da25b97
Update tests
m-houston Jan 15, 2026
1ac2fdd
Add approval status validation and update enums in specifications
m-houston Jan 18, 2026
32ab2da
Update deliverySLA to deliveryDays and change status references to PROD
m-houston Jan 18, 2026
e1e9bfd
Refactor colour property to restrict to WHITE and update description
m-houston Jan 18, 2026
e1a0f42
Add DISABLED status to various entities and update related schemas
m-houston Jan 19, 2026
4386d92
Add optional description to PackSpecification and update tests
m-houston Jan 20, 2026
41ddd2d
Add duplex field validation to PackSpecification and update tests
m-houston Jan 21, 2026
437e88c
Add ATTACHMENT type to PackSpecification $Insert schema
m-houston Jan 21, 2026
72af2fa
Add constraints validation to PackSpecification and related tests
m-houston Feb 2, 2026
31710cd
Event Builder: tools for constructing valid config events from payloa…
m-houston Nov 14, 2025
0151ff9
Remove content that lives on other branches
m-houston Feb 2, 2026
66f7ef5
Refactor event builder tests to remove unnecessary imports and use st…
m-houston Feb 2, 2026
e1ca80d
Refactor: Excel to config model parser tooling
m-houston Feb 2, 2026
261a594
Enhance Excel parsing: update constraints structure and add CLI for p…
m-houston Feb 3, 2026
21b2499
Merge branch 'main' into CCM-12869-excel-parser
m-houston Apr 14, 2026
f3b7240
Refactor: Publish configuration to eventbus
m-houston Feb 2, 2026
2db1fe5
Add tests for eventbus publisher functionality and CLI commands
m-houston Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ dist

.env
/.envrc
/specifications.xlsx
~*
63 changes: 63 additions & 0 deletions packages/cli-eventbus-publish/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# EventBus Publish CLI

A command-line tool for publishing NHS Notify supplier configuration events to AWS EventBridge.

## Installation

This package is part of the nhs-notify-supplier-config monorepo. Install dependencies from the root:

```bash
npm install
```

## Usage

```bash
# Parse an Excel file and output JSON
npm run cli -- parse -f specs.xlsx

# Publish events to EventBridge
npm run cli -- publish -f specs.xlsx -b my-bus -r eu-west-2

# Dry run (build events without sending)
npm run cli -- publish -f specs.xlsx -b my-bus --dry-run
```

### Commands

#### `parse`

Parse an Excel file and output the parsed data as JSON.

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `--file` | `-f` | Excel file path | specifications.xlsx |

#### `publish`

Build and publish events to EventBridge.

| Option | Alias | Description | Required |
|--------|-------|-------------|----------|
| `--file` | `-f` | Excel file path | No (default: specifications.xlsx) |
| `--bus` | `-b` | EventBridge event bus name | Yes |
| `--region` | `-r` | AWS region (fallback: AWS_REGION env) | No |
| `--dry-run` | | Build events without sending | No |

## Event Types Published

Events are published in the following order:

1. VolumeGroup events
2. Supplier events
3. PackSpecification events
4. SupplierPack events
5. LetterVariant events
6. SupplierAllocation events

Each event is assigned a sequence number to maintain ordering.

## Dependencies

- `@nhs-notify/event-builder` - For building events from domain objects
- `@nhs-notify/excel-parser` - For parsing Excel files
72 changes: 72 additions & 0 deletions packages/cli-eventbus-publish/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",

// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
collectCoverage: true,

// The directory where Jest should output its coverage files
coverageDirectory: "./.reports/unit/coverage",

// Indicates which provider should be used to instrument code for coverage
coverageProvider: "babel",

coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: -10,
},
},

coveragePathIgnorePatterns: ["/__tests__/", "/cli.ts"],

// Use this configuration option to add custom reporters to Jest
reporters: [
"default",
[
"jest-html-reporter",
{
pageTitle: "Test Report",
outputPath: "./.reports/unit/test-report.html",
includeFailureMsg: true,
},
],
],

moduleNameMapper: {
"^@supplier-config/cli-eventbus-publish/(.*)$": "<rootDir>/src/$1",
"^@supplier-config/event-builder/(.*)$":
"<rootDir>/../event-builder/src/$1",
"^@supplier-config/event-builder$":
"<rootDir>/../event-builder/src/index.ts",
"^@supplier-config/excel-parser/(.*)$": "<rootDir>/../excel-parser/src/$1",
"^@supplier-config/excel-parser$": "<rootDir>/../excel-parser/src/index.ts",
},

testEnvironment: "node",
testMatch: ["**/__tests__/**/*.ts", "**/?(*.)+(spec|test).ts"],
moduleFileExtensions: ["ts", "js", "json", "node"],
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
transform: {
"^.+\\.tsx?$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
tsx: false,
},
target: "es2022",
},
},
],
},
};

export default config;
33 changes: 33 additions & 0 deletions packages/cli-eventbus-publish/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"bin": {
"eventbus-publish": "dist/cli.js"
},
"dependencies": {
"@aws-sdk/client-eventbridge": "^3.592.0",
"@supplier-config/event-builder": "*",
"@supplier-config/excel-parser": "*",
"yargs": "^17.7.2"
},
"devDependencies": {
"@swc/core": "^1.11.13",
"@swc/jest": "^0.2.37",
"@tsconfig/node22": "^22.0.2",
"@types/jest": "^29.5.14",
"@types/yargs": "^17.0.32",
"jest": "^29.7.0",
"jest-mock-extended": "^3.0.7",
"typescript": "^5.9.3"
},
"name": "@supplier-config/cli-eventbus-publish",
"private": true,
"scripts": {
"build": "tsc",
"cli": "ts-node src/cli.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "jest",
"test:unit": "jest",
"typecheck": "tsc --noEmit"
},
"version": "0.0.1"
}
Loading
Loading