diff --git a/backend/spec/state/v1/statev1connect/state.connect.go b/backend/spec/state/v1/statev1connect/state.connect.go index 9f93f21b..4c89198d 100644 --- a/backend/spec/state/v1/statev1connect/state.connect.go +++ b/backend/spec/state/v1/statev1connect/state.connect.go @@ -5,9 +5,9 @@ package statev1connect import ( - connect "connectrpc.com/connect" context "context" errors "errors" + connect_go "github.com/bufbuild/connect-go" v1 "github.com/ueckoken/plarail2023/backend/spec/state/v1" http "net/http" strings "strings" @@ -18,7 +18,7 @@ import ( // generated with a version of connect newer than the one compiled into your binary. You can fix the // problem by either regenerating this code with an older version of connect or updating the connect // version compiled into your binary. -const _ = connect.IsAtLeastVersion0_1_0 +const _ = connect_go.IsAtLeastVersion0_1_0 const ( // StateManagerServiceName is the fully-qualified name of the StateManagerService service. @@ -62,17 +62,17 @@ const ( // StateManagerServiceClient is a client for the state.v1.StateManagerService service. type StateManagerServiceClient interface { // Block - GetBlockStates(context.Context, *connect.Request[v1.GetBlockStatesRequest]) (*connect.Response[v1.GetBlockStatesResponse], error) - UpdateBlockState(context.Context, *connect.Request[v1.UpdateBlockStateRequest]) (*connect.Response[v1.UpdateBlockStateResponse], error) + GetBlockStates(context.Context, *connect_go.Request[v1.GetBlockStatesRequest]) (*connect_go.Response[v1.GetBlockStatesResponse], error) + UpdateBlockState(context.Context, *connect_go.Request[v1.UpdateBlockStateRequest]) (*connect_go.Response[v1.UpdateBlockStateResponse], error) // Point - UpdatePointState(context.Context, *connect.Request[v1.UpdatePointStateRequest]) (*connect.Response[v1.UpdatePointStateResponse], error) - GetPointStates(context.Context, *connect.Request[v1.GetPointStatesRequest]) (*connect.Response[v1.GetPointStatesResponse], error) + UpdatePointState(context.Context, *connect_go.Request[v1.UpdatePointStateRequest]) (*connect_go.Response[v1.UpdatePointStateResponse], error) + GetPointStates(context.Context, *connect_go.Request[v1.GetPointStatesRequest]) (*connect_go.Response[v1.GetPointStatesResponse], error) // Stop - UpdateStopState(context.Context, *connect.Request[v1.UpdateStopStateRequest]) (*connect.Response[v1.UpdateStopStateResponse], error) - GetStopStates(context.Context, *connect.Request[v1.GetStopStatesRequest]) (*connect.Response[v1.GetStopStatesResponse], error) + UpdateStopState(context.Context, *connect_go.Request[v1.UpdateStopStateRequest]) (*connect_go.Response[v1.UpdateStopStateResponse], error) + GetStopStates(context.Context, *connect_go.Request[v1.GetStopStatesRequest]) (*connect_go.Response[v1.GetStopStatesResponse], error) // Train - GetTrains(context.Context, *connect.Request[v1.GetTrainsRequest]) (*connect.Response[v1.GetTrainsResponse], error) - UpdateTrainUUID(context.Context, *connect.Request[v1.UpdateTrainUUIDRequest]) (*connect.Response[v1.UpdateTrainUUIDResponse], error) + GetTrains(context.Context, *connect_go.Request[v1.GetTrainsRequest]) (*connect_go.Response[v1.GetTrainsResponse], error) + UpdateTrainUUID(context.Context, *connect_go.Request[v1.UpdateTrainUUIDRequest]) (*connect_go.Response[v1.UpdateTrainUUIDResponse], error) } // NewStateManagerServiceClient constructs a client for the state.v1.StateManagerService service. By @@ -82,45 +82,45 @@ type StateManagerServiceClient interface { // // The URL supplied here should be the base URL for the Connect or gRPC server (for example, // http://api.acme.com or https://acme.com/grpc). -func NewStateManagerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) StateManagerServiceClient { +func NewStateManagerServiceClient(httpClient connect_go.HTTPClient, baseURL string, opts ...connect_go.ClientOption) StateManagerServiceClient { baseURL = strings.TrimRight(baseURL, "/") return &stateManagerServiceClient{ - getBlockStates: connect.NewClient[v1.GetBlockStatesRequest, v1.GetBlockStatesResponse]( + getBlockStates: connect_go.NewClient[v1.GetBlockStatesRequest, v1.GetBlockStatesResponse]( httpClient, baseURL+StateManagerServiceGetBlockStatesProcedure, opts..., ), - updateBlockState: connect.NewClient[v1.UpdateBlockStateRequest, v1.UpdateBlockStateResponse]( + updateBlockState: connect_go.NewClient[v1.UpdateBlockStateRequest, v1.UpdateBlockStateResponse]( httpClient, baseURL+StateManagerServiceUpdateBlockStateProcedure, opts..., ), - updatePointState: connect.NewClient[v1.UpdatePointStateRequest, v1.UpdatePointStateResponse]( + updatePointState: connect_go.NewClient[v1.UpdatePointStateRequest, v1.UpdatePointStateResponse]( httpClient, baseURL+StateManagerServiceUpdatePointStateProcedure, opts..., ), - getPointStates: connect.NewClient[v1.GetPointStatesRequest, v1.GetPointStatesResponse]( + getPointStates: connect_go.NewClient[v1.GetPointStatesRequest, v1.GetPointStatesResponse]( httpClient, baseURL+StateManagerServiceGetPointStatesProcedure, opts..., ), - updateStopState: connect.NewClient[v1.UpdateStopStateRequest, v1.UpdateStopStateResponse]( + updateStopState: connect_go.NewClient[v1.UpdateStopStateRequest, v1.UpdateStopStateResponse]( httpClient, baseURL+StateManagerServiceUpdateStopStateProcedure, opts..., ), - getStopStates: connect.NewClient[v1.GetStopStatesRequest, v1.GetStopStatesResponse]( + getStopStates: connect_go.NewClient[v1.GetStopStatesRequest, v1.GetStopStatesResponse]( httpClient, baseURL+StateManagerServiceGetStopStatesProcedure, opts..., ), - getTrains: connect.NewClient[v1.GetTrainsRequest, v1.GetTrainsResponse]( + getTrains: connect_go.NewClient[v1.GetTrainsRequest, v1.GetTrainsResponse]( httpClient, baseURL+StateManagerServiceGetTrainsProcedure, opts..., ), - updateTrainUUID: connect.NewClient[v1.UpdateTrainUUIDRequest, v1.UpdateTrainUUIDResponse]( + updateTrainUUID: connect_go.NewClient[v1.UpdateTrainUUIDRequest, v1.UpdateTrainUUIDResponse]( httpClient, baseURL+StateManagerServiceUpdateTrainUUIDProcedure, opts..., @@ -130,70 +130,70 @@ func NewStateManagerServiceClient(httpClient connect.HTTPClient, baseURL string, // stateManagerServiceClient implements StateManagerServiceClient. type stateManagerServiceClient struct { - getBlockStates *connect.Client[v1.GetBlockStatesRequest, v1.GetBlockStatesResponse] - updateBlockState *connect.Client[v1.UpdateBlockStateRequest, v1.UpdateBlockStateResponse] - updatePointState *connect.Client[v1.UpdatePointStateRequest, v1.UpdatePointStateResponse] - getPointStates *connect.Client[v1.GetPointStatesRequest, v1.GetPointStatesResponse] - updateStopState *connect.Client[v1.UpdateStopStateRequest, v1.UpdateStopStateResponse] - getStopStates *connect.Client[v1.GetStopStatesRequest, v1.GetStopStatesResponse] - getTrains *connect.Client[v1.GetTrainsRequest, v1.GetTrainsResponse] - updateTrainUUID *connect.Client[v1.UpdateTrainUUIDRequest, v1.UpdateTrainUUIDResponse] + getBlockStates *connect_go.Client[v1.GetBlockStatesRequest, v1.GetBlockStatesResponse] + updateBlockState *connect_go.Client[v1.UpdateBlockStateRequest, v1.UpdateBlockStateResponse] + updatePointState *connect_go.Client[v1.UpdatePointStateRequest, v1.UpdatePointStateResponse] + getPointStates *connect_go.Client[v1.GetPointStatesRequest, v1.GetPointStatesResponse] + updateStopState *connect_go.Client[v1.UpdateStopStateRequest, v1.UpdateStopStateResponse] + getStopStates *connect_go.Client[v1.GetStopStatesRequest, v1.GetStopStatesResponse] + getTrains *connect_go.Client[v1.GetTrainsRequest, v1.GetTrainsResponse] + updateTrainUUID *connect_go.Client[v1.UpdateTrainUUIDRequest, v1.UpdateTrainUUIDResponse] } // GetBlockStates calls state.v1.StateManagerService.GetBlockStates. -func (c *stateManagerServiceClient) GetBlockStates(ctx context.Context, req *connect.Request[v1.GetBlockStatesRequest]) (*connect.Response[v1.GetBlockStatesResponse], error) { +func (c *stateManagerServiceClient) GetBlockStates(ctx context.Context, req *connect_go.Request[v1.GetBlockStatesRequest]) (*connect_go.Response[v1.GetBlockStatesResponse], error) { return c.getBlockStates.CallUnary(ctx, req) } // UpdateBlockState calls state.v1.StateManagerService.UpdateBlockState. -func (c *stateManagerServiceClient) UpdateBlockState(ctx context.Context, req *connect.Request[v1.UpdateBlockStateRequest]) (*connect.Response[v1.UpdateBlockStateResponse], error) { +func (c *stateManagerServiceClient) UpdateBlockState(ctx context.Context, req *connect_go.Request[v1.UpdateBlockStateRequest]) (*connect_go.Response[v1.UpdateBlockStateResponse], error) { return c.updateBlockState.CallUnary(ctx, req) } // UpdatePointState calls state.v1.StateManagerService.UpdatePointState. -func (c *stateManagerServiceClient) UpdatePointState(ctx context.Context, req *connect.Request[v1.UpdatePointStateRequest]) (*connect.Response[v1.UpdatePointStateResponse], error) { +func (c *stateManagerServiceClient) UpdatePointState(ctx context.Context, req *connect_go.Request[v1.UpdatePointStateRequest]) (*connect_go.Response[v1.UpdatePointStateResponse], error) { return c.updatePointState.CallUnary(ctx, req) } // GetPointStates calls state.v1.StateManagerService.GetPointStates. -func (c *stateManagerServiceClient) GetPointStates(ctx context.Context, req *connect.Request[v1.GetPointStatesRequest]) (*connect.Response[v1.GetPointStatesResponse], error) { +func (c *stateManagerServiceClient) GetPointStates(ctx context.Context, req *connect_go.Request[v1.GetPointStatesRequest]) (*connect_go.Response[v1.GetPointStatesResponse], error) { return c.getPointStates.CallUnary(ctx, req) } // UpdateStopState calls state.v1.StateManagerService.UpdateStopState. -func (c *stateManagerServiceClient) UpdateStopState(ctx context.Context, req *connect.Request[v1.UpdateStopStateRequest]) (*connect.Response[v1.UpdateStopStateResponse], error) { +func (c *stateManagerServiceClient) UpdateStopState(ctx context.Context, req *connect_go.Request[v1.UpdateStopStateRequest]) (*connect_go.Response[v1.UpdateStopStateResponse], error) { return c.updateStopState.CallUnary(ctx, req) } // GetStopStates calls state.v1.StateManagerService.GetStopStates. -func (c *stateManagerServiceClient) GetStopStates(ctx context.Context, req *connect.Request[v1.GetStopStatesRequest]) (*connect.Response[v1.GetStopStatesResponse], error) { +func (c *stateManagerServiceClient) GetStopStates(ctx context.Context, req *connect_go.Request[v1.GetStopStatesRequest]) (*connect_go.Response[v1.GetStopStatesResponse], error) { return c.getStopStates.CallUnary(ctx, req) } // GetTrains calls state.v1.StateManagerService.GetTrains. -func (c *stateManagerServiceClient) GetTrains(ctx context.Context, req *connect.Request[v1.GetTrainsRequest]) (*connect.Response[v1.GetTrainsResponse], error) { +func (c *stateManagerServiceClient) GetTrains(ctx context.Context, req *connect_go.Request[v1.GetTrainsRequest]) (*connect_go.Response[v1.GetTrainsResponse], error) { return c.getTrains.CallUnary(ctx, req) } // UpdateTrainUUID calls state.v1.StateManagerService.UpdateTrainUUID. -func (c *stateManagerServiceClient) UpdateTrainUUID(ctx context.Context, req *connect.Request[v1.UpdateTrainUUIDRequest]) (*connect.Response[v1.UpdateTrainUUIDResponse], error) { +func (c *stateManagerServiceClient) UpdateTrainUUID(ctx context.Context, req *connect_go.Request[v1.UpdateTrainUUIDRequest]) (*connect_go.Response[v1.UpdateTrainUUIDResponse], error) { return c.updateTrainUUID.CallUnary(ctx, req) } // StateManagerServiceHandler is an implementation of the state.v1.StateManagerService service. type StateManagerServiceHandler interface { // Block - GetBlockStates(context.Context, *connect.Request[v1.GetBlockStatesRequest]) (*connect.Response[v1.GetBlockStatesResponse], error) - UpdateBlockState(context.Context, *connect.Request[v1.UpdateBlockStateRequest]) (*connect.Response[v1.UpdateBlockStateResponse], error) + GetBlockStates(context.Context, *connect_go.Request[v1.GetBlockStatesRequest]) (*connect_go.Response[v1.GetBlockStatesResponse], error) + UpdateBlockState(context.Context, *connect_go.Request[v1.UpdateBlockStateRequest]) (*connect_go.Response[v1.UpdateBlockStateResponse], error) // Point - UpdatePointState(context.Context, *connect.Request[v1.UpdatePointStateRequest]) (*connect.Response[v1.UpdatePointStateResponse], error) - GetPointStates(context.Context, *connect.Request[v1.GetPointStatesRequest]) (*connect.Response[v1.GetPointStatesResponse], error) + UpdatePointState(context.Context, *connect_go.Request[v1.UpdatePointStateRequest]) (*connect_go.Response[v1.UpdatePointStateResponse], error) + GetPointStates(context.Context, *connect_go.Request[v1.GetPointStatesRequest]) (*connect_go.Response[v1.GetPointStatesResponse], error) // Stop - UpdateStopState(context.Context, *connect.Request[v1.UpdateStopStateRequest]) (*connect.Response[v1.UpdateStopStateResponse], error) - GetStopStates(context.Context, *connect.Request[v1.GetStopStatesRequest]) (*connect.Response[v1.GetStopStatesResponse], error) + UpdateStopState(context.Context, *connect_go.Request[v1.UpdateStopStateRequest]) (*connect_go.Response[v1.UpdateStopStateResponse], error) + GetStopStates(context.Context, *connect_go.Request[v1.GetStopStatesRequest]) (*connect_go.Response[v1.GetStopStatesResponse], error) // Train - GetTrains(context.Context, *connect.Request[v1.GetTrainsRequest]) (*connect.Response[v1.GetTrainsResponse], error) - UpdateTrainUUID(context.Context, *connect.Request[v1.UpdateTrainUUIDRequest]) (*connect.Response[v1.UpdateTrainUUIDResponse], error) + GetTrains(context.Context, *connect_go.Request[v1.GetTrainsRequest]) (*connect_go.Response[v1.GetTrainsResponse], error) + UpdateTrainUUID(context.Context, *connect_go.Request[v1.UpdateTrainUUIDRequest]) (*connect_go.Response[v1.UpdateTrainUUIDResponse], error) } // NewStateManagerServiceHandler builds an HTTP handler from the service implementation. It returns @@ -201,43 +201,43 @@ type StateManagerServiceHandler interface { // // By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf // and JSON codecs. They also support gzip compression. -func NewStateManagerServiceHandler(svc StateManagerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) { - stateManagerServiceGetBlockStatesHandler := connect.NewUnaryHandler( +func NewStateManagerServiceHandler(svc StateManagerServiceHandler, opts ...connect_go.HandlerOption) (string, http.Handler) { + stateManagerServiceGetBlockStatesHandler := connect_go.NewUnaryHandler( StateManagerServiceGetBlockStatesProcedure, svc.GetBlockStates, opts..., ) - stateManagerServiceUpdateBlockStateHandler := connect.NewUnaryHandler( + stateManagerServiceUpdateBlockStateHandler := connect_go.NewUnaryHandler( StateManagerServiceUpdateBlockStateProcedure, svc.UpdateBlockState, opts..., ) - stateManagerServiceUpdatePointStateHandler := connect.NewUnaryHandler( + stateManagerServiceUpdatePointStateHandler := connect_go.NewUnaryHandler( StateManagerServiceUpdatePointStateProcedure, svc.UpdatePointState, opts..., ) - stateManagerServiceGetPointStatesHandler := connect.NewUnaryHandler( + stateManagerServiceGetPointStatesHandler := connect_go.NewUnaryHandler( StateManagerServiceGetPointStatesProcedure, svc.GetPointStates, opts..., ) - stateManagerServiceUpdateStopStateHandler := connect.NewUnaryHandler( + stateManagerServiceUpdateStopStateHandler := connect_go.NewUnaryHandler( StateManagerServiceUpdateStopStateProcedure, svc.UpdateStopState, opts..., ) - stateManagerServiceGetStopStatesHandler := connect.NewUnaryHandler( + stateManagerServiceGetStopStatesHandler := connect_go.NewUnaryHandler( StateManagerServiceGetStopStatesProcedure, svc.GetStopStates, opts..., ) - stateManagerServiceGetTrainsHandler := connect.NewUnaryHandler( + stateManagerServiceGetTrainsHandler := connect_go.NewUnaryHandler( StateManagerServiceGetTrainsProcedure, svc.GetTrains, opts..., ) - stateManagerServiceUpdateTrainUUIDHandler := connect.NewUnaryHandler( + stateManagerServiceUpdateTrainUUIDHandler := connect_go.NewUnaryHandler( StateManagerServiceUpdateTrainUUIDProcedure, svc.UpdateTrainUUID, opts..., @@ -269,34 +269,34 @@ func NewStateManagerServiceHandler(svc StateManagerServiceHandler, opts ...conne // UnimplementedStateManagerServiceHandler returns CodeUnimplemented from all methods. type UnimplementedStateManagerServiceHandler struct{} -func (UnimplementedStateManagerServiceHandler) GetBlockStates(context.Context, *connect.Request[v1.GetBlockStatesRequest]) (*connect.Response[v1.GetBlockStatesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetBlockStates is not implemented")) +func (UnimplementedStateManagerServiceHandler) GetBlockStates(context.Context, *connect_go.Request[v1.GetBlockStatesRequest]) (*connect_go.Response[v1.GetBlockStatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetBlockStates is not implemented")) } -func (UnimplementedStateManagerServiceHandler) UpdateBlockState(context.Context, *connect.Request[v1.UpdateBlockStateRequest]) (*connect.Response[v1.UpdateBlockStateResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateBlockState is not implemented")) +func (UnimplementedStateManagerServiceHandler) UpdateBlockState(context.Context, *connect_go.Request[v1.UpdateBlockStateRequest]) (*connect_go.Response[v1.UpdateBlockStateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateBlockState is not implemented")) } -func (UnimplementedStateManagerServiceHandler) UpdatePointState(context.Context, *connect.Request[v1.UpdatePointStateRequest]) (*connect.Response[v1.UpdatePointStateResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdatePointState is not implemented")) +func (UnimplementedStateManagerServiceHandler) UpdatePointState(context.Context, *connect_go.Request[v1.UpdatePointStateRequest]) (*connect_go.Response[v1.UpdatePointStateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdatePointState is not implemented")) } -func (UnimplementedStateManagerServiceHandler) GetPointStates(context.Context, *connect.Request[v1.GetPointStatesRequest]) (*connect.Response[v1.GetPointStatesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetPointStates is not implemented")) +func (UnimplementedStateManagerServiceHandler) GetPointStates(context.Context, *connect_go.Request[v1.GetPointStatesRequest]) (*connect_go.Response[v1.GetPointStatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetPointStates is not implemented")) } -func (UnimplementedStateManagerServiceHandler) UpdateStopState(context.Context, *connect.Request[v1.UpdateStopStateRequest]) (*connect.Response[v1.UpdateStopStateResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateStopState is not implemented")) +func (UnimplementedStateManagerServiceHandler) UpdateStopState(context.Context, *connect_go.Request[v1.UpdateStopStateRequest]) (*connect_go.Response[v1.UpdateStopStateResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateStopState is not implemented")) } -func (UnimplementedStateManagerServiceHandler) GetStopStates(context.Context, *connect.Request[v1.GetStopStatesRequest]) (*connect.Response[v1.GetStopStatesResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetStopStates is not implemented")) +func (UnimplementedStateManagerServiceHandler) GetStopStates(context.Context, *connect_go.Request[v1.GetStopStatesRequest]) (*connect_go.Response[v1.GetStopStatesResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetStopStates is not implemented")) } -func (UnimplementedStateManagerServiceHandler) GetTrains(context.Context, *connect.Request[v1.GetTrainsRequest]) (*connect.Response[v1.GetTrainsResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetTrains is not implemented")) +func (UnimplementedStateManagerServiceHandler) GetTrains(context.Context, *connect_go.Request[v1.GetTrainsRequest]) (*connect_go.Response[v1.GetTrainsResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.GetTrains is not implemented")) } -func (UnimplementedStateManagerServiceHandler) UpdateTrainUUID(context.Context, *connect.Request[v1.UpdateTrainUUIDRequest]) (*connect.Response[v1.UpdateTrainUUIDResponse], error) { - return nil, connect.NewError(connect.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateTrainUUID is not implemented")) +func (UnimplementedStateManagerServiceHandler) UpdateTrainUUID(context.Context, *connect_go.Request[v1.UpdateTrainUUIDRequest]) (*connect_go.Response[v1.UpdateTrainUUIDResponse], error) { + return nil, connect_go.NewError(connect_go.CodeUnimplemented, errors.New("state.v1.StateManagerService.UpdateTrainUUID is not implemented")) } diff --git a/frontend/dashboard/app/test/page.tsx b/frontend/dashboard/app/test/page.tsx index cc57ea16..d9b40231 100644 --- a/frontend/dashboard/app/test/page.tsx +++ b/frontend/dashboard/app/test/page.tsx @@ -1,7 +1,27 @@ +"use client"; +import {createPromiseClient} from "@connectrpc/connect"; +import {StateManagerService} from "@/proto/state/v1/state_connectweb"; +import {createConnectTransport} from "@bufbuild/connect-web"; + export default function Test() { + + const transport = createConnectTransport( + { + // baseUrl: process.env.NEXT_PUBLIC_API_ENDPOINT!, + baseUrl: "http://localhost:8080", + }); + const sendData = () => { + (async () => { + const client = createPromiseClient(StateManagerService, transport); + const res = await client.getBlockStates({}); + console.log(res); + })(); + } + return (
- +

Test

+
) } \ No newline at end of file diff --git a/frontend/dashboard/proto/state/v1/block_pb.d.ts b/frontend/dashboard/proto/state/v1/block_pb.d.ts new file mode 100644 index 00000000..7e4a3702 --- /dev/null +++ b/frontend/dashboard/proto/state/v1/block_pb.d.ts @@ -0,0 +1,163 @@ +// +//Block Proto +//閉塞の状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/block.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.BlockStateEnum + */ +export declare enum BlockStateEnum { + /** + * @generated from enum value: BLOCK_STATE_UNKNOWN = 0; + */ + BLOCK_STATE_UNKNOWN = 0, + + /** + * 閉塞が開の状態(列車がいない) + * + * @generated from enum value: BLOCK_STATE_OPEN = 1; + */ + BLOCK_STATE_OPEN = 1, + + /** + * 閉塞が閉の状態(列車がいない) + * + * @generated from enum value: BLOCK_STATE_CLOSE = 2; + */ + BLOCK_STATE_CLOSE = 2, +} + +/** + * 閉塞の状態 + * + * @generated from message state.v1.BlockState + */ +export declare class BlockState extends Message { + /** + * 閉塞のID + * + * @generated from field: string block_id = 1; + */ + blockId: string; + + /** + * 閉塞の状態 + * + * @generated from field: state.v1.BlockStateEnum state = 2; + */ + state: BlockStateEnum; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.BlockState"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BlockState; + + static fromJson(jsonValue: JsonValue, options?: Partial): BlockState; + + static fromJsonString(jsonString: string, options?: Partial): BlockState; + + static equals(a: BlockState | PlainMessage | undefined, b: BlockState | PlainMessage | undefined): boolean; +} + +/** + * + * GetBlockStates : 閉塞の状態を取得するAPI + * + * @generated from message state.v1.GetBlockStatesRequest + */ +export declare class GetBlockStatesRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetBlockStatesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetBlockStatesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetBlockStatesRequest; + + static fromJsonString(jsonString: string, options?: Partial): GetBlockStatesRequest; + + static equals(a: GetBlockStatesRequest | PlainMessage | undefined, b: GetBlockStatesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.GetBlockStatesResponse + */ +export declare class GetBlockStatesResponse extends Message { + /** + * @generated from field: repeated state.v1.BlockState states = 1; + */ + states: BlockState[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetBlockStatesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetBlockStatesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetBlockStatesResponse; + + static fromJsonString(jsonString: string, options?: Partial): GetBlockStatesResponse; + + static equals(a: GetBlockStatesResponse | PlainMessage | undefined, b: GetBlockStatesResponse | PlainMessage | undefined): boolean; +} + +/** + * + * UpdateBLockState: 閉塞の状態を更新するAPI + * + * @generated from message state.v1.UpdateBlockStateRequest + */ +export declare class UpdateBlockStateRequest extends Message { + /** + * @generated from field: state.v1.BlockState state = 1; + */ + state?: BlockState; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateBlockStateRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateBlockStateRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateBlockStateRequest; + + static fromJsonString(jsonString: string, options?: Partial): UpdateBlockStateRequest; + + static equals(a: UpdateBlockStateRequest | PlainMessage | undefined, b: UpdateBlockStateRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.UpdateBlockStateResponse + */ +export declare class UpdateBlockStateResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateBlockStateResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateBlockStateResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateBlockStateResponse; + + static fromJsonString(jsonString: string, options?: Partial): UpdateBlockStateResponse; + + static equals(a: UpdateBlockStateResponse | PlainMessage | undefined, b: UpdateBlockStateResponse | PlainMessage | undefined): boolean; +} + diff --git a/frontend/dashboard/proto/state/v1/block_pb.js b/frontend/dashboard/proto/state/v1/block_pb.js new file mode 100644 index 00000000..5c9843ab --- /dev/null +++ b/frontend/dashboard/proto/state/v1/block_pb.js @@ -0,0 +1,78 @@ +// +//Block Proto +//閉塞の状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/block.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.BlockStateEnum + */ +export const BlockStateEnum = proto3.makeEnum( + "state.v1.BlockStateEnum", + [ + {no: 0, name: "BLOCK_STATE_UNKNOWN"}, + {no: 1, name: "BLOCK_STATE_OPEN"}, + {no: 2, name: "BLOCK_STATE_CLOSE"}, + ], +); + +/** + * 閉塞の状態 + * + * @generated from message state.v1.BlockState + */ +export const BlockState = proto3.makeMessageType( + "state.v1.BlockState", + () => [ + { no: 1, name: "block_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "state", kind: "enum", T: proto3.getEnumType(BlockStateEnum) }, + ], +); + +/** + * + * GetBlockStates : 閉塞の状態を取得するAPI + * + * @generated from message state.v1.GetBlockStatesRequest + */ +export const GetBlockStatesRequest = proto3.makeMessageType( + "state.v1.GetBlockStatesRequest", + [], +); + +/** + * @generated from message state.v1.GetBlockStatesResponse + */ +export const GetBlockStatesResponse = proto3.makeMessageType( + "state.v1.GetBlockStatesResponse", + () => [ + { no: 1, name: "states", kind: "message", T: BlockState, repeated: true }, + ], +); + +/** + * + * UpdateBLockState: 閉塞の状態を更新するAPI + * + * @generated from message state.v1.UpdateBlockStateRequest + */ +export const UpdateBlockStateRequest = proto3.makeMessageType( + "state.v1.UpdateBlockStateRequest", + () => [ + { no: 1, name: "state", kind: "message", T: BlockState }, + ], +); + +/** + * @generated from message state.v1.UpdateBlockStateResponse + */ +export const UpdateBlockStateResponse = proto3.makeMessageType( + "state.v1.UpdateBlockStateResponse", + [], +); + diff --git a/frontend/dashboard/proto/state/v1/point_pb.d.ts b/frontend/dashboard/proto/state/v1/point_pb.d.ts new file mode 100644 index 00000000..3549e61c --- /dev/null +++ b/frontend/dashboard/proto/state/v1/point_pb.d.ts @@ -0,0 +1,161 @@ +// +//Point Proto +//ポイントレールの状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/point.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.PointStateEnum + */ +export declare enum PointStateEnum { + /** + * @generated from enum value: POINT_STATE_UNKNOWN = 0; + */ + POINT_STATE_UNKNOWN = 0, + + /** + * ポイントがまっすぐな状態 + * + * @generated from enum value: POINT_STATE_NORMAL = 1; + */ + POINT_STATE_NORMAL = 1, + + /** + * ポイントが移動している状態 + * + * @generated from enum value: POINT_STATE_REVERSE = 2; + */ + POINT_STATE_REVERSE = 2, +} + +/** + * @generated from message state.v1.PointAndState + */ +export declare class PointAndState extends Message { + /** + * ポイントのid + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * ポイントの状態 + * + * @generated from field: state.v1.PointStateEnum state = 2; + */ + state: PointStateEnum; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.PointAndState"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PointAndState; + + static fromJson(jsonValue: JsonValue, options?: Partial): PointAndState; + + static fromJsonString(jsonString: string, options?: Partial): PointAndState; + + static equals(a: PointAndState | PlainMessage | undefined, b: PointAndState | PlainMessage | undefined): boolean; +} + +/** + * + * UpdatePointState : ポイントの状態を更新するAPI + * + * @generated from message state.v1.UpdatePointStateRequest + */ +export declare class UpdatePointStateRequest extends Message { + /** + * @generated from field: state.v1.PointAndState state = 1; + */ + state?: PointAndState; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdatePointStateRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatePointStateRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatePointStateRequest; + + static fromJsonString(jsonString: string, options?: Partial): UpdatePointStateRequest; + + static equals(a: UpdatePointStateRequest | PlainMessage | undefined, b: UpdatePointStateRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.UpdatePointStateResponse + */ +export declare class UpdatePointStateResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdatePointStateResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdatePointStateResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdatePointStateResponse; + + static fromJsonString(jsonString: string, options?: Partial): UpdatePointStateResponse; + + static equals(a: UpdatePointStateResponse | PlainMessage | undefined, b: UpdatePointStateResponse | PlainMessage | undefined): boolean; +} + +/** + * + * GetPointStates : 全てのポイントの状態を取得するAPI + * + * @generated from message state.v1.GetPointStatesRequest + */ +export declare class GetPointStatesRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetPointStatesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetPointStatesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetPointStatesRequest; + + static fromJsonString(jsonString: string, options?: Partial): GetPointStatesRequest; + + static equals(a: GetPointStatesRequest | PlainMessage | undefined, b: GetPointStatesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.GetPointStatesResponse + */ +export declare class GetPointStatesResponse extends Message { + /** + * @generated from field: repeated state.v1.PointAndState states = 1; + */ + states: PointAndState[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetPointStatesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetPointStatesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetPointStatesResponse; + + static fromJsonString(jsonString: string, options?: Partial): GetPointStatesResponse; + + static equals(a: GetPointStatesResponse | PlainMessage | undefined, b: GetPointStatesResponse | PlainMessage | undefined): boolean; +} + diff --git a/frontend/dashboard/proto/state/v1/point_pb.js b/frontend/dashboard/proto/state/v1/point_pb.js new file mode 100644 index 00000000..623ba2ee --- /dev/null +++ b/frontend/dashboard/proto/state/v1/point_pb.js @@ -0,0 +1,76 @@ +// +//Point Proto +//ポイントレールの状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/point.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.PointStateEnum + */ +export const PointStateEnum = proto3.makeEnum( + "state.v1.PointStateEnum", + [ + {no: 0, name: "POINT_STATE_UNKNOWN"}, + {no: 1, name: "POINT_STATE_NORMAL"}, + {no: 2, name: "POINT_STATE_REVERSE"}, + ], +); + +/** + * @generated from message state.v1.PointAndState + */ +export const PointAndState = proto3.makeMessageType( + "state.v1.PointAndState", + () => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "state", kind: "enum", T: proto3.getEnumType(PointStateEnum) }, + ], +); + +/** + * + * UpdatePointState : ポイントの状態を更新するAPI + * + * @generated from message state.v1.UpdatePointStateRequest + */ +export const UpdatePointStateRequest = proto3.makeMessageType( + "state.v1.UpdatePointStateRequest", + () => [ + { no: 1, name: "state", kind: "message", T: PointAndState }, + ], +); + +/** + * @generated from message state.v1.UpdatePointStateResponse + */ +export const UpdatePointStateResponse = proto3.makeMessageType( + "state.v1.UpdatePointStateResponse", + [], +); + +/** + * + * GetPointStates : 全てのポイントの状態を取得するAPI + * + * @generated from message state.v1.GetPointStatesRequest + */ +export const GetPointStatesRequest = proto3.makeMessageType( + "state.v1.GetPointStatesRequest", + [], +); + +/** + * @generated from message state.v1.GetPointStatesResponse + */ +export const GetPointStatesResponse = proto3.makeMessageType( + "state.v1.GetPointStatesResponse", + () => [ + { no: 1, name: "states", kind: "message", T: PointAndState, repeated: true }, + ], +); + diff --git a/frontend/dashboard/proto/state/v1/state_connectweb.d.ts b/frontend/dashboard/proto/state/v1/state_connectweb.d.ts new file mode 100644 index 00000000..2e087925 --- /dev/null +++ b/frontend/dashboard/proto/state/v1/state_connectweb.d.ts @@ -0,0 +1,104 @@ +// @generated by protoc-gen-connect-web v0.11.0 with parameter "target=dts+js" +// @generated from file state/v1/state.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { GetBlockStatesRequest, GetBlockStatesResponse, UpdateBlockStateRequest, UpdateBlockStateResponse } from "./block_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; +import { GetPointStatesRequest, GetPointStatesResponse, UpdatePointStateRequest, UpdatePointStateResponse } from "./point_pb.js"; +import { GetStopStatesRequest, GetStopStatesResponse, UpdateStopStateRequest, UpdateStopStateResponse } from "./stop_pb.js"; +import { GetTrainsRequest, GetTrainsResponse, UpdateTrainUUIDRequest, UpdateTrainUUIDResponse } from "./train_pb.js"; + +/** + * + * StateManagerが提供するサービス + * AutoOperationとフロントエンド間の通信に利用される + * + * @generated from service state.v1.StateManagerService + */ +export declare const StateManagerService: { + readonly typeName: "state.v1.StateManagerService", + readonly methods: { + /** + * Block + * + * @generated from rpc state.v1.StateManagerService.GetBlockStates + */ + readonly getBlockStates: { + readonly name: "GetBlockStates", + readonly I: typeof GetBlockStatesRequest, + readonly O: typeof GetBlockStatesResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.UpdateBlockState + */ + readonly updateBlockState: { + readonly name: "UpdateBlockState", + readonly I: typeof UpdateBlockStateRequest, + readonly O: typeof UpdateBlockStateResponse, + readonly kind: MethodKind.Unary, + }, + /** + * Point + * + * @generated from rpc state.v1.StateManagerService.UpdatePointState + */ + readonly updatePointState: { + readonly name: "UpdatePointState", + readonly I: typeof UpdatePointStateRequest, + readonly O: typeof UpdatePointStateResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.GetPointStates + */ + readonly getPointStates: { + readonly name: "GetPointStates", + readonly I: typeof GetPointStatesRequest, + readonly O: typeof GetPointStatesResponse, + readonly kind: MethodKind.Unary, + }, + /** + * Stop + * + * @generated from rpc state.v1.StateManagerService.UpdateStopState + */ + readonly updateStopState: { + readonly name: "UpdateStopState", + readonly I: typeof UpdateStopStateRequest, + readonly O: typeof UpdateStopStateResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.GetStopStates + */ + readonly getStopStates: { + readonly name: "GetStopStates", + readonly I: typeof GetStopStatesRequest, + readonly O: typeof GetStopStatesResponse, + readonly kind: MethodKind.Unary, + }, + /** + * Train + * + * @generated from rpc state.v1.StateManagerService.GetTrains + */ + readonly getTrains: { + readonly name: "GetTrains", + readonly I: typeof GetTrainsRequest, + readonly O: typeof GetTrainsResponse, + readonly kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.UpdateTrainUUID + */ + readonly updateTrainUUID: { + readonly name: "UpdateTrainUUID", + readonly I: typeof UpdateTrainUUIDRequest, + readonly O: typeof UpdateTrainUUIDResponse, + readonly kind: MethodKind.Unary, + }, + } +}; + diff --git a/frontend/dashboard/proto/state/v1/state_connectweb.js b/frontend/dashboard/proto/state/v1/state_connectweb.js new file mode 100644 index 00000000..637fee8c --- /dev/null +++ b/frontend/dashboard/proto/state/v1/state_connectweb.js @@ -0,0 +1,104 @@ +// @generated by protoc-gen-connect-web v0.11.0 with parameter "target=dts+js" +// @generated from file state/v1/state.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { GetBlockStatesRequest, GetBlockStatesResponse, UpdateBlockStateRequest, UpdateBlockStateResponse } from "./block_pb.js"; +import { MethodKind } from "@bufbuild/protobuf"; +import { GetPointStatesRequest, GetPointStatesResponse, UpdatePointStateRequest, UpdatePointStateResponse } from "./point_pb.js"; +import { GetStopStatesRequest, GetStopStatesResponse, UpdateStopStateRequest, UpdateStopStateResponse } from "./stop_pb.js"; +import { GetTrainsRequest, GetTrainsResponse, UpdateTrainUUIDRequest, UpdateTrainUUIDResponse } from "./train_pb.js"; + +/** + * + * StateManagerが提供するサービス + * AutoOperationとフロントエンド間の通信に利用される + * + * @generated from service state.v1.StateManagerService + */ +export const StateManagerService = { + typeName: "state.v1.StateManagerService", + methods: { + /** + * Block + * + * @generated from rpc state.v1.StateManagerService.GetBlockStates + */ + getBlockStates: { + name: "GetBlockStates", + I: GetBlockStatesRequest, + O: GetBlockStatesResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.UpdateBlockState + */ + updateBlockState: { + name: "UpdateBlockState", + I: UpdateBlockStateRequest, + O: UpdateBlockStateResponse, + kind: MethodKind.Unary, + }, + /** + * Point + * + * @generated from rpc state.v1.StateManagerService.UpdatePointState + */ + updatePointState: { + name: "UpdatePointState", + I: UpdatePointStateRequest, + O: UpdatePointStateResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.GetPointStates + */ + getPointStates: { + name: "GetPointStates", + I: GetPointStatesRequest, + O: GetPointStatesResponse, + kind: MethodKind.Unary, + }, + /** + * Stop + * + * @generated from rpc state.v1.StateManagerService.UpdateStopState + */ + updateStopState: { + name: "UpdateStopState", + I: UpdateStopStateRequest, + O: UpdateStopStateResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.GetStopStates + */ + getStopStates: { + name: "GetStopStates", + I: GetStopStatesRequest, + O: GetStopStatesResponse, + kind: MethodKind.Unary, + }, + /** + * Train + * + * @generated from rpc state.v1.StateManagerService.GetTrains + */ + getTrains: { + name: "GetTrains", + I: GetTrainsRequest, + O: GetTrainsResponse, + kind: MethodKind.Unary, + }, + /** + * @generated from rpc state.v1.StateManagerService.UpdateTrainUUID + */ + updateTrainUUID: { + name: "UpdateTrainUUID", + I: UpdateTrainUUIDRequest, + O: UpdateTrainUUIDResponse, + kind: MethodKind.Unary, + }, + } +}; + diff --git a/frontend/dashboard/proto/state/v1/stop_pb.d.ts b/frontend/dashboard/proto/state/v1/stop_pb.d.ts new file mode 100644 index 00000000..bdb5b921 --- /dev/null +++ b/frontend/dashboard/proto/state/v1/stop_pb.d.ts @@ -0,0 +1,161 @@ +// +//Stop Proto +//ストップレールの状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/stop.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.StopStateEnum + */ +export declare enum StopStateEnum { + /** + * @generated from enum value: STOP_STATE_UNKNOWN = 0; + */ + STOP_STATE_UNKNOWN = 0, + + /** + * バーが下がってる状態 + * + * @generated from enum value: STOP_STATE_GO = 1; + */ + STOP_STATE_GO = 1, + + /** + * バーが上がってる状態 + * + * @generated from enum value: STOP_STATE_STOP = 2; + */ + STOP_STATE_STOP = 2, +} + +/** + * @generated from message state.v1.StopAndState + */ +export declare class StopAndState extends Message { + /** + * ポイントのid + * + * @generated from field: string id = 1; + */ + id: string; + + /** + * ポイントの状態 + * + * @generated from field: state.v1.StopStateEnum state = 2; + */ + state: StopStateEnum; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.StopAndState"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): StopAndState; + + static fromJson(jsonValue: JsonValue, options?: Partial): StopAndState; + + static fromJsonString(jsonString: string, options?: Partial): StopAndState; + + static equals(a: StopAndState | PlainMessage | undefined, b: StopAndState | PlainMessage | undefined): boolean; +} + +/** + * + * UpdateStopState : ストップレールの状態を更新するAPI + * + * @generated from message state.v1.UpdateStopStateRequest + */ +export declare class UpdateStopStateRequest extends Message { + /** + * @generated from field: state.v1.StopAndState state = 1; + */ + state?: StopAndState; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateStopStateRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateStopStateRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateStopStateRequest; + + static fromJsonString(jsonString: string, options?: Partial): UpdateStopStateRequest; + + static equals(a: UpdateStopStateRequest | PlainMessage | undefined, b: UpdateStopStateRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.UpdateStopStateResponse + */ +export declare class UpdateStopStateResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateStopStateResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateStopStateResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateStopStateResponse; + + static fromJsonString(jsonString: string, options?: Partial): UpdateStopStateResponse; + + static equals(a: UpdateStopStateResponse | PlainMessage | undefined, b: UpdateStopStateResponse | PlainMessage | undefined): boolean; +} + +/** + * + * GetStopStates : 全てのストップレールの状態を取得するAPI + * + * @generated from message state.v1.GetStopStatesRequest + */ +export declare class GetStopStatesRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetStopStatesRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetStopStatesRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetStopStatesRequest; + + static fromJsonString(jsonString: string, options?: Partial): GetStopStatesRequest; + + static equals(a: GetStopStatesRequest | PlainMessage | undefined, b: GetStopStatesRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.GetStopStatesResponse + */ +export declare class GetStopStatesResponse extends Message { + /** + * @generated from field: repeated state.v1.StopAndState states = 1; + */ + states: StopAndState[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetStopStatesResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetStopStatesResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetStopStatesResponse; + + static fromJsonString(jsonString: string, options?: Partial): GetStopStatesResponse; + + static equals(a: GetStopStatesResponse | PlainMessage | undefined, b: GetStopStatesResponse | PlainMessage | undefined): boolean; +} + diff --git a/frontend/dashboard/proto/state/v1/stop_pb.js b/frontend/dashboard/proto/state/v1/stop_pb.js new file mode 100644 index 00000000..caf0be2d --- /dev/null +++ b/frontend/dashboard/proto/state/v1/stop_pb.js @@ -0,0 +1,76 @@ +// +//Stop Proto +//ストップレールの状態を扱うプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/stop.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.StopStateEnum + */ +export const StopStateEnum = proto3.makeEnum( + "state.v1.StopStateEnum", + [ + {no: 0, name: "STOP_STATE_UNKNOWN"}, + {no: 1, name: "STOP_STATE_GO"}, + {no: 2, name: "STOP_STATE_STOP"}, + ], +); + +/** + * @generated from message state.v1.StopAndState + */ +export const StopAndState = proto3.makeMessageType( + "state.v1.StopAndState", + () => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "state", kind: "enum", T: proto3.getEnumType(StopStateEnum) }, + ], +); + +/** + * + * UpdateStopState : ストップレールの状態を更新するAPI + * + * @generated from message state.v1.UpdateStopStateRequest + */ +export const UpdateStopStateRequest = proto3.makeMessageType( + "state.v1.UpdateStopStateRequest", + () => [ + { no: 1, name: "state", kind: "message", T: StopAndState }, + ], +); + +/** + * @generated from message state.v1.UpdateStopStateResponse + */ +export const UpdateStopStateResponse = proto3.makeMessageType( + "state.v1.UpdateStopStateResponse", + [], +); + +/** + * + * GetStopStates : 全てのストップレールの状態を取得するAPI + * + * @generated from message state.v1.GetStopStatesRequest + */ +export const GetStopStatesRequest = proto3.makeMessageType( + "state.v1.GetStopStatesRequest", + [], +); + +/** + * @generated from message state.v1.GetStopStatesResponse + */ +export const GetStopStatesResponse = proto3.makeMessageType( + "state.v1.GetStopStatesResponse", + () => [ + { no: 1, name: "states", kind: "message", T: StopAndState, repeated: true }, + ], +); + diff --git a/frontend/dashboard/proto/state/v1/train_pb.d.ts b/frontend/dashboard/proto/state/v1/train_pb.d.ts new file mode 100644 index 00000000..19040853 --- /dev/null +++ b/frontend/dashboard/proto/state/v1/train_pb.d.ts @@ -0,0 +1,166 @@ +// +//Train Proto +//駅に停車している列車の情報を扱うためのプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/train.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.Priority + */ +export declare enum Priority { + /** + * @generated from enum value: PRIORITY_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: PRIORITY_LOW = 1; + */ + LOW = 1, + + /** + * @generated from enum value: PRIORITY_HIGH = 2; + */ + HIGH = 2, +} + +/** + * @generated from message state.v1.Train + */ +export declare class Train extends Message { + /** + * 列車ID(NFCのUUIDと一意に対応している) + * + * @generated from field: string train_id = 1; + */ + trainId: string; + + /** + * 駅のID + * + * @generated from field: string station_id = 2; + */ + stationId: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.Train"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Train; + + static fromJson(jsonValue: JsonValue, options?: Partial): Train; + + static fromJsonString(jsonString: string, options?: Partial): Train; + + static equals(a: Train | PlainMessage | undefined, b: Train | PlainMessage | undefined): boolean; +} + +/** + * + * GetTrains : 列車の状態を取得するAPI + * + * @generated from message state.v1.GetTrainsRequest + */ +export declare class GetTrainsRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetTrainsRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetTrainsRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetTrainsRequest; + + static fromJsonString(jsonString: string, options?: Partial): GetTrainsRequest; + + static equals(a: GetTrainsRequest | PlainMessage | undefined, b: GetTrainsRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.GetTrainsResponse + */ +export declare class GetTrainsResponse extends Message { + /** + * @generated from field: repeated state.v1.Train trains = 1; + */ + trains: Train[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.GetTrainsResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GetTrainsResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): GetTrainsResponse; + + static fromJsonString(jsonString: string, options?: Partial): GetTrainsResponse; + + static equals(a: GetTrainsResponse | PlainMessage | undefined, b: GetTrainsResponse | PlainMessage | undefined): boolean; +} + +/** + * + * UpdateTrainUUID : NFCのUUID紐付けを更新するAPI + * + * @generated from message state.v1.UpdateTrainUUIDRequest + */ +export declare class UpdateTrainUUIDRequest extends Message { + /** + * 列車ID + * + * @generated from field: string train_id = 1; + */ + trainId: string; + + /** + * NFCのUUID + * + * @generated from field: string uuid = 2; + */ + uuid: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateTrainUUIDRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateTrainUUIDRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateTrainUUIDRequest; + + static fromJsonString(jsonString: string, options?: Partial): UpdateTrainUUIDRequest; + + static equals(a: UpdateTrainUUIDRequest | PlainMessage | undefined, b: UpdateTrainUUIDRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message state.v1.UpdateTrainUUIDResponse + */ +export declare class UpdateTrainUUIDResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "state.v1.UpdateTrainUUIDResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): UpdateTrainUUIDResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): UpdateTrainUUIDResponse; + + static fromJsonString(jsonString: string, options?: Partial): UpdateTrainUUIDResponse; + + static equals(a: UpdateTrainUUIDResponse | PlainMessage | undefined, b: UpdateTrainUUIDResponse | PlainMessage | undefined): boolean; +} + diff --git a/frontend/dashboard/proto/state/v1/train_pb.js b/frontend/dashboard/proto/state/v1/train_pb.js new file mode 100644 index 00000000..d284bf40 --- /dev/null +++ b/frontend/dashboard/proto/state/v1/train_pb.js @@ -0,0 +1,77 @@ +// +//Train Proto +//駅に停車している列車の情報を扱うためのプロトコル + +// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" +// @generated from file state/v1/train.proto (package state.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum state.v1.Priority + */ +export const Priority = proto3.makeEnum( + "state.v1.Priority", + [ + {no: 0, name: "PRIORITY_UNSPECIFIED", localName: "UNSPECIFIED"}, + {no: 1, name: "PRIORITY_LOW", localName: "LOW"}, + {no: 2, name: "PRIORITY_HIGH", localName: "HIGH"}, + ], +); + +/** + * @generated from message state.v1.Train + */ +export const Train = proto3.makeMessageType( + "state.v1.Train", + () => [ + { no: 1, name: "train_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "station_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * + * GetTrains : 列車の状態を取得するAPI + * + * @generated from message state.v1.GetTrainsRequest + */ +export const GetTrainsRequest = proto3.makeMessageType( + "state.v1.GetTrainsRequest", + [], +); + +/** + * @generated from message state.v1.GetTrainsResponse + */ +export const GetTrainsResponse = proto3.makeMessageType( + "state.v1.GetTrainsResponse", + () => [ + { no: 1, name: "trains", kind: "message", T: Train, repeated: true }, + ], +); + +/** + * + * UpdateTrainUUID : NFCのUUID紐付けを更新するAPI + * + * @generated from message state.v1.UpdateTrainUUIDRequest + */ +export const UpdateTrainUUIDRequest = proto3.makeMessageType( + "state.v1.UpdateTrainUUIDRequest", + () => [ + { no: 1, name: "train_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "uuid", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ], +); + +/** + * @generated from message state.v1.UpdateTrainUUIDResponse + */ +export const UpdateTrainUUIDResponse = proto3.makeMessageType( + "state.v1.UpdateTrainUUIDResponse", + [], +); + diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index d540e157..64451ac0 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -16,9 +16,9 @@ plugins: path: ../frontend/dashboard/node_modules/.bin/protoc-gen-es out: ../frontend/dashboard/proto opt: - - target=ts + - target=dts+js - plugin: connect-es path: ../frontend/dashboard/node_modules/.bin/protoc-gen-connect-web out: ../frontend/dashboard/proto opt: - - target=ts + - target=dts+js