From ca07a588d580c45414484b4d61d08b362374227a Mon Sep 17 00:00:00 2001 From: Paul Sachs Date: Thu, 31 Oct 2024 13:46:38 -0400 Subject: [PATCH] Converted test-utils to publish ts files Removed unused protos and made sure generate is triggered on tests Signed-off-by: Paul Sachs --- .../connect-query-core/proto/bigint.proto | 30 ---- packages/connect-query-core/proto/eliza.proto | 38 ----- packages/connect-query-core/proto/list.proto | 30 ---- .../connect-query-core/proto/proto2.proto | 21 --- .../connect-query-core/proto/proto3.proto | 49 ------ packages/test-utils/buf.gen.yaml | 2 +- packages/test-utils/gen/bigint_pb.d.ts | 81 +++++++++ packages/test-utils/gen/bigint_pb.js | 47 ++++++ packages/test-utils/gen/eliza_pb.d.ts | 85 ++++++++++ packages/test-utils/gen/eliza_pb.js | 53 ++++++ packages/test-utils/gen/list_pb.d.ts | 82 +++++++++ packages/test-utils/gen/list_pb.js | 46 ++++++ packages/test-utils/gen/proto2_pb.d.ts | 47 ++++++ packages/test-utils/gen/proto2_pb.js | 33 ++++ packages/test-utils/gen/proto3_pb.d.ts | 156 ++++++++++++++++++ packages/test-utils/gen/proto3_pb.js | 45 +++++ packages/test-utils/package.json | 14 +- .../test-utils/{ => src}/gen/bigint_pb.ts | 0 packages/test-utils/{ => src}/gen/eliza_pb.ts | 0 packages/test-utils/{ => src}/gen/list_pb.ts | 0 .../test-utils/{ => src}/gen/proto2_pb.ts | 0 .../test-utils/{ => src}/gen/proto3_pb.ts | 0 packages/test-utils/{ => src}/index.tsx | 0 packages/test-utils/tsconfig.build.json | 11 ++ packages/test-utils/tsconfig.json | 12 +- turbo.json | 2 +- 26 files changed, 707 insertions(+), 177 deletions(-) delete mode 100644 packages/connect-query-core/proto/bigint.proto delete mode 100644 packages/connect-query-core/proto/eliza.proto delete mode 100644 packages/connect-query-core/proto/list.proto delete mode 100644 packages/connect-query-core/proto/proto2.proto delete mode 100644 packages/connect-query-core/proto/proto3.proto create mode 100644 packages/test-utils/gen/bigint_pb.d.ts create mode 100644 packages/test-utils/gen/bigint_pb.js create mode 100644 packages/test-utils/gen/eliza_pb.d.ts create mode 100644 packages/test-utils/gen/eliza_pb.js create mode 100644 packages/test-utils/gen/list_pb.d.ts create mode 100644 packages/test-utils/gen/list_pb.js create mode 100644 packages/test-utils/gen/proto2_pb.d.ts create mode 100644 packages/test-utils/gen/proto2_pb.js create mode 100644 packages/test-utils/gen/proto3_pb.d.ts create mode 100644 packages/test-utils/gen/proto3_pb.js rename packages/test-utils/{ => src}/gen/bigint_pb.ts (100%) rename packages/test-utils/{ => src}/gen/eliza_pb.ts (100%) rename packages/test-utils/{ => src}/gen/list_pb.ts (100%) rename packages/test-utils/{ => src}/gen/proto2_pb.ts (100%) rename packages/test-utils/{ => src}/gen/proto3_pb.ts (100%) rename packages/test-utils/{ => src}/index.tsx (100%) create mode 100644 packages/test-utils/tsconfig.build.json diff --git a/packages/connect-query-core/proto/bigint.proto b/packages/connect-query-core/proto/bigint.proto deleted file mode 100644 index a2a8fba1..00000000 --- a/packages/connect-query-core/proto/bigint.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -import "google/protobuf/empty.proto"; - -service BigIntService { - rpc Count(CountRequest) returns (CountResponse); - rpc GetCount(google.protobuf.Empty) returns (CountResponse); -} - -message CountRequest { - int64 add = 1; -} - -message CountResponse { - int64 count = 1; -} diff --git a/packages/connect-query-core/proto/eliza.proto b/packages/connect-query-core/proto/eliza.proto deleted file mode 100644 index 53059cb0..00000000 --- a/packages/connect-query-core/proto/eliza.proto +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package connectrpc.eliza.v1; - -// ElizaService provides a way to talk to Eliza, a port of the DOCTOR script -// for Joseph Weizenbaum's original ELIZA program. Created in the mid-1960s at -// the MIT Artificial Intelligence Laboratory, ELIZA demonstrates the -// superficiality of human-computer communication. DOCTOR simulates a -// psychotherapist, and is commonly found as an Easter egg in emacs -// distributions. -service ElizaService { - // Say is a unary RPC. Eliza responds to the prompt with a single sentence. - rpc Say(SayRequest) returns (SayResponse) {} -} - -// SayRequest is a single-sentence request. -message SayRequest { - string sentence = 1; -} - -// SayResponse is a single-sentence response. -message SayResponse { - string sentence = 1; -} diff --git a/packages/connect-query-core/proto/list.proto b/packages/connect-query-core/proto/list.proto deleted file mode 100644 index db4e3a8a..00000000 --- a/packages/connect-query-core/proto/list.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -service ListService { - rpc List(ListRequest) returns (ListResponse); -} - -message ListRequest { - int64 page = 1; - bool preview = 2; -} - -message ListResponse { - int64 page = 1; - repeated string items = 2; -} - diff --git a/packages/connect-query-core/proto/proto2.proto b/packages/connect-query-core/proto/proto2.proto deleted file mode 100644 index bfbe1768..00000000 --- a/packages/connect-query-core/proto/proto2.proto +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto2"; -package test; - -message Proto2Message { - optional string string_field = 1; - optional int32 int32_field = 3; -} diff --git a/packages/connect-query-core/proto/proto3.proto b/packages/connect-query-core/proto/proto3.proto deleted file mode 100644 index d7a7759b..00000000 --- a/packages/connect-query-core/proto/proto3.proto +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021-2023 The Connect Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package test; - -// Note: We do not exhaust all field types -message Proto3Message { - string string_field = 1; - bytes bytes_field = 2; - int32 int32_field = 3; - int64 int64_field = 4; - double double_field = 5; - bool bool_field = 6; - Proto3Enum enum_field = 7; - Proto3Message message_field = 8; - - optional string optional_string_field = 9; - - repeated string repeated_string_field = 17; - repeated Proto3Message repeated_message_field = 18; - repeated Proto3Enum repeated_enum_field = 19; - - oneof either { - string oneof_string_field = 31; - int32 oneof_int32_field = 33; - } - - map map_string_int64_field = 39; - map map_string_message_field = 40; - map map_string_enum_field = 41; -} - -enum Proto3Enum { - PROTO3_ENUM_UNSPECIFIED = 0; - PROTO3_ENUM_YES = 1; - PROTO3_ENUM_NO = 2; -} diff --git a/packages/test-utils/buf.gen.yaml b/packages/test-utils/buf.gen.yaml index 0dcd8817..ee896147 100644 --- a/packages/test-utils/buf.gen.yaml +++ b/packages/test-utils/buf.gen.yaml @@ -9,4 +9,4 @@ plugins: - local: protoc-gen-es out: gen opt: - - target=ts + - target=dts+js diff --git a/packages/test-utils/gen/bigint_pb.d.ts b/packages/test-utils/gen/bigint_pb.d.ts new file mode 100644 index 00000000..21cfb87c --- /dev/null +++ b/packages/test-utils/gen/bigint_pb.d.ts @@ -0,0 +1,81 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file bigint.proto (syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; +import type { EmptySchema } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file bigint.proto. + */ +export declare const file_bigint: GenFile; + +/** + * @generated from message CountRequest + */ +export declare type CountRequest = Message<"CountRequest"> & { + /** + * @generated from field: int64 add = 1; + */ + add: bigint; +}; + +/** + * Describes the message CountRequest. + * Use `create(CountRequestSchema)` to create a new message. + */ +export declare const CountRequestSchema: GenMessage; + +/** + * @generated from message CountResponse + */ +export declare type CountResponse = Message<"CountResponse"> & { + /** + * @generated from field: int64 count = 1; + */ + count: bigint; +}; + +/** + * Describes the message CountResponse. + * Use `create(CountResponseSchema)` to create a new message. + */ +export declare const CountResponseSchema: GenMessage; + +/** + * @generated from service BigIntService + */ +export declare const BigIntService: GenService<{ + /** + * @generated from rpc BigIntService.Count + */ + count: { + methodKind: "unary"; + input: typeof CountRequestSchema; + output: typeof CountResponseSchema; + }, + /** + * @generated from rpc BigIntService.GetCount + */ + getCount: { + methodKind: "unary"; + input: typeof EmptySchema; + output: typeof CountResponseSchema; + }, +}>; + diff --git a/packages/test-utils/gen/bigint_pb.js b/packages/test-utils/gen/bigint_pb.js new file mode 100644 index 00000000..d7447924 --- /dev/null +++ b/packages/test-utils/gen/bigint_pb.js @@ -0,0 +1,47 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file bigint.proto (syntax proto3) +/* eslint-disable */ + +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; +import { file_google_protobuf_empty } from "@bufbuild/protobuf/wkt"; + +/** + * Describes the file bigint.proto. + */ +export const file_bigint = /*@__PURE__*/ + fileDesc("CgxiaWdpbnQucHJvdG8iGwoMQ291bnRSZXF1ZXN0EgsKA2FkZBgBIAEoAyIeCg1Db3VudFJlc3BvbnNlEg0KBWNvdW50GAEgASgDMmsKDUJpZ0ludFNlcnZpY2USJgoFQ291bnQSDS5Db3VudFJlcXVlc3QaDi5Db3VudFJlc3BvbnNlEjIKCEdldENvdW50EhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Gg4uQ291bnRSZXNwb25zZWIGcHJvdG8z", [file_google_protobuf_empty]); + +/** + * Describes the message CountRequest. + * Use `create(CountRequestSchema)` to create a new message. + */ +export const CountRequestSchema = /*@__PURE__*/ + messageDesc(file_bigint, 0); + +/** + * Describes the message CountResponse. + * Use `create(CountResponseSchema)` to create a new message. + */ +export const CountResponseSchema = /*@__PURE__*/ + messageDesc(file_bigint, 1); + +/** + * @generated from service BigIntService + */ +export const BigIntService = /*@__PURE__*/ + serviceDesc(file_bigint, 0); + diff --git a/packages/test-utils/gen/eliza_pb.d.ts b/packages/test-utils/gen/eliza_pb.d.ts new file mode 100644 index 00000000..21147d34 --- /dev/null +++ b/packages/test-utils/gen/eliza_pb.d.ts @@ -0,0 +1,85 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file eliza.proto. + */ +export declare const file_eliza: GenFile; + +/** + * SayRequest is a single-sentence request. + * + * @generated from message connectrpc.eliza.v1.SayRequest + */ +export declare type SayRequest = Message<"connectrpc.eliza.v1.SayRequest"> & { + /** + * @generated from field: string sentence = 1; + */ + sentence: string; +}; + +/** + * Describes the message connectrpc.eliza.v1.SayRequest. + * Use `create(SayRequestSchema)` to create a new message. + */ +export declare const SayRequestSchema: GenMessage; + +/** + * SayResponse is a single-sentence response. + * + * @generated from message connectrpc.eliza.v1.SayResponse + */ +export declare type SayResponse = Message<"connectrpc.eliza.v1.SayResponse"> & { + /** + * @generated from field: string sentence = 1; + */ + sentence: string; +}; + +/** + * Describes the message connectrpc.eliza.v1.SayResponse. + * Use `create(SayResponseSchema)` to create a new message. + */ +export declare const SayResponseSchema: GenMessage; + +/** + * ElizaService provides a way to talk to Eliza, a port of the DOCTOR script + * for Joseph Weizenbaum's original ELIZA program. Created in the mid-1960s at + * the MIT Artificial Intelligence Laboratory, ELIZA demonstrates the + * superficiality of human-computer communication. DOCTOR simulates a + * psychotherapist, and is commonly found as an Easter egg in emacs + * distributions. + * + * @generated from service connectrpc.eliza.v1.ElizaService + */ +export declare const ElizaService: GenService<{ + /** + * Say is a unary RPC. Eliza responds to the prompt with a single sentence. + * + * @generated from rpc connectrpc.eliza.v1.ElizaService.Say + */ + say: { + methodKind: "unary"; + input: typeof SayRequestSchema; + output: typeof SayResponseSchema; + }, +}>; + diff --git a/packages/test-utils/gen/eliza_pb.js b/packages/test-utils/gen/eliza_pb.js new file mode 100644 index 00000000..74d31866 --- /dev/null +++ b/packages/test-utils/gen/eliza_pb.js @@ -0,0 +1,53 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file eliza.proto (package connectrpc.eliza.v1, syntax proto3) +/* eslint-disable */ + +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; + +/** + * Describes the file eliza.proto. + */ +export const file_eliza = /*@__PURE__*/ + fileDesc("CgtlbGl6YS5wcm90bxITY29ubmVjdHJwYy5lbGl6YS52MSIeCgpTYXlSZXF1ZXN0EhAKCHNlbnRlbmNlGAEgASgJIh8KC1NheVJlc3BvbnNlEhAKCHNlbnRlbmNlGAEgASgJMloKDEVsaXphU2VydmljZRJKCgNTYXkSHy5jb25uZWN0cnBjLmVsaXphLnYxLlNheVJlcXVlc3QaIC5jb25uZWN0cnBjLmVsaXphLnYxLlNheVJlc3BvbnNlIgBiBnByb3RvMw"); + +/** + * Describes the message connectrpc.eliza.v1.SayRequest. + * Use `create(SayRequestSchema)` to create a new message. + */ +export const SayRequestSchema = /*@__PURE__*/ + messageDesc(file_eliza, 0); + +/** + * Describes the message connectrpc.eliza.v1.SayResponse. + * Use `create(SayResponseSchema)` to create a new message. + */ +export const SayResponseSchema = /*@__PURE__*/ + messageDesc(file_eliza, 1); + +/** + * ElizaService provides a way to talk to Eliza, a port of the DOCTOR script + * for Joseph Weizenbaum's original ELIZA program. Created in the mid-1960s at + * the MIT Artificial Intelligence Laboratory, ELIZA demonstrates the + * superficiality of human-computer communication. DOCTOR simulates a + * psychotherapist, and is commonly found as an Easter egg in emacs + * distributions. + * + * @generated from service connectrpc.eliza.v1.ElizaService + */ +export const ElizaService = /*@__PURE__*/ + serviceDesc(file_eliza, 0); + diff --git a/packages/test-utils/gen/list_pb.d.ts b/packages/test-utils/gen/list_pb.d.ts new file mode 100644 index 00000000..aa8f589c --- /dev/null +++ b/packages/test-utils/gen/list_pb.d.ts @@ -0,0 +1,82 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file list.proto (syntax proto3) +/* eslint-disable */ + +import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file list.proto. + */ +export declare const file_list: GenFile; + +/** + * @generated from message ListRequest + */ +export declare type ListRequest = Message<"ListRequest"> & { + /** + * @generated from field: int64 page = 1; + */ + page: bigint; + + /** + * @generated from field: bool preview = 2; + */ + preview: boolean; +}; + +/** + * Describes the message ListRequest. + * Use `create(ListRequestSchema)` to create a new message. + */ +export declare const ListRequestSchema: GenMessage; + +/** + * @generated from message ListResponse + */ +export declare type ListResponse = Message<"ListResponse"> & { + /** + * @generated from field: int64 page = 1; + */ + page: bigint; + + /** + * @generated from field: repeated string items = 2; + */ + items: string[]; +}; + +/** + * Describes the message ListResponse. + * Use `create(ListResponseSchema)` to create a new message. + */ +export declare const ListResponseSchema: GenMessage; + +/** + * @generated from service ListService + */ +export declare const ListService: GenService<{ + /** + * @generated from rpc ListService.List + */ + list: { + methodKind: "unary"; + input: typeof ListRequestSchema; + output: typeof ListResponseSchema; + }, +}>; + diff --git a/packages/test-utils/gen/list_pb.js b/packages/test-utils/gen/list_pb.js new file mode 100644 index 00000000..75c233bb --- /dev/null +++ b/packages/test-utils/gen/list_pb.js @@ -0,0 +1,46 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file list.proto (syntax proto3) +/* eslint-disable */ + +import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1"; + +/** + * Describes the file list.proto. + */ +export const file_list = /*@__PURE__*/ + fileDesc("CgpsaXN0LnByb3RvIiwKC0xpc3RSZXF1ZXN0EgwKBHBhZ2UYASABKAMSDwoHcHJldmlldxgCIAEoCCIrCgxMaXN0UmVzcG9uc2USDAoEcGFnZRgBIAEoAxINCgVpdGVtcxgCIAMoCTIyCgtMaXN0U2VydmljZRIjCgRMaXN0EgwuTGlzdFJlcXVlc3QaDS5MaXN0UmVzcG9uc2ViBnByb3RvMw"); + +/** + * Describes the message ListRequest. + * Use `create(ListRequestSchema)` to create a new message. + */ +export const ListRequestSchema = /*@__PURE__*/ + messageDesc(file_list, 0); + +/** + * Describes the message ListResponse. + * Use `create(ListResponseSchema)` to create a new message. + */ +export const ListResponseSchema = /*@__PURE__*/ + messageDesc(file_list, 1); + +/** + * @generated from service ListService + */ +export const ListService = /*@__PURE__*/ + serviceDesc(file_list, 0); + diff --git a/packages/test-utils/gen/proto2_pb.d.ts b/packages/test-utils/gen/proto2_pb.d.ts new file mode 100644 index 00000000..47a8eb1e --- /dev/null +++ b/packages/test-utils/gen/proto2_pb.d.ts @@ -0,0 +1,47 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file proto2.proto (package test, syntax proto2) +/* eslint-disable */ + +import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file proto2.proto. + */ +export declare const file_proto2: GenFile; + +/** + * @generated from message test.Proto2Message + */ +export declare type Proto2Message = Message<"test.Proto2Message"> & { + /** + * @generated from field: optional string string_field = 1; + */ + stringField: string; + + /** + * @generated from field: optional int32 int32_field = 3; + */ + int32Field: number; +}; + +/** + * Describes the message test.Proto2Message. + * Use `create(Proto2MessageSchema)` to create a new message. + */ +export declare const Proto2MessageSchema: GenMessage; + diff --git a/packages/test-utils/gen/proto2_pb.js b/packages/test-utils/gen/proto2_pb.js new file mode 100644 index 00000000..e3f7713a --- /dev/null +++ b/packages/test-utils/gen/proto2_pb.js @@ -0,0 +1,33 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file proto2.proto (package test, syntax proto2) +/* eslint-disable */ + +import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv1"; + +/** + * Describes the file proto2.proto. + */ +export const file_proto2 = /*@__PURE__*/ + fileDesc("Cgxwcm90bzIucHJvdG8SBHRlc3QiOgoNUHJvdG8yTWVzc2FnZRIUCgxzdHJpbmdfZmllbGQYASABKAkSEwoLaW50MzJfZmllbGQYAyABKAU"); + +/** + * Describes the message test.Proto2Message. + * Use `create(Proto2MessageSchema)` to create a new message. + */ +export const Proto2MessageSchema = /*@__PURE__*/ + messageDesc(file_proto2, 0); + diff --git a/packages/test-utils/gen/proto3_pb.d.ts b/packages/test-utils/gen/proto3_pb.d.ts new file mode 100644 index 00000000..5e6fe1a9 --- /dev/null +++ b/packages/test-utils/gen/proto3_pb.d.ts @@ -0,0 +1,156 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file proto3.proto (package test, syntax proto3) +/* eslint-disable */ + +import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1"; +import type { Message } from "@bufbuild/protobuf"; + +/** + * Describes the file proto3.proto. + */ +export declare const file_proto3: GenFile; + +/** + * Note: We do not exhaust all field types + * + * @generated from message test.Proto3Message + */ +export declare type Proto3Message = Message<"test.Proto3Message"> & { + /** + * @generated from field: string string_field = 1; + */ + stringField: string; + + /** + * @generated from field: bytes bytes_field = 2; + */ + bytesField: Uint8Array; + + /** + * @generated from field: int32 int32_field = 3; + */ + int32Field: number; + + /** + * @generated from field: int64 int64_field = 4; + */ + int64Field: bigint; + + /** + * @generated from field: double double_field = 5; + */ + doubleField: number; + + /** + * @generated from field: bool bool_field = 6; + */ + boolField: boolean; + + /** + * @generated from field: test.Proto3Enum enum_field = 7; + */ + enumField: Proto3Enum; + + /** + * @generated from field: test.Proto3Message message_field = 8; + */ + messageField?: Proto3Message; + + /** + * @generated from field: optional string optional_string_field = 9; + */ + optionalStringField?: string; + + /** + * @generated from field: repeated string repeated_string_field = 17; + */ + repeatedStringField: string[]; + + /** + * @generated from field: repeated test.Proto3Message repeated_message_field = 18; + */ + repeatedMessageField: Proto3Message[]; + + /** + * @generated from field: repeated test.Proto3Enum repeated_enum_field = 19; + */ + repeatedEnumField: Proto3Enum[]; + + /** + * @generated from oneof test.Proto3Message.either + */ + either: { + /** + * @generated from field: string oneof_string_field = 31; + */ + value: string; + case: "oneofStringField"; + } | { + /** + * @generated from field: int32 oneof_int32_field = 33; + */ + value: number; + case: "oneofInt32Field"; + } | { case: undefined; value?: undefined }; + + /** + * @generated from field: map map_string_int64_field = 39; + */ + mapStringInt64Field: { [key: string]: bigint }; + + /** + * @generated from field: map map_string_message_field = 40; + */ + mapStringMessageField: { [key: string]: Proto3Message }; + + /** + * @generated from field: map map_string_enum_field = 41; + */ + mapStringEnumField: { [key: string]: Proto3Enum }; +}; + +/** + * Describes the message test.Proto3Message. + * Use `create(Proto3MessageSchema)` to create a new message. + */ +export declare const Proto3MessageSchema: GenMessage; + +/** + * @generated from enum test.Proto3Enum + */ +export enum Proto3Enum { + /** + * @generated from enum value: PROTO3_ENUM_UNSPECIFIED = 0; + */ + UNSPECIFIED = 0, + + /** + * @generated from enum value: PROTO3_ENUM_YES = 1; + */ + YES = 1, + + /** + * @generated from enum value: PROTO3_ENUM_NO = 2; + */ + NO = 2, +} + +/** + * Describes the enum test.Proto3Enum. + */ +export declare const Proto3EnumSchema: GenEnum; + diff --git a/packages/test-utils/gen/proto3_pb.js b/packages/test-utils/gen/proto3_pb.js new file mode 100644 index 00000000..1044cd95 --- /dev/null +++ b/packages/test-utils/gen/proto3_pb.js @@ -0,0 +1,45 @@ +// Copyright 2021-2023 The Connect Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v2.2.0 with parameter "target=dts+js" +// @generated from file proto3.proto (package test, syntax proto3) +/* eslint-disable */ + +import { enumDesc, fileDesc, messageDesc, tsEnum } from "@bufbuild/protobuf/codegenv1"; + +/** + * Describes the file proto3.proto. + */ +export const file_proto3 = /*@__PURE__*/ + fileDesc("Cgxwcm90bzMucHJvdG8SBHRlc3QirgcKDVByb3RvM01lc3NhZ2USFAoMc3RyaW5nX2ZpZWxkGAEgASgJEhMKC2J5dGVzX2ZpZWxkGAIgASgMEhMKC2ludDMyX2ZpZWxkGAMgASgFEhMKC2ludDY0X2ZpZWxkGAQgASgDEhQKDGRvdWJsZV9maWVsZBgFIAEoARISCgpib29sX2ZpZWxkGAYgASgIEiQKCmVudW1fZmllbGQYByABKA4yEC50ZXN0LlByb3RvM0VudW0SKgoNbWVzc2FnZV9maWVsZBgIIAEoCzITLnRlc3QuUHJvdG8zTWVzc2FnZRIiChVvcHRpb25hbF9zdHJpbmdfZmllbGQYCSABKAlIAYgBARIdChVyZXBlYXRlZF9zdHJpbmdfZmllbGQYESADKAkSMwoWcmVwZWF0ZWRfbWVzc2FnZV9maWVsZBgSIAMoCzITLnRlc3QuUHJvdG8zTWVzc2FnZRItChNyZXBlYXRlZF9lbnVtX2ZpZWxkGBMgAygOMhAudGVzdC5Qcm90bzNFbnVtEhwKEm9uZW9mX3N0cmluZ19maWVsZBgfIAEoCUgAEhsKEW9uZW9mX2ludDMyX2ZpZWxkGCEgASgFSAASTAoWbWFwX3N0cmluZ19pbnQ2NF9maWVsZBgnIAMoCzIsLnRlc3QuUHJvdG8zTWVzc2FnZS5NYXBTdHJpbmdJbnQ2NEZpZWxkRW50cnkSUAoYbWFwX3N0cmluZ19tZXNzYWdlX2ZpZWxkGCggAygLMi4udGVzdC5Qcm90bzNNZXNzYWdlLk1hcFN0cmluZ01lc3NhZ2VGaWVsZEVudHJ5EkoKFW1hcF9zdHJpbmdfZW51bV9maWVsZBgpIAMoCzIrLnRlc3QuUHJvdG8zTWVzc2FnZS5NYXBTdHJpbmdFbnVtRmllbGRFbnRyeRo6ChhNYXBTdHJpbmdJbnQ2NEZpZWxkRW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgDOgI4ARpRChpNYXBTdHJpbmdNZXNzYWdlRmllbGRFbnRyeRILCgNrZXkYASABKAkSIgoFdmFsdWUYAiABKAsyEy50ZXN0LlByb3RvM01lc3NhZ2U6AjgBGksKF01hcFN0cmluZ0VudW1GaWVsZEVudHJ5EgsKA2tleRgBIAEoCRIfCgV2YWx1ZRgCIAEoDjIQLnRlc3QuUHJvdG8zRW51bToCOAFCCAoGZWl0aGVyQhgKFl9vcHRpb25hbF9zdHJpbmdfZmllbGQqUgoKUHJvdG8zRW51bRIbChdQUk9UTzNfRU5VTV9VTlNQRUNJRklFRBAAEhMKD1BST1RPM19FTlVNX1lFUxABEhIKDlBST1RPM19FTlVNX05PEAJiBnByb3RvMw"); + +/** + * Describes the message test.Proto3Message. + * Use `create(Proto3MessageSchema)` to create a new message. + */ +export const Proto3MessageSchema = /*@__PURE__*/ + messageDesc(file_proto3, 0); + +/** + * Describes the enum test.Proto3Enum. + */ +export const Proto3EnumSchema = /*@__PURE__*/ + enumDesc(file_proto3, 0); + +/** + * @generated from enum test.Proto3Enum + */ +export const Proto3Enum = /*@__PURE__*/ + tsEnum(Proto3EnumSchema); + diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index a2eeb9cc..4f42604e 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -4,9 +4,14 @@ "version": "0.0.0", "type": "module", "scripts": { - "generate": "buf generate" + "clean": "rm -rf ./dist/*", + "generate": "buf generate", + "build": "tsc --project tsconfig.build.json" + }, + "exports": { + ".": "./dist/esm/index.js", + "./gen/*": "./dist/esm/gen/*" }, - "module": "index.tsx", "devDependencies": { "@bufbuild/buf": "^1.45.0", "@bufbuild/protobuf": "^2.2.0", @@ -15,5 +20,8 @@ "@connectrpc/connect-web": "^2.0.0-rc.1", "@types/react": "18.3.12", "react": "^18.3.1" - } + }, + "files": [ + "dist/**" + ] } diff --git a/packages/test-utils/gen/bigint_pb.ts b/packages/test-utils/src/gen/bigint_pb.ts similarity index 100% rename from packages/test-utils/gen/bigint_pb.ts rename to packages/test-utils/src/gen/bigint_pb.ts diff --git a/packages/test-utils/gen/eliza_pb.ts b/packages/test-utils/src/gen/eliza_pb.ts similarity index 100% rename from packages/test-utils/gen/eliza_pb.ts rename to packages/test-utils/src/gen/eliza_pb.ts diff --git a/packages/test-utils/gen/list_pb.ts b/packages/test-utils/src/gen/list_pb.ts similarity index 100% rename from packages/test-utils/gen/list_pb.ts rename to packages/test-utils/src/gen/list_pb.ts diff --git a/packages/test-utils/gen/proto2_pb.ts b/packages/test-utils/src/gen/proto2_pb.ts similarity index 100% rename from packages/test-utils/gen/proto2_pb.ts rename to packages/test-utils/src/gen/proto2_pb.ts diff --git a/packages/test-utils/gen/proto3_pb.ts b/packages/test-utils/src/gen/proto3_pb.ts similarity index 100% rename from packages/test-utils/gen/proto3_pb.ts rename to packages/test-utils/src/gen/proto3_pb.ts diff --git a/packages/test-utils/index.tsx b/packages/test-utils/src/index.tsx similarity index 100% rename from packages/test-utils/index.tsx rename to packages/test-utils/src/index.tsx diff --git a/packages/test-utils/tsconfig.build.json b/packages/test-utils/tsconfig.build.json new file mode 100644 index 00000000..171a4e93 --- /dev/null +++ b/packages/test-utils/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "skipLibCheck": true, + "declaration": true, + "declarationDir": "./dist/esm", + "outDir": "./dist/esm" + }, + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.test.ts", "**/*.test.tsx", "src/test/**"] +} diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index c8eb35dc..994fc249 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -1,8 +1,12 @@ { - "extends": "../../tsconfig.base.json", + "extends": "./tsconfig.build.json", "compilerOptions": { - "skipLibCheck": true, - "noEmit": true + "rootDir": ".", + "noUnusedLocals": false, // necessary for TypeScript type tests, but since this is not enabled for build, unused variables have no risk of leaking into the build output + "lib": ["DOM", "ESNext"], + "noEmit": true, + "verbatimModuleSyntax": false }, - "include": ["**/*.ts", "**/*.tsx"] + "exclude": ["coverage", "dist"], + "include": ["src", "./*.config.ts"] } diff --git a/turbo.json b/turbo.json index 6ee8b240..976ebecd 100644 --- a/turbo.json +++ b/turbo.json @@ -18,7 +18,7 @@ "dependsOn": ["^build", "build"] }, "test": { - "dependsOn": ["generate"], + "dependsOn": ["generate", "^generate"], "cache": false }, "attw": {