spectra-shared-data
v0.1.22
Published
Shared DTOs, enums, and route constants for the Spectra canvas service. Single source of truth for request/response shapes consumed by spectra-canvas and spectra-core.
Readme
spectra-shared-data
Shared DTOs, enums, and route constants for the Spectra canvas domain. Single source of truth for request/response shapes consumed by spectra-canvas (the service) and spectra-core (the proxy).
Status: Published automatically via CI when
versioninpackage.jsonis bumped on merge/push tomain.
What belongs here
- Request/response DTOs validated with
class-validator+class-transformer. - Route path constants and domain enums (
NODE_TYPE,CONNECTOR_TYPE,DESIGN_CANVAS_STATUS, ...).
What does not belong here
- HTTP clients, retry logic, or service classes (not an SDK).
- Mongoose schemas (stay in
spectra-canvas). - Cross-cutting service utilities (auth helpers, loggers).
Install
npm install --save-exact spectra-shared-data@<version>Consumers must have these peer dependencies installed (both spectra-canvas and spectra-core already do):
@nestjs/swagger ^11class-validator ^0.15class-transformer ^0.5reflect-metadata ^0.2
Ensure import 'reflect-metadata'; runs before any decorated class is loaded (typically the first line of main.ts).
Usage
import {
CreateDesignCanvasDto,
DesignCanvasResponseDto,
LineConnectorDto,
NODE_TYPE,
} from "spectra-shared-data";All exports live on the top-level barrel. Subpath imports (spectra-shared-data/design-canvas/...) are not supported.
Local development
npm install
npm run build # emits dist/ with .js + .d.ts
npm test # runs co-located *.spec.tsVersioning
| Change | Bump | | -------------------------------------------------------- | --------- | | Typo / comment | patch | | Added optional field / new DTO | minor | | Renamed / removed field, changed type, optional→required | major |
Consumers pin exact versions. Contract drift is worse than the manual bump chore.
Deployment rule
When a field is added: update spectra-canvas first, then spectra-core. A field must exist in canvas before core starts sending it.
