// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" // @generated from file github.com/s4wave/spacewave/bldr/resource/resource.proto (package resource, syntax proto3) /* eslint-disable */ import { ResourceAttachRequest, ResourceAttachResponse, ResourceClientRequest, ResourceClientResponse, ResourceRpcPacket, } from './resource.pb.js' import { MethodKind } from '@aptre/protobuf-es-lite' import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream, ProtoRpc, ServerContext, } from 'starpc' /** * ResourceService provides a set of stateful resources via an RPC service. * * @generated from service resource.ResourceService */ export const ResourceServiceDefinition = { typeName: 'resource.ResourceService', methods: { /** * ResourceClient starts an instance of a client for the ResourceService, * yielding a new client ID. The client can use that ID for future RPCs * accessing the Resource tree. When the streaming RPC ends, references to * resources opened by the client will be released. * * @generated from rpc resource.ResourceService.ResourceClient */ ResourceClient: { name: 'ResourceClient', I: ResourceClientRequest, O: ResourceClientResponse, kind: MethodKind.BiDiStreaming, }, /** * ResourceRpc is a rpc request for an open resource handle. * Exposes service(s) depending on the resource type. * The first request selects a resource; one typed acknowledgement precedes data. * * @generated from rpc resource.ResourceService.ResourceRpc */ ResourceRpc: { name: 'ResourceRpc', I: ResourceRpcPacket, O: ResourceRpcPacket, kind: MethodKind.BiDiStreaming, }, /** * ResourceAttach allows a client to provide resources that server-side * RPC handlers can invoke via getAttachedRef(id). Session-only Init/Ack, * then resources registered via Add/AddAck. After Init/Ack, mux_data * carries yamux frames for all attached resources. * * @generated from rpc resource.ResourceService.ResourceAttach */ ResourceAttach: { name: 'ResourceAttach', I: ResourceAttachRequest, O: ResourceAttachResponse, kind: MethodKind.BiDiStreaming, }, }, } as const /** * ResourceService provides a set of stateful resources via an RPC service. * * @generated from service resource.ResourceService */ export interface ResourceService { /** * ResourceClient starts an instance of a client for the ResourceService, * yielding a new client ID. The client can use that ID for future RPCs * accessing the Resource tree. When the streaming RPC ends, references to * resources opened by the client will be released. * * @generated from rpc resource.ResourceService.ResourceClient */ ResourceClient( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream /** * ResourceRpc is a rpc request for an open resource handle. * Exposes service(s) depending on the resource type. * The first request selects a resource; one typed acknowledgement precedes data. * * @generated from rpc resource.ResourceService.ResourceRpc */ ResourceRpc( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream /** * ResourceAttach allows a client to provide resources that server-side * RPC handlers can invoke via getAttachedRef(id). Session-only Init/Ack, * then resources registered via Add/AddAck. After Init/Ack, mux_data * carries yamux frames for all attached resources. * * @generated from rpc resource.ResourceService.ResourceAttach */ ResourceAttach( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream } /** * ResourceService provides a set of stateful resources via an RPC service. * * @generated from service resource.ResourceService */ export interface ResourceServiceHandler { /** * ResourceClient starts an instance of a client for the ResourceService, * yielding a new client ID. The client can use that ID for future RPCs * accessing the Resource tree. When the streaming RPC ends, references to * resources opened by the client will be released. * * @generated from rpc resource.ResourceService.ResourceClient */ ResourceClient( request: MessageStream, abortSignal: AbortSignal, context: ServerContext, ): MessageStream /** * ResourceRpc is a rpc request for an open resource handle. * Exposes service(s) depending on the resource type. * The first request selects a resource; one typed acknowledgement precedes data. * * @generated from rpc resource.ResourceService.ResourceRpc */ ResourceRpc( request: MessageStream, abortSignal: AbortSignal, context: ServerContext, ): MessageStream /** * ResourceAttach allows a client to provide resources that server-side * RPC handlers can invoke via getAttachedRef(id). Session-only Init/Ack, * then resources registered via Add/AddAck. After Init/Ack, mux_data * carries yamux frames for all attached resources. * * @generated from rpc resource.ResourceService.ResourceAttach */ ResourceAttach( request: MessageStream, abortSignal: AbortSignal, context: ServerContext, ): MessageStream } export const ResourceServiceServiceName = ResourceServiceDefinition.typeName export class ResourceServiceClient implements ResourceService { private readonly rpc: ProtoRpc private readonly service: string constructor(rpc: ProtoRpc, opts?: { service?: string }) { this.service = opts?.service || ResourceServiceServiceName this.rpc = rpc this.ResourceClient = this.ResourceClient.bind(this) this.ResourceRpc = this.ResourceRpc.bind(this) this.ResourceAttach = this.ResourceAttach.bind(this) } /** * ResourceClient starts an instance of a client for the ResourceService, * yielding a new client ID. The client can use that ID for future RPCs * accessing the Resource tree. When the streaming RPC ends, references to * resources opened by the client will be released. * * @generated from rpc resource.ResourceService.ResourceClient */ ResourceClient( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream { const result = this.rpc.bidirectionalStreamingRequest( this.service, ResourceServiceDefinition.methods.ResourceClient.name, buildEncodeMessageTransform(ResourceClientRequest)(request), abortSignal || undefined, ) return buildDecodeMessageTransform(ResourceClientResponse)(result) } /** * ResourceRpc is a rpc request for an open resource handle. * Exposes service(s) depending on the resource type. * The first request selects a resource; one typed acknowledgement precedes data. * * @generated from rpc resource.ResourceService.ResourceRpc */ ResourceRpc( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream { const result = this.rpc.bidirectionalStreamingRequest( this.service, ResourceServiceDefinition.methods.ResourceRpc.name, buildEncodeMessageTransform(ResourceRpcPacket)(request), abortSignal || undefined, ) return buildDecodeMessageTransform(ResourceRpcPacket)(result) } /** * ResourceAttach allows a client to provide resources that server-side * RPC handlers can invoke via getAttachedRef(id). Session-only Init/Ack, * then resources registered via Add/AddAck. After Init/Ack, mux_data * carries yamux frames for all attached resources. * * @generated from rpc resource.ResourceService.ResourceAttach */ ResourceAttach( request: MessageStream, abortSignal?: AbortSignal, ): MessageStream { const result = this.rpc.bidirectionalStreamingRequest( this.service, ResourceServiceDefinition.methods.ResourceAttach.name, buildEncodeMessageTransform(ResourceAttachRequest)(request), abortSignal || undefined, ) return buildDecodeMessageTransform(ResourceAttachResponse)(result) } }