feat(workspace): R2 facade operations for the editor rules, the publish check and the sheet index data
Free ops: sheet.check, report.new, report.add_observation, report.remove_observation, report.move_observation, vertebra.select. Sheet ops: index_data, zone.click, zone.add_sides, zone.remove_at, vertebra.initial, vertebra.sync, finding.toggle. Input contracts exported to TypeScript; a JavaScript index that names no position removes nothing in the filters and is refused by the move (the TypeScript swap would have written a hole). Shipped module 999 KB raw, 319 KB gzip (budget 600 KB).
This commit is contained in:
1 parent
3639c8778e
commit
6c0533c1da
25 files changed
+470
-11
No files matched your search
@@ -42,7 +42,7 @@ pub fn call(op: &str, input: &str) -> String {
|
||||
.map_err(|error| Failure::new("invalid_json", error)),
|
||||
"sheet_ref" => echo::<SheetRef>(input),
|
||||
"report_zone" => echo::<ReportZone>(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<LoadedSheet, Failure> {
|
||||
}
|
||||
|
||||
/// 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 {
|
||||
|
||||
Reference in new issue
Block a user