mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 16:02:35 +00:00
fix(mobile): require a reader for RPC result variants
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { RpcClient } from './rpc-client'
|
||||
import type { RpcMethodName } from './rpc-params-contract'
|
||||
import { defineRpcOperation, runRpcOperation, startRpcOperation } from './rpc-operation'
|
||||
import { rpcResultVariants } from './rpc-operation-result-reader'
|
||||
import {
|
||||
workspaceListAtBarrier,
|
||||
workspaceListOrNull,
|
||||
@@ -24,6 +25,9 @@ import type {
|
||||
|
||||
declare const client: RpcClient
|
||||
|
||||
// @ts-expect-error a variant reader combinator must have at least one reader
|
||||
const _fenceEmptyVariantReaders = rpcResultVariants([])
|
||||
|
||||
// FENCE: probe-cannot-take-a-reader
|
||||
export const fenceProbeWithReader: CapabilityProbeRpcDefinition<'worktree.ps', 'on-settle'> = {
|
||||
name: 'fence.probeWithReader',
|
||||
|
||||
@@ -39,7 +39,10 @@ export function rpcResultVariant<Variant extends string, Schema extends z.ZodTyp
|
||||
|
||||
/** Tries each variant in declared order and takes the first that reads. */
|
||||
export function rpcResultVariants<Variant extends string, Value>(
|
||||
readers: readonly NamedRpcResultReader<Variant, Value>[]
|
||||
readers: readonly [
|
||||
NamedRpcResultReader<Variant, Value>,
|
||||
...NamedRpcResultReader<Variant, Value>[]
|
||||
]
|
||||
): RpcCompatibleReader<unknown, Variant, Value> {
|
||||
return (raw) => {
|
||||
const issues: RpcDecodeIssue[] = []
|
||||
|
||||
Reference in New Issue
Block a user