diff --git a/crates/core/src/facade.rs b/crates/core/src/facade.rs index e9a1d0fa..ecc93ede 100644 --- a/crates/core/src/facade.rs +++ b/crates/core/src/facade.rs @@ -42,7 +42,7 @@ pub fn call(op: &str, input: &str) -> String { .map_err(|error| Failure::new("invalid_json", error)), "sheet_ref" => echo::(input), "report_zone" => echo::(input), - _ => Err(unknown(op)), + _ => crate::ops::free(op, input).unwrap_or_else(|| Err(unknown(op))), }; render(outcome) } @@ -57,12 +57,8 @@ pub fn load_sheet(bundle: &str) -> Result { } /// Runs the operation `op` that needs the session's sheet. -pub fn call_with_sheet(sheet: &LoadedSheet, op: &str, _input: &str) -> String { - let outcome = match op { - "sheet.ref" => to_value(&sheet.reference), - _ => Err(unknown(op)), - }; - render(outcome) +pub fn call_with_sheet(sheet: &LoadedSheet, op: &str, input: &str) -> String { + render(crate::ops::on_sheet(sheet, op, input).unwrap_or_else(|| Err(unknown(op)))) } fn unknown(op: &str) -> Failure { diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index f369ae49..0fdb4d80 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -8,6 +8,7 @@ pub mod domain; pub mod facade; pub mod json; +pub mod ops; /// Version of the core, reported by the wasm facade and the worker. pub const CORE_VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/crates/core/src/ops.rs b/crates/core/src/ops.rs new file mode 100644 index 00000000..9f58a41a --- /dev/null +++ b/crates/core/src/ops.rs @@ -0,0 +1,276 @@ +//! The operations the facade exposes (R2 plan rev 2 ยง5): one input contract and one handler +//! per user action or load, each returning a closed failure instead of panicking. Free +//! operations take everything they need; sheet operations take the session's sheet. + +use serde::Deserialize; +use serde_json::Value; +#[cfg(feature = "ts")] +use ts_rs::TS; + +use crate::domain::editor::{ + self, EditorError, LeafClick, MoveDirection, NewReportDraft, NewReportStamp, VertebraAction, +}; +use crate::domain::report::{LateralSide, Observation, Report, SheetRef, Vertebra}; +use crate::domain::sheet::{LoadedSheet, SheetIndexData, check_sheet_document}; +use crate::facade::{Failure, parse_input, to_value}; + +type Outcome = Result; + +/// An index as JavaScript sent it: a number. Only a non-negative integer names a position. +#[derive(Debug, Clone, Copy, Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export, type = "number"))] +pub struct JsIndex(f64); + +impl JsIndex { + /// The position, or `None` for a negative or fractional number. + fn position(self) -> Option { + let value = self.0; + let integral = value >= 0.0 && value.fract() == 0.0 && value < 4_294_967_296.0; + #[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)] + integral.then_some(value as usize) + } + + /// For the filters (`filter((_, i) => i !== index)`): a number that names no position + /// removes nothing, as an index past the end does. + fn or_none(self) -> usize { + self.position().unwrap_or(usize::MAX) + } +} + +fn editor_failure(error: EditorError) -> Failure { + Failure::new(error.kind(), "") +} + +// --------------------------------------------------------------------------- +// Free operations + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct NewReportInput { + pub draft: NewReportDraft, + pub sheet: SheetRef, + pub id: String, + pub created_at: String, + pub observation_id: String, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct ReportIdInput { + pub report: Report, + pub id: String, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct ReportIndexInput { + pub report: Report, + pub index: JsIndex, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct MoveObservationInput { + pub report: Report, + pub index: JsIndex, + pub direction: MoveDirection, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct VertebraSelectInput { + pub selection: Vec, + pub action: VertebraAction, +} + +/// Runs a free operation; `None` when `op` is not one of them. +pub fn free(op: &str, input: &str) -> Option { + Some(match op { + "sheet.check" => sheet_check(input), + "report.new" => report_new(input), + "report.add_observation" => report_add(input), + "report.remove_observation" => report_remove(input), + "report.move_observation" => report_move(input), + "vertebra.select" => vertebra_select(input), + _ => return None, + }) +} + +fn sheet_check(input: &str) -> Outcome { + let document: Value = parse_input(input)?; + let check = + check_sheet_document(document).map_err(|error| Failure::new("invalid_shape", error))?; + to_value(&check) +} + +fn report_new(input: &str) -> Outcome { + let input: NewReportInput = parse_input(input)?; + let stamp = NewReportStamp { + id: &input.id, + created_at: &input.created_at, + observation_id: &input.observation_id, + }; + to_value(&editor::new_report(input.draft, input.sheet, &stamp)) +} + +fn report_add(input: &str) -> Outcome { + let input: ReportIdInput = parse_input(input)?; + to_value(&editor::add_observation(&input.report, &input.id)) +} + +fn report_remove(input: &str) -> Outcome { + let input: ReportIndexInput = parse_input(input)?; + to_value(&editor::remove_observation( + &input.report, + input.index.or_none(), + )) +} + +fn report_move(input: &str) -> Outcome { + let input: MoveObservationInput = parse_input(input)?; + let index = input + .index + .position() + .ok_or_else(|| editor_failure(EditorError::InvalidIndex))?; + editor::move_observation(&input.report, index, input.direction) + .map_err(editor_failure) + .and_then(|report| to_value(&report)) +} + +fn vertebra_select(input: &str) -> Outcome { + let input: VertebraSelectInput = parse_input(input)?; + editor::select_vertebrae(&input.selection, &input.action) + .map_err(editor_failure) + .and_then(|selection| to_value(&selection)) +} + +// --------------------------------------------------------------------------- +// Sheet operations + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct ZoneClickInput { + pub observation: Option, + pub annotation_id: String, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct AddSidesInput { + pub observation: Observation, + pub annotation_id: String, + pub sides: Vec, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct ObservationIndexInput { + pub observation: Observation, + pub index: JsIndex, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct VertebraSyncInput { + pub observation: Observation, + pub selection: Vec, + pub view_id: String, +} + +#[derive(Deserialize)] +#[cfg_attr(feature = "ts", derive(TS), ts(export))] +#[serde(rename_all = "camelCase")] +pub struct FindingToggleInput { + pub observation: Observation, + pub finding_zone_id: String, + pub path: Vec, + pub leaf_position: JsIndex, + #[serde(default, deserialize_with = "crate::domain::js::present")] + #[cfg_attr(feature = "ts", ts(optional))] + pub side: Option, +} + +/// Runs an operation on the session's sheet; `None` when `op` is not one of them. +pub fn on_sheet(sheet: &LoadedSheet, op: &str, input: &str) -> Option { + Some(match op { + "index_data" => to_value(&SheetIndexData::of(sheet)), + "zone.click" => zone_click(sheet, input), + "zone.add_sides" => zone_add_sides(sheet, input), + "zone.remove_at" => zone_remove_at(input), + "vertebra.initial" => vertebra_initial(sheet, input), + "vertebra.sync" => vertebra_sync(sheet, input), + "finding.toggle" => finding_toggle(sheet, input), + _ => return None, + }) +} + +fn zone_click(sheet: &LoadedSheet, input: &str) -> Outcome { + let input: ZoneClickInput = parse_input(input)?; + let click = editor::zone_click( + &sheet.indexed(), + input.observation.as_ref(), + &input.annotation_id, + ); + to_value(&click) +} + +fn zone_add_sides(sheet: &LoadedSheet, input: &str) -> Outcome { + let input: AddSidesInput = parse_input(input)?; + editor::add_sides( + &sheet.indexed(), + &input.observation, + &input.annotation_id, + &input.sides, + ) + .map_err(editor_failure) + .and_then(|observation| to_value(&observation)) +} + +fn zone_remove_at(input: &str) -> Outcome { + let input: ObservationIndexInput = parse_input(input)?; + to_value(&editor::remove_zone_at( + &input.observation, + input.index.or_none(), + )) +} + +fn vertebra_initial(sheet: &LoadedSheet, input: &str) -> Outcome { + let input: ObservationIndexInput = parse_input(input)?; + to_value(&editor::vertebra_initial( + &sheet.indexed(), + &input.observation, + input.index.or_none(), + )) +} + +fn vertebra_sync(sheet: &LoadedSheet, input: &str) -> Outcome { + let input: VertebraSyncInput = parse_input(input)?; + to_value(&editor::sync_vertebrae( + &sheet.indexed(), + &input.observation, + &input.selection, + &input.view_id, + )) +} + +fn finding_toggle(sheet: &LoadedSheet, input: &str) -> Outcome { + let input: FindingToggleInput = parse_input(input)?; + let click = LeafClick { + finding_zone_id: &input.finding_zone_id, + path: &input.path, + leaf_position: input.leaf_position.or_none(), + side: input.side, + }; + editor::toggle_finding(&sheet.indexed(), &input.observation, &click) + .map_err(editor_failure) + .and_then(|observation| to_value(&observation)) +} diff --git a/packages/core-wasm/tests/runtime.test.ts b/packages/core-wasm/tests/runtime.test.ts index e16fd099..5c22923e 100644 --- a/packages/core-wasm/tests/runtime.test.ts +++ b/packages/core-wasm/tests/runtime.test.ts @@ -87,18 +87,18 @@ describe('core runtime', () => { const runtime = new CoreRuntime(countingSource()) await runtime.ready() const sheet = runtime.sheet(BUNDLE) - expect(sheet.call('sheet.ref', '')).toMatchObject({ + expect(sheet.call('index_data', '')).toMatchObject({ ok: true, - value: { sheetId: 'sheet', versionId: null }, + value: { ref: { sheetId: 'sheet', versionId: null } }, }) trap(runtime) - expect(sheet.call('sheet.ref', '')).toMatchObject({ + expect(sheet.call('index_data', '')).toMatchObject({ kind: 'core_unavailable', }) await runtime.ready() // A call through the stack-trapped instance would fail in its allocator and poison // again: one generation more and a ready runtime prove the handle was rebuilt. - expect(sheet.call('sheet.ref', '')).toMatchObject({ ok: true }) + expect(sheet.call('index_data', '')).toMatchObject({ ok: true }) expect(runtime.generation).toBe(2) expect(runtime.status).toBe('ready') }) diff --git a/packages/core-wasm/types/AddSidesInput.ts b/packages/core-wasm/types/AddSidesInput.ts new file mode 100644 index 00000000..e9ae59c6 --- /dev/null +++ b/packages/core-wasm/types/AddSidesInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { LateralSide } from "./LateralSide"; +import type { Observation } from "./Observation"; + +export type AddSidesInput = { observation: Observation, annotationId: string, sides: Array, }; diff --git a/packages/core-wasm/types/FindingToggleInput.ts b/packages/core-wasm/types/FindingToggleInput.ts new file mode 100644 index 00000000..84c1fbcb --- /dev/null +++ b/packages/core-wasm/types/FindingToggleInput.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JsIndex } from "./JsIndex"; +import type { LateralSide } from "./LateralSide"; +import type { Observation } from "./Observation"; + +export type FindingToggleInput = { observation: Observation, findingZoneId: string, path: Array, leafPosition: JsIndex, side?: LateralSide, }; diff --git a/packages/core-wasm/types/JsIndex.ts b/packages/core-wasm/types/JsIndex.ts new file mode 100644 index 00000000..992a1a76 --- /dev/null +++ b/packages/core-wasm/types/JsIndex.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * An index as JavaScript sent it: a number. Only a non-negative integer names a position. + */ +export type JsIndex = number; diff --git a/packages/core-wasm/types/MoveDirection.ts b/packages/core-wasm/types/MoveDirection.ts new file mode 100644 index 00000000..e039dcee --- /dev/null +++ b/packages/core-wasm/types/MoveDirection.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type MoveDirection = "up" | "down"; diff --git a/packages/core-wasm/types/MoveObservationInput.ts b/packages/core-wasm/types/MoveObservationInput.ts new file mode 100644 index 00000000..a3b4e1f2 --- /dev/null +++ b/packages/core-wasm/types/MoveObservationInput.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JsIndex } from "./JsIndex"; +import type { MoveDirection } from "./MoveDirection"; +import type { Report } from "./Report"; + +export type MoveObservationInput = { report: Report, index: JsIndex, direction: MoveDirection, }; diff --git a/packages/core-wasm/types/NewReportDraft.ts b/packages/core-wasm/types/NewReportDraft.ts new file mode 100644 index 00000000..efad0909 --- /dev/null +++ b/packages/core-wasm/types/NewReportDraft.ts @@ -0,0 +1,12 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Animal } from "./Animal"; +import type { NextAppointment } from "./NextAppointment"; +import type { Observation } from "./Observation"; +import type { Owner } from "./Owner"; +import type { Practitioner } from "./Practitioner"; + +/** + * What a new report needs before version, id, dates and the sheet are stamped + * (`Omit`). + */ +export type NewReportDraft = { date: string, practitioner: Practitioner, animal: Animal, owner: Owner, observations: Array, conclusion: string, recommendations: string, nextAppointment?: NextAppointment, }; diff --git a/packages/core-wasm/types/NewReportInput.ts b/packages/core-wasm/types/NewReportInput.ts new file mode 100644 index 00000000..4b1bed70 --- /dev/null +++ b/packages/core-wasm/types/NewReportInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { NewReportDraft } from "./NewReportDraft"; +import type { SheetRef } from "./SheetRef"; + +export type NewReportInput = { draft: NewReportDraft, sheet: SheetRef, id: string, createdAt: string, observationId: string, }; diff --git a/packages/core-wasm/types/ObservationIndexInput.ts b/packages/core-wasm/types/ObservationIndexInput.ts new file mode 100644 index 00000000..0ad71bd6 --- /dev/null +++ b/packages/core-wasm/types/ObservationIndexInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JsIndex } from "./JsIndex"; +import type { Observation } from "./Observation"; + +export type ObservationIndexInput = { observation: Observation, index: JsIndex, }; diff --git a/packages/core-wasm/types/ReportIdInput.ts b/packages/core-wasm/types/ReportIdInput.ts new file mode 100644 index 00000000..8b4186a2 --- /dev/null +++ b/packages/core-wasm/types/ReportIdInput.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Report } from "./Report"; + +export type ReportIdInput = { report: Report, id: string, }; diff --git a/packages/core-wasm/types/ReportIndexInput.ts b/packages/core-wasm/types/ReportIndexInput.ts new file mode 100644 index 00000000..499844ae --- /dev/null +++ b/packages/core-wasm/types/ReportIndexInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { JsIndex } from "./JsIndex"; +import type { Report } from "./Report"; + +export type ReportIndexInput = { report: Report, index: JsIndex, }; diff --git a/packages/core-wasm/types/SheetCheck.ts b/packages/core-wasm/types/SheetCheck.ts new file mode 100644 index 00000000..33b075e1 --- /dev/null +++ b/packages/core-wasm/types/SheetCheck.ts @@ -0,0 +1,7 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SheetIssue } from "./SheetIssue"; + +/** + * The issues of a shape-valid document and whether they allow publication. + */ +export type SheetCheck = { issues: Array, publishable: boolean, }; diff --git a/packages/core-wasm/types/SheetIndexData.ts b/packages/core-wasm/types/SheetIndexData.ts new file mode 100644 index 00000000..96922974 --- /dev/null +++ b/packages/core-wasm/types/SheetIndexData.ts @@ -0,0 +1,39 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AnatomicalSheetDocument } from "./AnatomicalSheetDocument"; +import type { LocalizedText } from "./LocalizedText"; +import type { SheetRef } from "./SheetRef"; +import type { SheetStatus } from "./SheetStatus"; + +export type SheetIndexData = { status: SheetStatus, ref: SheetRef, speciesId: string, schemaVersion: number, +/** + * The first `main` view of the document. + */ +mainViewId: string, +/** + * The document as parsed (defaults filled in). + */ +document: AnatomicalSheetDocument, +/** + * Position in `document.views` by id; the last duplicate wins. + */ +viewById: { [key in string]: number }, +/** + * Position in `document.annotations` by id; the last duplicate wins. + */ +annotationById: { [key in string]: number }, +/** + * Position in `document.finding_zones` by id; the last duplicate wins. + */ +findingZoneById: { [key in string]: number }, +/** + * Display name of every annotation id (a trigger: its own, else its view's). + */ +names: { [key in string]: LocalizedText }, +/** + * Ids that open the vertebra picker, in document order, each once. + */ +spineIds: Array, +/** + * Every finding path the sheet holds, as the JSON text of `[zoneId, ...path]`. + */ +nodeKeys: Array, }; diff --git a/packages/core-wasm/types/SheetIssue.ts b/packages/core-wasm/types/SheetIssue.ts new file mode 100644 index 00000000..33ff1043 --- /dev/null +++ b/packages/core-wasm/types/SheetIssue.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { SheetIssueSeverity } from "./SheetIssueSeverity"; + +export type SheetIssue = { code: string, severity: SheetIssueSeverity, path: string, message: string, }; diff --git a/packages/core-wasm/types/SheetIssueSeverity.ts b/packages/core-wasm/types/SheetIssueSeverity.ts new file mode 100644 index 00000000..5e913d9d --- /dev/null +++ b/packages/core-wasm/types/SheetIssueSeverity.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type SheetIssueSeverity = "error" | "warning"; diff --git a/packages/core-wasm/types/VertebraAction.ts b/packages/core-wasm/types/VertebraAction.ts new file mode 100644 index 00000000..4d3c9922 --- /dev/null +++ b/packages/core-wasm/types/VertebraAction.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * One tap of the picker. + */ +export type VertebraAction = { "kind": "toggle", region: string, index: number, } | { "kind": "all", region: string, count: number, } | { "kind": "none", region: string, }; diff --git a/packages/core-wasm/types/VertebraSelectInput.ts b/packages/core-wasm/types/VertebraSelectInput.ts new file mode 100644 index 00000000..3822e154 --- /dev/null +++ b/packages/core-wasm/types/VertebraSelectInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Vertebra } from "./Vertebra"; +import type { VertebraAction } from "./VertebraAction"; + +export type VertebraSelectInput = { selection: Array, action: VertebraAction, }; diff --git a/packages/core-wasm/types/VertebraSyncInput.ts b/packages/core-wasm/types/VertebraSyncInput.ts new file mode 100644 index 00000000..594398d7 --- /dev/null +++ b/packages/core-wasm/types/VertebraSyncInput.ts @@ -0,0 +1,5 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Observation } from "./Observation"; +import type { Vertebra } from "./Vertebra"; + +export type VertebraSyncInput = { observation: Observation, selection: Array, viewId: string, }; diff --git a/packages/core-wasm/types/ZoneClick.ts b/packages/core-wasm/types/ZoneClick.ts new file mode 100644 index 00000000..049ab784 --- /dev/null +++ b/packages/core-wasm/types/ZoneClick.ts @@ -0,0 +1,30 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { LateralSide } from "./LateralSide"; +import type { Observation } from "./Observation"; +import type { Vertebra } from "./Vertebra"; +import type { ZoneClickKind } from "./ZoneClickKind"; + +/** + * What a click on an annotation did, with what the editor needs to follow it up. + */ +export type ZoneClick = { kind: ZoneClickKind, +/** + * `open_view`: the detail view to open. + */ +viewId?: string, +/** + * The active observation after the click, when the click changed it. + */ +observation?: Observation, +/** + * `open_vertebra_picker`: the zone the picker edits. + */ +zoneIndex?: number, +/** + * `open_laterality_picker`: the sides already recorded. + */ +sidesPresent?: Array, +/** + * `open_vertebra_picker`: the picker's initial selection. + */ +vertebrae?: Array, }; diff --git a/packages/core-wasm/types/ZoneClickInput.ts b/packages/core-wasm/types/ZoneClickInput.ts new file mode 100644 index 00000000..27382027 --- /dev/null +++ b/packages/core-wasm/types/ZoneClickInput.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { Observation } from "./Observation"; + +export type ZoneClickInput = { observation: Observation | null, annotationId: string, }; diff --git a/packages/core-wasm/types/ZoneClickKind.ts b/packages/core-wasm/types/ZoneClickKind.ts new file mode 100644 index 00000000..0997ea94 --- /dev/null +++ b/packages/core-wasm/types/ZoneClickKind.ts @@ -0,0 +1,6 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +/** + * The kind of a click decision (`ZoneClickDecision.kind`). + */ +export type ZoneClickKind = "ignore" | "open_view" | "activate_fallback" | "open_vertebra_picker" | "open_laterality_picker" | "remove_both_sides" | "toggle"; diff --git a/packages/core-wasm/types/index.ts b/packages/core-wasm/types/index.ts index 8853658e..e9e77100 100644 --- a/packages/core-wasm/types/index.ts +++ b/packages/core-wasm/types/index.ts @@ -1,6 +1,7 @@ // Types of the core contracts, generated by ts-rs from crates/core (`pnpm rust:check` // regenerates them; the drift gate fails when the committed files differ from the Rust structs). // This index lists every generated file: tests/types-index.test.ts keeps it complete. +export type { AddSidesInput } from './AddSidesInput' export type { AnatomicalSheetDocument } from './AnatomicalSheetDocument' export type { Animal } from './Animal' export type { AnnotationCategory } from './AnnotationCategory' @@ -15,21 +16,28 @@ export type { DetailView } from './DetailView' export type { FindingCategoryKind } from './FindingCategoryKind' export type { FindingCategory } from './FindingCategory' export type { FindingNode } from './FindingNode' +export type { FindingToggleInput } from './FindingToggleInput' export type { Finding } from './Finding' export type { FindingZone } from './FindingZone' export type { Geometry } from './Geometry' export type { ImageAsset } from './ImageAsset' +export type { JsIndex } from './JsIndex' export type { Laterality } from './Laterality' export type { LateralSide } from './LateralSide' export type { Locale } from './Locale' export type { LocalizedOptionalText } from './LocalizedOptionalText' export type { LocalizedText } from './LocalizedText' export type { MainView } from './MainView' +export type { MoveDirection } from './MoveDirection' +export type { MoveObservationInput } from './MoveObservationInput' +export type { NewReportDraft } from './NewReportDraft' +export type { NewReportInput } from './NewReportInput' export type { NextAppointmentDate } from './NextAppointmentDate' export type { NextAppointmentPeriod } from './NextAppointmentPeriod' export type { NextAppointment } from './NextAppointment' export type { ObservableAnnotation } from './ObservableAnnotation' export type { ObservableKind } from './ObservableKind' +export type { ObservationIndexInput } from './ObservationIndexInput' export type { Observation } from './Observation' export type { Owner } from './Owner' export type { PathGeometry } from './PathGeometry' @@ -42,10 +50,16 @@ export type { Practitioner } from './Practitioner' export type { Reference } from './Reference' export type { ReferenceType } from './ReferenceType' export type { ReportArchiveEnvelope } from './ReportArchiveEnvelope' +export type { ReportIdInput } from './ReportIdInput' +export type { ReportIndexInput } from './ReportIndexInput' export type { Report } from './Report' export type { ReportZone } from './ReportZone' export type { ReviewStatus } from './ReviewStatus' export type { Severity } from './Severity' +export type { SheetCheck } from './SheetCheck' +export type { SheetIndexData } from './SheetIndexData' +export type { SheetIssueSeverity } from './SheetIssueSeverity' +export type { SheetIssue } from './SheetIssue' export type { SheetRef } from './SheetRef' export type { SheetSnapshotAsset } from './SheetSnapshotAsset' export type { SheetSnapshotRef } from './SheetSnapshotRef' @@ -53,7 +67,13 @@ export type { SheetSnapshot } from './SheetSnapshot' export type { SheetStatus } from './SheetStatus' export type { SheetView } from './SheetView' export type { SvgAsset } from './SvgAsset' +export type { VertebraAction } from './VertebraAction' export type { VertebralConfig } from './VertebralConfig' export type { VertebralRegion } from './VertebralRegion' +export type { VertebraSelectInput } from './VertebraSelectInput' +export type { VertebraSyncInput } from './VertebraSyncInput' export type { Vertebra } from './Vertebra' export type { ViewBox } from './ViewBox' +export type { ZoneClickInput } from './ZoneClickInput' +export type { ZoneClickKind } from './ZoneClickKind' +export type { ZoneClick } from './ZoneClick'