diff --git a/packages/rust-types/src/lib.rs b/packages/rust-types/src/lib.rs index 02ea8fe..6f300ad 100644 --- a/packages/rust-types/src/lib.rs +++ b/packages/rust-types/src/lib.rs @@ -1,80 +1,5 @@ -// Hand-written structs mirroring the JSON Schemas in `schemas/continuum/v1/` -// and the TypeBox schemas in `ts-types/src/schemas/` - this used to be -// prost-generated from `.proto` sources, but nothing here needed protobuf's -// actual value (cross-language binary codegen): both consumers (this crate -// and ts-types) only ever exchange JSON, so a hand-synced struct is less -// machinery than a `protoc`/`prost-build` pipeline for the same three -// flat DTOs. Keep field names and the `PrintJobStatus` string values in -// sync with `ts-types/src/schemas/` by hand when either side changes. - -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MaterialProfile { - pub id: String, - pub name: String, - pub filament_type: String, - pub nozzle_temp_c: f64, - pub bed_temp_c: f64, - pub density_g_cm3: f64, - pub color_hex: String, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PrintParameters { - pub layer_height_mm: f64, - pub infill_percent: i32, - pub infill_pattern: String, - pub print_speed_mm_s: f64, - pub supports_enabled: bool, - pub wall_count: i32, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Template { - pub id: String, - pub name: String, - pub description: String, - pub owner_id: String, - pub model_file_key: String, - pub material: MaterialProfile, - pub print_parameters: PrintParameters, - pub created_at_unix: i64, - pub updated_at_unix: i64, - pub tags: Vec, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -pub enum PrintJobStatus { - #[serde(rename = "PRINT_JOB_STATUS_UNSPECIFIED")] - Unspecified, - #[serde(rename = "PRINT_JOB_STATUS_QUEUED")] - Queued, - #[serde(rename = "PRINT_JOB_STATUS_PRINTING")] - Printing, - #[serde(rename = "PRINT_JOB_STATUS_PAUSED")] - Paused, - #[serde(rename = "PRINT_JOB_STATUS_COMPLETED")] - Completed, - #[serde(rename = "PRINT_JOB_STATUS_FAILED")] - Failed, - #[serde(rename = "PRINT_JOB_STATUS_CANCELLED")] - Cancelled, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PrintJob { - pub id: String, - pub farm_id: String, - pub printer_id: String, - pub template_id: String, - pub status: PrintJobStatus, - pub progress_percent: f64, - pub started_at_unix: i64, - pub completed_at_unix: i64, - pub gcode_file_key: String, -} +//! The old MaterialProfile/PrintParameters/PrintJob/Template structs were +//! removed (2026-09) when schemas/continuum/v1/ was restructured into +//! material/printer/vendor - see that directory and its README. Add a +//! hand-written serde struct here per file under schemas/continuum/v1/ +//! once something actually consumes it, same convention as before. diff --git a/packages/rust-types/tests/print_job_status.rs b/packages/rust-types/tests/print_job_status.rs deleted file mode 100644 index 8d8046e..0000000 --- a/packages/rust-types/tests/print_job_status.rs +++ /dev/null @@ -1,31 +0,0 @@ -use continuum_types::{PrintJob, PrintJobStatus}; - -fn sample(status: PrintJobStatus) -> PrintJob { - PrintJob { - id: "job-1".into(), - farm_id: "farm-1".into(), - printer_id: "printer-1".into(), - template_id: "template-1".into(), - status, - progress_percent: 50.0, - started_at_unix: 0, - completed_at_unix: 0, - gcode_file_key: "key".into(), - } -} - -// Regression test: PrintJob.status must serialize as the full name string -// (matching ts-types' TypeBox schema), not a bare enum discriminant. -#[test] -fn status_serializes_as_full_proto_enum_name() { - let json = serde_json::to_value(sample(PrintJobStatus::Printing)).unwrap(); - assert_eq!(json["status"], "PRINT_JOB_STATUS_PRINTING"); -} - -#[test] -fn status_round_trips_through_json() { - let original = sample(PrintJobStatus::Completed); - let json = serde_json::to_string(&original).unwrap(); - let restored: PrintJob = serde_json::from_str(&json).unwrap(); - assert_eq!(restored.status, PrintJobStatus::Completed); -} diff --git a/packages/ts-types/src/schemas/index.d.ts b/packages/ts-types/src/schemas/index.d.ts index 2e3ff77..cb0ff5c 100644 --- a/packages/ts-types/src/schemas/index.d.ts +++ b/packages/ts-types/src/schemas/index.d.ts @@ -1,4 +1 @@ -export * from "./material"; -export * from "./print-params"; -export * from "./template"; -export * from "./print-job"; +export {}; diff --git a/packages/ts-types/src/schemas/index.js b/packages/ts-types/src/schemas/index.js index 2e3ff77..cb0ff5c 100644 --- a/packages/ts-types/src/schemas/index.js +++ b/packages/ts-types/src/schemas/index.js @@ -1,4 +1 @@ -export * from "./material"; -export * from "./print-params"; -export * from "./template"; -export * from "./print-job"; +export {}; diff --git a/packages/ts-types/src/schemas/index.ts b/packages/ts-types/src/schemas/index.ts index 2e3ff77..fb509fa 100644 --- a/packages/ts-types/src/schemas/index.ts +++ b/packages/ts-types/src/schemas/index.ts @@ -1,4 +1,7 @@ -export * from "./material"; -export * from "./print-params"; -export * from "./template"; -export * from "./print-job"; +// The old Material/PrintParameters/PrintJob/Template mirrors were removed +// (2026-09) when schemas/continuum/v1/ was restructured into +// material/printer/vendor - see that directory and its README. Add a +// hand-written TypeBox schema here per file under schemas/continuum/v1/ +// once something actually consumes it (continuum-backend's validators, +// most likely), same convention as before. +export {}; diff --git a/packages/ts-types/src/schemas/material.d.ts b/packages/ts-types/src/schemas/material.d.ts deleted file mode 100644 index a13da1a..0000000 --- a/packages/ts-types/src/schemas/material.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { type Static } from "@sinclair/typebox"; -export declare const MaterialProfileSchema: import("@sinclair/typebox").TObject<{ - id: import("@sinclair/typebox").TString; - name: import("@sinclair/typebox").TString; - filamentType: import("@sinclair/typebox").TString; - nozzleTempC: import("@sinclair/typebox").TNumber; - bedTempC: import("@sinclair/typebox").TNumber; - densityGCm3: import("@sinclair/typebox").TNumber; - colorHex: import("@sinclair/typebox").TString; -}>; -export type MaterialProfile = Static; diff --git a/packages/ts-types/src/schemas/material.js b/packages/ts-types/src/schemas/material.js deleted file mode 100644 index 7eea3bc..0000000 --- a/packages/ts-types/src/schemas/material.js +++ /dev/null @@ -1,10 +0,0 @@ -import { Type } from "@sinclair/typebox"; -export const MaterialProfileSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - name: Type.String({ minLength: 1 }), - filamentType: Type.String({ minLength: 1 }), - nozzleTempC: Type.Number(), - bedTempC: Type.Number(), - densityGCm3: Type.Number(), - colorHex: Type.String({ pattern: "^#[0-9a-fA-F]{6}$" }), -}); diff --git a/packages/ts-types/src/schemas/material.ts b/packages/ts-types/src/schemas/material.ts deleted file mode 100644 index cde61d7..0000000 --- a/packages/ts-types/src/schemas/material.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Type, type Static } from "@sinclair/typebox"; - -export const MaterialProfileSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - name: Type.String({ minLength: 1 }), - filamentType: Type.String({ minLength: 1 }), - nozzleTempC: Type.Number(), - bedTempC: Type.Number(), - densityGCm3: Type.Number(), - colorHex: Type.String({ pattern: "^#[0-9a-fA-F]{6}$" }), -}); - -export type MaterialProfile = Static; diff --git a/packages/ts-types/src/schemas/print-job.d.ts b/packages/ts-types/src/schemas/print-job.d.ts deleted file mode 100644 index eb3265c..0000000 --- a/packages/ts-types/src/schemas/print-job.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { type Static } from "@sinclair/typebox"; -export declare const PrintJobStatusSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_UNSPECIFIED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_QUEUED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_PRINTING">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_PAUSED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_COMPLETED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_FAILED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_CANCELLED">]>; -export type PrintJobStatus = Static; -export declare const PrintJobSchema: import("@sinclair/typebox").TObject<{ - id: import("@sinclair/typebox").TString; - farmId: import("@sinclair/typebox").TString; - printerId: import("@sinclair/typebox").TString; - templateId: import("@sinclair/typebox").TString; - status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_UNSPECIFIED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_QUEUED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_PRINTING">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_PAUSED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_COMPLETED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_FAILED">, import("@sinclair/typebox").TLiteral<"PRINT_JOB_STATUS_CANCELLED">]>; - progressPercent: import("@sinclair/typebox").TNumber; - startedAtUnix: import("@sinclair/typebox").TInteger; - completedAtUnix: import("@sinclair/typebox").TInteger; - gcodeFileKey: import("@sinclair/typebox").TString; -}>; -export type PrintJob = Static; diff --git a/packages/ts-types/src/schemas/print-job.js b/packages/ts-types/src/schemas/print-job.js deleted file mode 100644 index 5e38ce5..0000000 --- a/packages/ts-types/src/schemas/print-job.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Type } from "@sinclair/typebox"; -export const PrintJobStatusSchema = Type.Union([ - Type.Literal("PRINT_JOB_STATUS_UNSPECIFIED"), - Type.Literal("PRINT_JOB_STATUS_QUEUED"), - Type.Literal("PRINT_JOB_STATUS_PRINTING"), - Type.Literal("PRINT_JOB_STATUS_PAUSED"), - Type.Literal("PRINT_JOB_STATUS_COMPLETED"), - Type.Literal("PRINT_JOB_STATUS_FAILED"), - Type.Literal("PRINT_JOB_STATUS_CANCELLED"), -]); -export const PrintJobSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - farmId: Type.String({ format: "uuid" }), - printerId: Type.String({ format: "uuid" }), - templateId: Type.String({ format: "uuid" }), - status: PrintJobStatusSchema, - progressPercent: Type.Number({ minimum: 0, maximum: 100 }), - startedAtUnix: Type.Integer(), - completedAtUnix: Type.Integer(), - gcodeFileKey: Type.String({ minLength: 1 }), -}); diff --git a/packages/ts-types/src/schemas/print-job.ts b/packages/ts-types/src/schemas/print-job.ts deleted file mode 100644 index 8106ff8..0000000 --- a/packages/ts-types/src/schemas/print-job.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Type, type Static } from "@sinclair/typebox"; - -export const PrintJobStatusSchema = Type.Union([ - Type.Literal("PRINT_JOB_STATUS_UNSPECIFIED"), - Type.Literal("PRINT_JOB_STATUS_QUEUED"), - Type.Literal("PRINT_JOB_STATUS_PRINTING"), - Type.Literal("PRINT_JOB_STATUS_PAUSED"), - Type.Literal("PRINT_JOB_STATUS_COMPLETED"), - Type.Literal("PRINT_JOB_STATUS_FAILED"), - Type.Literal("PRINT_JOB_STATUS_CANCELLED"), -]); - -export type PrintJobStatus = Static; - -export const PrintJobSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - farmId: Type.String({ format: "uuid" }), - printerId: Type.String({ format: "uuid" }), - templateId: Type.String({ format: "uuid" }), - status: PrintJobStatusSchema, - progressPercent: Type.Number({ minimum: 0, maximum: 100 }), - startedAtUnix: Type.Integer(), - completedAtUnix: Type.Integer(), - gcodeFileKey: Type.String({ minLength: 1 }), -}); - -export type PrintJob = Static; diff --git a/packages/ts-types/src/schemas/print-params.d.ts b/packages/ts-types/src/schemas/print-params.d.ts deleted file mode 100644 index bbb4d50..0000000 --- a/packages/ts-types/src/schemas/print-params.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { type Static } from "@sinclair/typebox"; -export declare const PrintParametersSchema: import("@sinclair/typebox").TObject<{ - layerHeightMm: import("@sinclair/typebox").TNumber; - infillPercent: import("@sinclair/typebox").TInteger; - infillPattern: import("@sinclair/typebox").TString; - printSpeedMmS: import("@sinclair/typebox").TNumber; - supportsEnabled: import("@sinclair/typebox").TBoolean; - wallCount: import("@sinclair/typebox").TInteger; -}>; -export type PrintParameters = Static; diff --git a/packages/ts-types/src/schemas/print-params.js b/packages/ts-types/src/schemas/print-params.js deleted file mode 100644 index 55a43ec..0000000 --- a/packages/ts-types/src/schemas/print-params.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Type } from "@sinclair/typebox"; -export const PrintParametersSchema = Type.Object({ - layerHeightMm: Type.Number({ minimum: 0.04, maximum: 1.0 }), - infillPercent: Type.Integer({ minimum: 0, maximum: 100 }), - infillPattern: Type.String({ minLength: 1 }), - printSpeedMmS: Type.Number({ minimum: 0 }), - supportsEnabled: Type.Boolean(), - wallCount: Type.Integer({ minimum: 0 }), -}); diff --git a/packages/ts-types/src/schemas/print-params.ts b/packages/ts-types/src/schemas/print-params.ts deleted file mode 100644 index a93c8d6..0000000 --- a/packages/ts-types/src/schemas/print-params.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Type, type Static } from "@sinclair/typebox"; - -export const PrintParametersSchema = Type.Object({ - layerHeightMm: Type.Number({ minimum: 0.04, maximum: 1.0 }), - infillPercent: Type.Integer({ minimum: 0, maximum: 100 }), - infillPattern: Type.String({ minLength: 1 }), - printSpeedMmS: Type.Number({ minimum: 0 }), - supportsEnabled: Type.Boolean(), - wallCount: Type.Integer({ minimum: 0 }), -}); - -export type PrintParameters = Static; diff --git a/packages/ts-types/src/schemas/template.d.ts b/packages/ts-types/src/schemas/template.d.ts deleted file mode 100644 index 19a87ae..0000000 --- a/packages/ts-types/src/schemas/template.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { type Static } from "@sinclair/typebox"; -export declare const TemplateSchema: import("@sinclair/typebox").TObject<{ - id: import("@sinclair/typebox").TString; - name: import("@sinclair/typebox").TString; - description: import("@sinclair/typebox").TString; - ownerId: import("@sinclair/typebox").TString; - modelFileKey: import("@sinclair/typebox").TString; - material: import("@sinclair/typebox").TObject<{ - id: import("@sinclair/typebox").TString; - name: import("@sinclair/typebox").TString; - filamentType: import("@sinclair/typebox").TString; - nozzleTempC: import("@sinclair/typebox").TNumber; - bedTempC: import("@sinclair/typebox").TNumber; - densityGCm3: import("@sinclair/typebox").TNumber; - colorHex: import("@sinclair/typebox").TString; - }>; - printParameters: import("@sinclair/typebox").TObject<{ - layerHeightMm: import("@sinclair/typebox").TNumber; - infillPercent: import("@sinclair/typebox").TInteger; - infillPattern: import("@sinclair/typebox").TString; - printSpeedMmS: import("@sinclair/typebox").TNumber; - supportsEnabled: import("@sinclair/typebox").TBoolean; - wallCount: import("@sinclair/typebox").TInteger; - }>; - createdAtUnix: import("@sinclair/typebox").TInteger; - updatedAtUnix: import("@sinclair/typebox").TInteger; - tags: import("@sinclair/typebox").TArray; -}>; -export type Template = Static; diff --git a/packages/ts-types/src/schemas/template.js b/packages/ts-types/src/schemas/template.js deleted file mode 100644 index b0ab2a2..0000000 --- a/packages/ts-types/src/schemas/template.js +++ /dev/null @@ -1,15 +0,0 @@ -import { Type } from "@sinclair/typebox"; -import { MaterialProfileSchema } from "./material"; -import { PrintParametersSchema } from "./print-params"; -export const TemplateSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - name: Type.String({ minLength: 1 }), - description: Type.String(), - ownerId: Type.String({ format: "uuid" }), - modelFileKey: Type.String({ minLength: 1 }), - material: MaterialProfileSchema, - printParameters: PrintParametersSchema, - createdAtUnix: Type.Integer(), - updatedAtUnix: Type.Integer(), - tags: Type.Array(Type.String()), -}); diff --git a/packages/ts-types/src/schemas/template.ts b/packages/ts-types/src/schemas/template.ts deleted file mode 100644 index b315cb9..0000000 --- a/packages/ts-types/src/schemas/template.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Type, type Static } from "@sinclair/typebox"; -import { MaterialProfileSchema } from "./material"; -import { PrintParametersSchema } from "./print-params"; - -export const TemplateSchema = Type.Object({ - id: Type.String({ format: "uuid" }), - name: Type.String({ minLength: 1 }), - description: Type.String(), - ownerId: Type.String({ format: "uuid" }), - modelFileKey: Type.String({ minLength: 1 }), - material: MaterialProfileSchema, - printParameters: PrintParametersSchema, - createdAtUnix: Type.Integer(), - updatedAtUnix: Type.Integer(), - tags: Type.Array(Type.String()), -}); - -export type Template = Static;