|
1 | 1 | # SpaceCat Task Processor |
2 | 2 |
|
3 | | -> SpaceCat Task Processor for processing spacecat tasks. |
| 3 | +## Overview |
| 4 | + |
| 5 | +SpaceCat Task Processor is a Node.js service that processes messages from the AWS SQS queue `SPACECAT-TASK-PROCESSOR-JOBS`. Based on the `type` field in each message, it dispatches the message to the appropriate handler for processing various site-related tasks. |
| 6 | + |
| 7 | +## Features |
| 8 | +- Receives and processes messages from SQS |
| 9 | +- Supports multiple task types via modular handlers |
| 10 | +- Handlers for audit status, demo URL preparation, and disabling imports/audits |
| 11 | +- Extensible and easy to add new handlers |
| 12 | + |
| 13 | +## Handlers |
| 14 | +- **audit-status-processor**: Checks and reports audit status for a site |
| 15 | +- **demo-url-processor**: Prepares and shares a demo URL for a site |
| 16 | +- **disable-import-audit-processor**: Disables specified imports and audits for a site |
| 17 | + |
| 18 | +## Project Structure |
| 19 | +- `src/` - Main source code |
| 20 | + - `audit-status-processor/handler.js` |
| 21 | + - `demo-url-processor/handler.js` |
| 22 | + - `disable-import-audit-processor/handler.js` |
| 23 | + - `index.js` - Main entry point and handler dispatcher |
| 24 | +- `test/` - Test files |
| 25 | + |
| 26 | +## Setup |
| 27 | +1. Clone the repository |
| 28 | +2. Install dependencies: |
| 29 | + ```sh |
| 30 | + npm ci |
| 31 | + ``` |
| 32 | +3. Configure AWS credentials and environment variables as needed |
| 33 | + |
| 34 | +## Usage |
| 35 | +- The service is designed to run as a serverless function or background worker. |
| 36 | +- It listens for messages on the SQS queue and processes them automatically. |
| 37 | + |
| 38 | +## Development |
| 39 | +- To run tests: |
| 40 | + ```sh |
| 41 | + npm test |
| 42 | + ``` |
| 43 | +- To lint code: |
| 44 | + ```sh |
| 45 | + npm run lint |
| 46 | + ``` |
| 47 | + |
| 48 | +## Extending |
| 49 | +To add a new handler: |
| 50 | +1. Create a new folder in `src/` for your handler. |
| 51 | +2. Export your handler function. |
| 52 | +3. Add it to the handler mapping in `src/index.js`. |
| 53 | + |
| 54 | +--- |
| 55 | +For more details, see the documentation in `src/README.md`. |
4 | 56 |
|
5 | 57 | ## Status |
6 | 58 | [](https://codecov.io/gh/adobe-rnd/spacecat-task-processor) |
|
0 commit comments