|
| 1 | +# EventBus Publish CLI |
| 2 | + |
| 3 | +A command-line tool for publishing NHS Notify supplier configuration events to AWS EventBridge. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +This package is part of the nhs-notify-supplier-config monorepo. Install dependencies from the root: |
| 8 | + |
| 9 | +```bash |
| 10 | +npm install |
| 11 | +``` |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +```bash |
| 16 | +# Parse an Excel file and output JSON |
| 17 | +npm run cli -- parse -f specs.xlsx |
| 18 | + |
| 19 | +# Publish events to EventBridge |
| 20 | +npm run cli -- publish -f specs.xlsx -b my-bus -r eu-west-2 |
| 21 | + |
| 22 | +# Dry run (build events without sending) |
| 23 | +npm run cli -- publish -f specs.xlsx -b my-bus --dry-run |
| 24 | +``` |
| 25 | + |
| 26 | +### Commands |
| 27 | + |
| 28 | +#### `parse` |
| 29 | + |
| 30 | +Parse an Excel file and output the parsed data as JSON. |
| 31 | + |
| 32 | +| Option | Alias | Description | Default | |
| 33 | +|--------|-------|-------------|---------| |
| 34 | +| `--file` | `-f` | Excel file path | specifications.xlsx | |
| 35 | + |
| 36 | +#### `publish` |
| 37 | + |
| 38 | +Build and publish events to EventBridge. |
| 39 | + |
| 40 | +| Option | Alias | Description | Required | |
| 41 | +|--------|-------|-------------|----------| |
| 42 | +| `--file` | `-f` | Excel file path | No (default: specifications.xlsx) | |
| 43 | +| `--bus` | `-b` | EventBridge event bus name | Yes | |
| 44 | +| `--region` | `-r` | AWS region (fallback: AWS_REGION env) | No | |
| 45 | +| `--dry-run` | | Build events without sending | No | |
| 46 | + |
| 47 | +## Event Types Published |
| 48 | + |
| 49 | +Events are published in the following order: |
| 50 | + |
| 51 | +1. VolumeGroup events |
| 52 | +2. Supplier events |
| 53 | +3. PackSpecification events |
| 54 | +4. SupplierPack events |
| 55 | +5. LetterVariant events |
| 56 | +6. SupplierAllocation events |
| 57 | + |
| 58 | +Each event is assigned a sequence number to maintain ordering. |
| 59 | + |
| 60 | +## Dependencies |
| 61 | + |
| 62 | +- `@nhs-notify/event-builder` - For building events from domain objects |
| 63 | +- `@nhs-notify/excel-parser` - For parsing Excel files |
0 commit comments