diff --git a/.github/actions/build-bun/action.yml b/.github/actions/build-bun/action.yml index 665c255e..f8c14ed2 100644 --- a/.github/actions/build-bun/action.yml +++ b/.github/actions/build-bun/action.yml @@ -24,6 +24,11 @@ runs: working-directory: ${{ inputs.path }} run: bun run build + - name: Test + shell: bash + working-directory: ${{ inputs.path }} + run: bun test + - name: Lint shell: bash # This will likely error on unrelated linting errors... diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 654bf1c8..daa07b80 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -29,12 +29,18 @@ jobs: build-bun: runs-on: ubuntu-latest + strategy: + matrix: + path: + - ts + - uml + - uml2ts steps: - uses: actions/checkout@v4 - uses: ./.github/actions/build-bun with: - path: packages/ts + path: packages/${{ matrix.path }} build-go: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index f465eaff..6d681cec 100644 --- a/Makefile +++ b/Makefile @@ -23,28 +23,33 @@ CLI_BIN := $(CLI_DIR)/$(BIN_PATH)/um.dll LANG_DIR := src/Language LANG_SRC := $(shell find $(LANG_DIR) -name '*.fs' -not -path '*obj*' -type f) -.PHONY: build test gen lint -build: $(LANG_SRC) $(CLI_SRC) $(BROKER_SRC) build_proto +.PHONY: build build_dotnet +build: build_dotnet @touch .make/build_lang - dotnet build +build_dotnet: .make/build_dotnet -test: build +.PHONY: test test_dotnet +test: test_dotnet test_packages +test_dotnet: build_dotnet dotnet test --no-build +test_packages: + @$(MAKE) -C packages test -gen: clean_gen build_proto - buf generate +.PHONY: gen +gen: gen_proto +.PHONY: lint lint: .make/lint_proto .make/lint_lang .PHONY: clean clean_gen clean_src clean_dist clean: clean_gen clean_src clean_dist rm -rf .make -clean_src: - @$(MAKE) -C src clean clean_cli: @$(MAKE) -C cli clean clean_gen: @$(MAKE) -C gen clean +clean_src: + @$(MAKE) -C src clean clean_dist: @find . -type d -name dist \ -not -path '*node_modules*' \ @@ -61,12 +66,10 @@ tidy: gen release: goreleaser release --snapshot --clean -.PHONY: build_proto -build_proto: - buf build - -$(BROKER_BIN): $(BROKER_SRC) - dotnet build ${BROKER_DIR} +.PHONY: proto gen_proto build_proto +proto: build_proto gen_proto +gen_proto: .make/gen_proto +build_proto: .make/build_proto # The naming is kinda silly but its short .PHONY: work @@ -87,22 +90,30 @@ go.work.sum: go.work dotnet tool restore @touch $@ +PROTO_SRC := $(shell find proto -type f -name '*.proto') +.make/gen_proto: .make/build_proto $(PROTO_SRC) + buf generate + @touch $@ +.make/build_proto: $(PROTO_SRC) + buf build + @touch $@ +.make/lint_proto: $(PROTO_SRC) + buf lint proto + @touch $@ + +.make/build_dotnet: $(LANG_SRC) $(BROKER_SRC) $(CLI_SRC) .make/gen_proto + dotnet build + @touch $@ .make/build_lang .make/build_broker .make/build_cli .make/build_lang: $(LANG_SRC) dotnet build ${LANG_DIR} @touch $@ - -.make/build_cli: $(CLI_SRC) - dotnet build ${CLI_DIR} +.make/build_broker: $(BROKER_SRC) .make/gen_proto + dotnet build ${BROKER_DIR} @touch $@ - -.make/lint_proto: - buf lint proto +.make/build_cli: $(CLI_SRC) .make/gen_proto + dotnet build ${CLI_DIR} @touch $@ .make/lint_lang: .make/tool_restore $(LANG_SRC) dotnet fantomas ${LANG_DIR} @touch $@ - -.make/build_plugin_gen_ts: - cd plugin/gen/ts && bun run build - @touch $@ diff --git a/buf.gen.yaml b/buf.gen.yaml index 1551ee01..d2f4fc2e 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -4,6 +4,8 @@ managed: enabled: true go_package_prefix: default: github.com/unstoppablemango/tdl/gen/proto/go + except: + - buf.build/googleapis/googleapis plugins: - plugin: buf.build/connectrpc/go:v1.16.1 diff --git a/bun.lockb b/bun.lockb index 51b880e4..e0c1bd47 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/docker/Makefile b/docker/Makefile new file mode 100644 index 00000000..006d957f --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,15 @@ +CONTEXT := $(shell git rev-parse --show-toplevel) + +.PHONY: uml2ts uml2ts_test +uml2ts: + docker build \ + -f uml2ts/Dockerfile \ + -t unstoppablemango/uml2ts \ + ${CONTEXT} + +uml2ts_test: + docker build \ + -f uml2ts/Dockerfile \ + -t unstoppablemango/uml2ts_test \ + --target test \ + ${CONTEXT} diff --git a/docker/uml2ts/.dockerignore b/docker/uml2ts/.dockerignore new file mode 100644 index 00000000..34d728dd --- /dev/null +++ b/docker/uml2ts/.dockerignore @@ -0,0 +1,22 @@ +node_modules +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +Makefile +.env +.editorconfig +.idea +coverage* +.config +.github +.make +cli +docker +pkg +proto +src diff --git a/docker/uml2ts/Dockerfile b/docker/uml2ts/Dockerfile new file mode 100644 index 00000000..9bd4fa04 --- /dev/null +++ b/docker/uml2ts/Dockerfile @@ -0,0 +1,35 @@ +FROM oven/bun:1 AS base +ARG BUILDPLATFORM +WORKDIR /build + +FROM base AS install + +RUN mkdir -p gen/proto/{es,ts} packages/{ts,uml,uml2ts} + +COPY package.json . +COPY gen/proto/es/package.json gen/proto/es/ +COPY gen/proto/ts/package.json gen/proto/ts/ +COPY packages/ts/package.json packages/ts/ +COPY packages/uml/package.json packages/uml/ +COPY packages/uml2ts/package.json packages/uml2ts/ +COPY bun.lockb . + +RUN bun install --frozen-lockfile --production + +FROM --platform=$BUILDPLATFORM install AS build +COPY --from=install /build/node_modules . + +COPY gen/proto/es/ gen/proto/es/ +COPY gen/proto/ts/ gen/proto/ts/ +COPY packages/ts/ packages/ts/ +COPY packages/uml/ packages/uml/ +COPY packages/uml2ts/ . + +RUN bun run build + +FROM ubuntu:noble-20240429 AS test +COPY --from=build /build/dist/uml2ts . + +FROM --platform=$BUILDPLATFORM scratch AS dist +COPY --from=build /build/dist/uml2ts . +ENTRYPOINT ["uml2ts"] diff --git a/eslint.config.mjs b/eslint.config.mjs index 4572dc63..b0e8a2fb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -12,10 +12,11 @@ export default tslint.config( '.idea/', '.make', '.vscode/', - 'bin/', - 'gen/', - 'obj/', 'proto/', + '**/bin/', + '**/gen/', + '**/obj/', + '**/dist/', ], }, { diff --git a/gen/proto/es/unmango/dev/tdl/v1alpha1/uml_pb.ts b/gen/proto/es/unmango/dev/tdl/v1alpha1/uml_pb.ts index 357ace10..2a1ffed1 100644 --- a/gen/proto/es/unmango/dev/tdl/v1alpha1/uml_pb.ts +++ b/gen/proto/es/unmango/dev/tdl/v1alpha1/uml_pb.ts @@ -4,7 +4,7 @@ // @ts-nocheck import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; -import { Message, proto3 } from "@bufbuild/protobuf"; +import { Any, Message, proto3 } from "@bufbuild/protobuf"; /** * @generated from message unmango.dev.tdl.v1alpha1.FromRequest @@ -238,9 +238,9 @@ export class Spec extends Message { name = ""; /** - * @generated from field: string repository = 2; + * @generated from field: string source = 2; */ - repository = ""; + source = ""; /** * @generated from field: string version = 3; @@ -258,15 +258,25 @@ export class Spec extends Message { description = ""; /** - * @generated from field: repeated string tags = 6; + * @generated from field: map labels = 6; */ - tags: string[] = []; + labels: { [key: string]: string } = {}; /** * @generated from field: map types = 7; */ types: { [key: string]: Type } = {}; + /** + * @generated from field: map functions = 8; + */ + functions: { [key: string]: Function } = {}; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + constructor(data?: PartialMessage) { super(); proto3.util.initPartial(data, this); @@ -276,12 +286,14 @@ export class Spec extends Message { static readonly typeName = "unmango.dev.tdl.v1alpha1.Spec"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 2, name: "repository", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "source", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 3, name: "version", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 4, name: "display_name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 5, name: "description", kind: "scalar", T: 9 /* ScalarType.STRING */ }, - { no: 6, name: "tags", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 6, name: "labels", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} }, { no: 7, name: "types", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Type} }, + { no: 8, name: "functions", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Function} }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): Spec { @@ -306,9 +318,34 @@ export class Spec extends Message { */ export class Type extends Message { /** - * @generated from field: string name = 1; + * @generated from field: string type = 1; */ - name = ""; + type = ""; + + /** + * @generated from field: map fields = 2; + */ + fields: { [key: string]: Field } = {}; + + /** + * @generated from field: map methods = 3; + */ + methods: { [key: string]: Function } = {}; + + /** + * @generated from field: map generic_parameters = 4; + */ + genericParameters: { [key: string]: GenericParameter } = {}; + + /** + * @generated from field: optional unmango.dev.tdl.v1alpha1.Constructor constructor = 5; + */ + constructor$?: Constructor; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; constructor(data?: PartialMessage) { super(); @@ -318,7 +355,12 @@ export class Type extends Message { static readonly runtime: typeof proto3 = proto3; static readonly typeName = "unmango.dev.tdl.v1alpha1.Type"; static readonly fields: FieldList = proto3.util.newFieldList(() => [ - { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 1, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "fields", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Field} }, + { no: 3, name: "methods", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Function} }, + { no: 4, name: "generic_parameters", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: GenericParameter} }, + { no: 5, name: "constructor", kind: "message", T: Constructor, opt: true }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, ]); static fromBinary(bytes: Uint8Array, options?: Partial): Type { @@ -338,3 +380,230 @@ export class Type extends Message { } } +/** + * @generated from message unmango.dev.tdl.v1alpha1.Field + */ +export class Field extends Message { + /** + * @generated from field: string type = 1; + */ + type = ""; + + /** + * @generated from field: bool readonly = 2; + */ + readonly = false; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "unmango.dev.tdl.v1alpha1.Field"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "readonly", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Field { + return new Field().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Field { + return new Field().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Field { + return new Field().fromJsonString(jsonString, options); + } + + static equals(a: Field | PlainMessage | undefined, b: Field | PlainMessage | undefined): boolean { + return proto3.util.equals(Field, a, b); + } +} + +/** + * @generated from message unmango.dev.tdl.v1alpha1.Function + */ +export class Function extends Message { + /** + * @generated from field: unmango.dev.tdl.v1alpha1.Type return_type = 1; + */ + returnType?: Type; + + /** + * @generated from field: map parameters = 2; + */ + parameters: { [key: string]: Type } = {}; + + /** + * @generated from field: map generic_parameters = 3; + */ + genericParameters: { [key: string]: GenericParameter } = {}; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "unmango.dev.tdl.v1alpha1.Function"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "return_type", kind: "message", T: Type }, + { no: 2, name: "parameters", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Type} }, + { no: 3, name: "generic_parameters", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: GenericParameter} }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Function { + return new Function().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Function { + return new Function().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Function { + return new Function().fromJsonString(jsonString, options); + } + + static equals(a: Function | PlainMessage | undefined, b: Function | PlainMessage | undefined): boolean { + return proto3.util.equals(Function, a, b); + } +} + +/** + * @generated from message unmango.dev.tdl.v1alpha1.GenericParameter + */ +export class GenericParameter extends Message { + /** + * @generated from field: repeated unmango.dev.tdl.v1alpha1.Modifier modifiers = 1; + */ + modifiers: Modifier[] = []; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "unmango.dev.tdl.v1alpha1.GenericParameter"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "modifiers", kind: "message", T: Modifier, repeated: true }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GenericParameter { + return new GenericParameter().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GenericParameter { + return new GenericParameter().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GenericParameter { + return new GenericParameter().fromJsonString(jsonString, options); + } + + static equals(a: GenericParameter | PlainMessage | undefined, b: GenericParameter | PlainMessage | undefined): boolean { + return proto3.util.equals(GenericParameter, a, b); + } +} + +/** + * @generated from message unmango.dev.tdl.v1alpha1.Modifier + */ +export class Modifier extends Message { + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "unmango.dev.tdl.v1alpha1.Modifier"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Modifier { + return new Modifier().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Modifier { + return new Modifier().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Modifier { + return new Modifier().fromJsonString(jsonString, options); + } + + static equals(a: Modifier | PlainMessage | undefined, b: Modifier | PlainMessage | undefined): boolean { + return proto3.util.equals(Modifier, a, b); + } +} + +/** + * @generated from message unmango.dev.tdl.v1alpha1.Constructor + */ +export class Constructor extends Message { + /** + * @generated from field: map parameters = 1; + */ + parameters: { [key: string]: Type } = {}; + + /** + * @generated from field: map meta = 128; + */ + meta: { [key: string]: Any } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "unmango.dev.tdl.v1alpha1.Constructor"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "parameters", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Type} }, + { no: 128, name: "meta", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Any} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Constructor { + return new Constructor().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Constructor { + return new Constructor().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Constructor { + return new Constructor().fromJsonString(jsonString, options); + } + + static equals(a: Constructor | PlainMessage | undefined, b: Constructor | PlainMessage | undefined): boolean { + return proto3.util.equals(Constructor, a, b); + } +} + diff --git a/gen/proto/go/unmango/dev/tdl/v1alpha1/uml.pb.go b/gen/proto/go/unmango/dev/tdl/v1alpha1/uml.pb.go index b52eee27..f27b94f7 100644 --- a/gen/proto/go/unmango/dev/tdl/v1alpha1/uml.pb.go +++ b/gen/proto/go/unmango/dev/tdl/v1alpha1/uml.pb.go @@ -9,6 +9,7 @@ package tdlv1alpha1 import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" ) @@ -307,13 +308,15 @@ type Spec struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Repository string `protobuf:"bytes,2,opt,name=repository,proto3" json:"repository,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` - Tags []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"` - Types map[string]*Type `protobuf:"bytes,7,rep,name=types,proto3" json:"types,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` + Labels map[string]string `protobuf:"bytes,6,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Types map[string]*Type `protobuf:"bytes,7,rep,name=types,proto3" json:"types,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Functions map[string]*Function `protobuf:"bytes,8,rep,name=functions,proto3" json:"functions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Spec) Reset() { @@ -355,9 +358,9 @@ func (x *Spec) GetName() string { return "" } -func (x *Spec) GetRepository() string { +func (x *Spec) GetSource() string { if x != nil { - return x.Repository + return x.Source } return "" } @@ -383,9 +386,9 @@ func (x *Spec) GetDescription() string { return "" } -func (x *Spec) GetTags() []string { +func (x *Spec) GetLabels() map[string]string { if x != nil { - return x.Tags + return x.Labels } return nil } @@ -397,12 +400,31 @@ func (x *Spec) GetTypes() map[string]*Type { return nil } +func (x *Spec) GetFunctions() map[string]*Function { + if x != nil { + return x.Functions + } + return nil +} + +func (x *Spec) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + type Type struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Fields map[string]*Field `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Methods map[string]*Function `protobuf:"bytes,3,rep,name=methods,proto3" json:"methods,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + GenericParameters map[string]*GenericParameter `protobuf:"bytes,4,rep,name=generic_parameters,json=genericParameters,proto3" json:"generic_parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Constructor *Constructor `protobuf:"bytes,5,opt,name=constructor,proto3,oneof" json:"constructor,omitempty"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Type) Reset() { @@ -437,95 +459,596 @@ func (*Type) Descriptor() ([]byte, []int) { return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{7} } -func (x *Type) GetName() string { +func (x *Type) GetType() string { if x != nil { - return x.Name + return x.Type } return "" } +func (x *Type) GetFields() map[string]*Field { + if x != nil { + return x.Fields + } + return nil +} + +func (x *Type) GetMethods() map[string]*Function { + if x != nil { + return x.Methods + } + return nil +} + +func (x *Type) GetGenericParameters() map[string]*GenericParameter { + if x != nil { + return x.GenericParameters + } + return nil +} + +func (x *Type) GetConstructor() *Constructor { + if x != nil { + return x.Constructor + } + return nil +} + +func (x *Type) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + +type Field struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Readonly bool `protobuf:"varint,2,opt,name=readonly,proto3" json:"readonly,omitempty"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Field) Reset() { + *x = Field{} + if protoimpl.UnsafeEnabled { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Field) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Field) ProtoMessage() {} + +func (x *Field) ProtoReflect() protoreflect.Message { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Field.ProtoReflect.Descriptor instead. +func (*Field) Descriptor() ([]byte, []int) { + return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{8} +} + +func (x *Field) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Field) GetReadonly() bool { + if x != nil { + return x.Readonly + } + return false +} + +func (x *Field) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + +type Function struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ReturnType *Type `protobuf:"bytes,1,opt,name=return_type,json=returnType,proto3" json:"return_type,omitempty"` + Parameters map[string]*Type `protobuf:"bytes,2,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + GenericParameters map[string]*GenericParameter `protobuf:"bytes,3,rep,name=generic_parameters,json=genericParameters,proto3" json:"generic_parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Function) Reset() { + *x = Function{} + if protoimpl.UnsafeEnabled { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Function) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Function) ProtoMessage() {} + +func (x *Function) ProtoReflect() protoreflect.Message { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Function.ProtoReflect.Descriptor instead. +func (*Function) Descriptor() ([]byte, []int) { + return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{9} +} + +func (x *Function) GetReturnType() *Type { + if x != nil { + return x.ReturnType + } + return nil +} + +func (x *Function) GetParameters() map[string]*Type { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *Function) GetGenericParameters() map[string]*GenericParameter { + if x != nil { + return x.GenericParameters + } + return nil +} + +func (x *Function) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + +type GenericParameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Modifiers []*Modifier `protobuf:"bytes,1,rep,name=modifiers,proto3" json:"modifiers,omitempty"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *GenericParameter) Reset() { + *x = GenericParameter{} + if protoimpl.UnsafeEnabled { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenericParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenericParameter) ProtoMessage() {} + +func (x *GenericParameter) ProtoReflect() protoreflect.Message { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenericParameter.ProtoReflect.Descriptor instead. +func (*GenericParameter) Descriptor() ([]byte, []int) { + return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{10} +} + +func (x *GenericParameter) GetModifiers() []*Modifier { + if x != nil { + return x.Modifiers + } + return nil +} + +func (x *GenericParameter) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + +type Modifier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Modifier) Reset() { + *x = Modifier{} + if protoimpl.UnsafeEnabled { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Modifier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Modifier) ProtoMessage() {} + +func (x *Modifier) ProtoReflect() protoreflect.Message { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Modifier.ProtoReflect.Descriptor instead. +func (*Modifier) Descriptor() ([]byte, []int) { + return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{11} +} + +func (x *Modifier) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + +type Constructor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Parameters map[string]*Type `protobuf:"bytes,1,rep,name=parameters,proto3" json:"parameters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Meta map[string]*anypb.Any `protobuf:"bytes,128,rep,name=meta,proto3" json:"meta,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *Constructor) Reset() { + *x = Constructor{} + if protoimpl.UnsafeEnabled { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Constructor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Constructor) ProtoMessage() {} + +func (x *Constructor) ProtoReflect() protoreflect.Message { + mi := &file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Constructor.ProtoReflect.Descriptor instead. +func (*Constructor) Descriptor() ([]byte, []int) { + return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP(), []int{12} +} + +func (x *Constructor) GetParameters() map[string]*Type { + if x != nil { + return x.Parameters + } + return nil +} + +func (x *Constructor) GetMeta() map[string]*anypb.Any { + if x != nil { + return x.Meta + } + return nil +} + var File_unmango_dev_tdl_v1alpha1_uml_proto protoreflect.FileDescriptor var file_unmango_dev_tdl_v1alpha1_uml_proto_rawDesc = []byte{ 0x0a, 0x22, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x74, 0x64, 0x6c, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x75, 0x6d, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x22, 0x21, - 0x0a, 0x0b, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x42, 0x0a, 0x0c, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x32, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, - 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, - 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x40, 0x0a, 0x0a, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, - 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, - 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x21, 0x0a, 0x0b, 0x47, 0x65, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3f, 0x0a, 0x09, 0x54, 0x6f, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x20, 0x0a, 0x0a, 0x54, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xc8, 0x02, - 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, - 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, - 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x3f, 0x0a, - 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x75, + 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x19, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x21, 0x0a, 0x0b, 0x46, 0x72, 0x6f, + 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x42, 0x0a, 0x0c, + 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, + 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, + 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, + 0x22, 0x40, 0x0a, 0x0a, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, + 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, + 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, + 0x65, 0x63, 0x22, 0x21, 0x0a, 0x0b, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3f, 0x0a, 0x09, 0x54, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, + 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x20, 0x0a, 0x0a, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xe8, 0x05, 0x0a, 0x04, 0x53, 0x70, 0x65, + 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, + 0x61, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x06, + 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x54, 0x79, 0x70, - 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x1a, 0x58, - 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x12, 0x3f, 0x0a, 0x05, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x29, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, + 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, + 0x54, 0x79, 0x70, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x53, 0x70, 0x65, 0x63, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3d, + 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x1a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x8e, 0x02, 0x0a, 0x0a, 0x55, 0x6d, 0x6c, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x57, 0x0a, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x25, 0x2e, 0x75, 0x6e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x4d, 0x65, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x39, 0x0a, + 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x58, 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, + 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x1a, 0x60, 0x0a, 0x0e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xa5, 0x06, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x42, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x66, 0x69, + 0x65, 0x6c, 0x64, 0x73, 0x12, 0x45, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x64, 0x0a, 0x12, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, + 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x48, 0x00, 0x52, + 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, + 0x3d, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, + 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x4d, + 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x5a, + 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, + 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, + 0x35, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, + 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5e, 0x0a, 0x0c, 0x4d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x72, - 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x54, 0x0a, 0x03, - 0x47, 0x65, 0x6e, 0x12, 0x24, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, - 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x75, 0x6e, 0x6d, 0x61, - 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x51, 0x0a, 0x02, 0x54, 0x6f, 0x12, 0x23, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, - 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x70, 0x0a, 0x16, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x09, + 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, + 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x22, 0xc6, 0x01, 0x0a, 0x05, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x61, + 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x61, + 0x64, 0x6f, 0x6e, 0x6c, 0x79, 0x12, 0x3e, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x80, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x04, 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xec, 0x04, 0x0a, 0x08, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x3f, 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x52, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x68, 0x0a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x69, + 0x63, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x75, + 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x67, + 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x12, 0x41, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, + 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x6d, + 0x65, 0x74, 0x61, 0x1a, 0x5d, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, + 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x1a, 0x70, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0xfe, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x75, 0x6e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xee, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x09, 0x6d, 0x6f, 0x64, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x08, 0x55, 0x6d, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, - 0x6e, 0x73, 0x74, 0x6f, 0x70, 0x70, 0x61, 0x62, 0x6c, 0x65, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2f, - 0x74, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, - 0x2f, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x74, 0x64, 0x6c, - 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x74, 0x64, 0x6c, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x55, 0x44, 0x54, 0xaa, 0x02, 0x18, 0x55, 0x6e, - 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x44, 0x65, 0x76, 0x2e, 0x54, 0x64, 0x6c, 0x2e, 0x56, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x18, 0x55, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, - 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x64, 0x6c, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0xe2, 0x02, 0x24, 0x55, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x5c, 0x44, 0x65, 0x76, 0x5c, - 0x54, 0x64, 0x6c, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1b, 0x55, 0x6e, 0x6d, 0x61, 0x6e, - 0x67, 0x6f, 0x3a, 0x3a, 0x44, 0x65, 0x76, 0x3a, 0x3a, 0x54, 0x64, 0x6c, 0x3a, 0x3a, 0x56, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, + 0x09, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x72, 0x73, 0x12, 0x49, 0x0a, 0x04, 0x6d, 0x65, + 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x75, 0x6e, 0x6d, 0x61, + 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x04, 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9c, 0x01, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x12, 0x41, 0x0a, 0x04, 0x6d, 0x65, 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, + 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, + 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xd8, 0x02, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, + 0x74, 0x6f, 0x72, 0x12, 0x55, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, + 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x04, 0x6d, 0x65, + 0x74, 0x61, 0x18, 0x80, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x75, 0x6e, 0x6d, 0x61, + 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x6d, 0x65, 0x74, 0x61, + 0x1a, 0x5d, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, + 0x4d, 0x0a, 0x09, 0x4d, 0x65, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x8e, + 0x02, 0x0a, 0x0a, 0x55, 0x6d, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x57, 0x0a, + 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x25, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x75, + 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x46, 0x72, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x12, 0x54, 0x0a, 0x03, 0x47, 0x65, 0x6e, 0x12, 0x24, 0x2e, + 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, + 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x51, 0x0a, 0x02, + 0x54, 0x6f, 0x12, 0x23, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x54, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, + 0x6f, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, + 0xfe, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x75, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x74, 0x64, 0x6c, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x42, 0x08, 0x55, 0x6d, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x51, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x6e, 0x73, 0x74, 0x6f, 0x70, 0x70, + 0x61, 0x62, 0x6c, 0x65, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2f, 0x74, 0x64, 0x6c, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x75, 0x6e, 0x6d, 0x61, 0x6e, + 0x67, 0x6f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x74, 0x64, 0x6c, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x3b, 0x74, 0x64, 0x6c, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, + 0x02, 0x03, 0x55, 0x44, 0x54, 0xaa, 0x02, 0x18, 0x55, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x2e, + 0x44, 0x65, 0x76, 0x2e, 0x54, 0x64, 0x6c, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0xca, 0x02, 0x18, 0x55, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, + 0x64, 0x6c, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x24, 0x55, 0x6e, + 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x5c, 0x44, 0x65, 0x76, 0x5c, 0x54, 0x64, 0x6c, 0x5c, 0x56, 0x31, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x1b, 0x55, 0x6e, 0x6d, 0x61, 0x6e, 0x67, 0x6f, 0x3a, 0x3a, 0x44, 0x65, + 0x76, 0x3a, 0x3a, 0x54, 0x64, 0x6c, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -540,35 +1063,88 @@ func file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescGZIP() []byte { return file_unmango_dev_tdl_v1alpha1_uml_proto_rawDescData } -var file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes = make([]protoimpl.MessageInfo, 29) var file_unmango_dev_tdl_v1alpha1_uml_proto_goTypes = []interface{}{ - (*FromRequest)(nil), // 0: unmango.dev.tdl.v1alpha1.FromRequest - (*FromResponse)(nil), // 1: unmango.dev.tdl.v1alpha1.FromResponse - (*GenRequest)(nil), // 2: unmango.dev.tdl.v1alpha1.GenRequest - (*GenResponse)(nil), // 3: unmango.dev.tdl.v1alpha1.GenResponse - (*ToRequest)(nil), // 4: unmango.dev.tdl.v1alpha1.ToRequest - (*ToResponse)(nil), // 5: unmango.dev.tdl.v1alpha1.ToResponse - (*Spec)(nil), // 6: unmango.dev.tdl.v1alpha1.Spec - (*Type)(nil), // 7: unmango.dev.tdl.v1alpha1.Type - nil, // 8: unmango.dev.tdl.v1alpha1.Spec.TypesEntry + (*FromRequest)(nil), // 0: unmango.dev.tdl.v1alpha1.FromRequest + (*FromResponse)(nil), // 1: unmango.dev.tdl.v1alpha1.FromResponse + (*GenRequest)(nil), // 2: unmango.dev.tdl.v1alpha1.GenRequest + (*GenResponse)(nil), // 3: unmango.dev.tdl.v1alpha1.GenResponse + (*ToRequest)(nil), // 4: unmango.dev.tdl.v1alpha1.ToRequest + (*ToResponse)(nil), // 5: unmango.dev.tdl.v1alpha1.ToResponse + (*Spec)(nil), // 6: unmango.dev.tdl.v1alpha1.Spec + (*Type)(nil), // 7: unmango.dev.tdl.v1alpha1.Type + (*Field)(nil), // 8: unmango.dev.tdl.v1alpha1.Field + (*Function)(nil), // 9: unmango.dev.tdl.v1alpha1.Function + (*GenericParameter)(nil), // 10: unmango.dev.tdl.v1alpha1.GenericParameter + (*Modifier)(nil), // 11: unmango.dev.tdl.v1alpha1.Modifier + (*Constructor)(nil), // 12: unmango.dev.tdl.v1alpha1.Constructor + nil, // 13: unmango.dev.tdl.v1alpha1.Spec.LabelsEntry + nil, // 14: unmango.dev.tdl.v1alpha1.Spec.TypesEntry + nil, // 15: unmango.dev.tdl.v1alpha1.Spec.FunctionsEntry + nil, // 16: unmango.dev.tdl.v1alpha1.Spec.MetaEntry + nil, // 17: unmango.dev.tdl.v1alpha1.Type.FieldsEntry + nil, // 18: unmango.dev.tdl.v1alpha1.Type.MethodsEntry + nil, // 19: unmango.dev.tdl.v1alpha1.Type.GenericParametersEntry + nil, // 20: unmango.dev.tdl.v1alpha1.Type.MetaEntry + nil, // 21: unmango.dev.tdl.v1alpha1.Field.MetaEntry + nil, // 22: unmango.dev.tdl.v1alpha1.Function.ParametersEntry + nil, // 23: unmango.dev.tdl.v1alpha1.Function.GenericParametersEntry + nil, // 24: unmango.dev.tdl.v1alpha1.Function.MetaEntry + nil, // 25: unmango.dev.tdl.v1alpha1.GenericParameter.MetaEntry + nil, // 26: unmango.dev.tdl.v1alpha1.Modifier.MetaEntry + nil, // 27: unmango.dev.tdl.v1alpha1.Constructor.ParametersEntry + nil, // 28: unmango.dev.tdl.v1alpha1.Constructor.MetaEntry + (*anypb.Any)(nil), // 29: google.protobuf.Any } var file_unmango_dev_tdl_v1alpha1_uml_proto_depIdxs = []int32{ - 6, // 0: unmango.dev.tdl.v1alpha1.FromResponse.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec - 6, // 1: unmango.dev.tdl.v1alpha1.GenRequest.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec - 6, // 2: unmango.dev.tdl.v1alpha1.ToRequest.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec - 8, // 3: unmango.dev.tdl.v1alpha1.Spec.types:type_name -> unmango.dev.tdl.v1alpha1.Spec.TypesEntry - 7, // 4: unmango.dev.tdl.v1alpha1.Spec.TypesEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Type - 0, // 5: unmango.dev.tdl.v1alpha1.UmlService.From:input_type -> unmango.dev.tdl.v1alpha1.FromRequest - 2, // 6: unmango.dev.tdl.v1alpha1.UmlService.Gen:input_type -> unmango.dev.tdl.v1alpha1.GenRequest - 4, // 7: unmango.dev.tdl.v1alpha1.UmlService.To:input_type -> unmango.dev.tdl.v1alpha1.ToRequest - 1, // 8: unmango.dev.tdl.v1alpha1.UmlService.From:output_type -> unmango.dev.tdl.v1alpha1.FromResponse - 3, // 9: unmango.dev.tdl.v1alpha1.UmlService.Gen:output_type -> unmango.dev.tdl.v1alpha1.GenResponse - 5, // 10: unmango.dev.tdl.v1alpha1.UmlService.To:output_type -> unmango.dev.tdl.v1alpha1.ToResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 6, // 0: unmango.dev.tdl.v1alpha1.FromResponse.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec + 6, // 1: unmango.dev.tdl.v1alpha1.GenRequest.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec + 6, // 2: unmango.dev.tdl.v1alpha1.ToRequest.spec:type_name -> unmango.dev.tdl.v1alpha1.Spec + 13, // 3: unmango.dev.tdl.v1alpha1.Spec.labels:type_name -> unmango.dev.tdl.v1alpha1.Spec.LabelsEntry + 14, // 4: unmango.dev.tdl.v1alpha1.Spec.types:type_name -> unmango.dev.tdl.v1alpha1.Spec.TypesEntry + 15, // 5: unmango.dev.tdl.v1alpha1.Spec.functions:type_name -> unmango.dev.tdl.v1alpha1.Spec.FunctionsEntry + 16, // 6: unmango.dev.tdl.v1alpha1.Spec.meta:type_name -> unmango.dev.tdl.v1alpha1.Spec.MetaEntry + 17, // 7: unmango.dev.tdl.v1alpha1.Type.fields:type_name -> unmango.dev.tdl.v1alpha1.Type.FieldsEntry + 18, // 8: unmango.dev.tdl.v1alpha1.Type.methods:type_name -> unmango.dev.tdl.v1alpha1.Type.MethodsEntry + 19, // 9: unmango.dev.tdl.v1alpha1.Type.generic_parameters:type_name -> unmango.dev.tdl.v1alpha1.Type.GenericParametersEntry + 12, // 10: unmango.dev.tdl.v1alpha1.Type.constructor:type_name -> unmango.dev.tdl.v1alpha1.Constructor + 20, // 11: unmango.dev.tdl.v1alpha1.Type.meta:type_name -> unmango.dev.tdl.v1alpha1.Type.MetaEntry + 21, // 12: unmango.dev.tdl.v1alpha1.Field.meta:type_name -> unmango.dev.tdl.v1alpha1.Field.MetaEntry + 7, // 13: unmango.dev.tdl.v1alpha1.Function.return_type:type_name -> unmango.dev.tdl.v1alpha1.Type + 22, // 14: unmango.dev.tdl.v1alpha1.Function.parameters:type_name -> unmango.dev.tdl.v1alpha1.Function.ParametersEntry + 23, // 15: unmango.dev.tdl.v1alpha1.Function.generic_parameters:type_name -> unmango.dev.tdl.v1alpha1.Function.GenericParametersEntry + 24, // 16: unmango.dev.tdl.v1alpha1.Function.meta:type_name -> unmango.dev.tdl.v1alpha1.Function.MetaEntry + 11, // 17: unmango.dev.tdl.v1alpha1.GenericParameter.modifiers:type_name -> unmango.dev.tdl.v1alpha1.Modifier + 25, // 18: unmango.dev.tdl.v1alpha1.GenericParameter.meta:type_name -> unmango.dev.tdl.v1alpha1.GenericParameter.MetaEntry + 26, // 19: unmango.dev.tdl.v1alpha1.Modifier.meta:type_name -> unmango.dev.tdl.v1alpha1.Modifier.MetaEntry + 27, // 20: unmango.dev.tdl.v1alpha1.Constructor.parameters:type_name -> unmango.dev.tdl.v1alpha1.Constructor.ParametersEntry + 28, // 21: unmango.dev.tdl.v1alpha1.Constructor.meta:type_name -> unmango.dev.tdl.v1alpha1.Constructor.MetaEntry + 7, // 22: unmango.dev.tdl.v1alpha1.Spec.TypesEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Type + 9, // 23: unmango.dev.tdl.v1alpha1.Spec.FunctionsEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Function + 29, // 24: unmango.dev.tdl.v1alpha1.Spec.MetaEntry.value:type_name -> google.protobuf.Any + 8, // 25: unmango.dev.tdl.v1alpha1.Type.FieldsEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Field + 9, // 26: unmango.dev.tdl.v1alpha1.Type.MethodsEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Function + 10, // 27: unmango.dev.tdl.v1alpha1.Type.GenericParametersEntry.value:type_name -> unmango.dev.tdl.v1alpha1.GenericParameter + 29, // 28: unmango.dev.tdl.v1alpha1.Type.MetaEntry.value:type_name -> google.protobuf.Any + 29, // 29: unmango.dev.tdl.v1alpha1.Field.MetaEntry.value:type_name -> google.protobuf.Any + 7, // 30: unmango.dev.tdl.v1alpha1.Function.ParametersEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Type + 10, // 31: unmango.dev.tdl.v1alpha1.Function.GenericParametersEntry.value:type_name -> unmango.dev.tdl.v1alpha1.GenericParameter + 29, // 32: unmango.dev.tdl.v1alpha1.Function.MetaEntry.value:type_name -> google.protobuf.Any + 29, // 33: unmango.dev.tdl.v1alpha1.GenericParameter.MetaEntry.value:type_name -> google.protobuf.Any + 29, // 34: unmango.dev.tdl.v1alpha1.Modifier.MetaEntry.value:type_name -> google.protobuf.Any + 7, // 35: unmango.dev.tdl.v1alpha1.Constructor.ParametersEntry.value:type_name -> unmango.dev.tdl.v1alpha1.Type + 29, // 36: unmango.dev.tdl.v1alpha1.Constructor.MetaEntry.value:type_name -> google.protobuf.Any + 0, // 37: unmango.dev.tdl.v1alpha1.UmlService.From:input_type -> unmango.dev.tdl.v1alpha1.FromRequest + 2, // 38: unmango.dev.tdl.v1alpha1.UmlService.Gen:input_type -> unmango.dev.tdl.v1alpha1.GenRequest + 4, // 39: unmango.dev.tdl.v1alpha1.UmlService.To:input_type -> unmango.dev.tdl.v1alpha1.ToRequest + 1, // 40: unmango.dev.tdl.v1alpha1.UmlService.From:output_type -> unmango.dev.tdl.v1alpha1.FromResponse + 3, // 41: unmango.dev.tdl.v1alpha1.UmlService.Gen:output_type -> unmango.dev.tdl.v1alpha1.GenResponse + 5, // 42: unmango.dev.tdl.v1alpha1.UmlService.To:output_type -> unmango.dev.tdl.v1alpha1.ToResponse + 40, // [40:43] is the sub-list for method output_type + 37, // [37:40] is the sub-list for method input_type + 37, // [37:37] is the sub-list for extension type_name + 37, // [37:37] is the sub-list for extension extendee + 0, // [0:37] is the sub-list for field type_name } func init() { file_unmango_dev_tdl_v1alpha1_uml_proto_init() } @@ -673,14 +1249,75 @@ func file_unmango_dev_tdl_v1alpha1_uml_proto_init() { return nil } } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Field); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Function); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenericParameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Modifier); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Constructor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } + file_unmango_dev_tdl_v1alpha1_uml_proto_msgTypes[7].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_unmango_dev_tdl_v1alpha1_uml_proto_rawDesc, NumEnums: 0, - NumMessages: 9, + NumMessages: 29, NumExtensions: 0, NumServices: 1, }, diff --git a/gen/proto/ts/google/protobuf/any.ts b/gen/proto/ts/google/protobuf/any.ts new file mode 100644 index 00000000..5cca936e --- /dev/null +++ b/gen/proto/ts/google/protobuf/any.ts @@ -0,0 +1,242 @@ +/* eslint-disable */ +import * as _m0 from "protobufjs/minimal"; + +export const protobufPackage = "google.protobuf"; + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} + +function createBaseAny(): Any { + return { typeUrl: "", value: new Uint8Array(0) }; +} + +export const Any = { + encode(message: Any, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Any { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.typeUrl = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Any { + return { + typeUrl: isSet(object.typeUrl) ? globalThis.String(object.typeUrl) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + if (message.typeUrl !== "") { + obj.typeUrl = message.typeUrl; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/gen/proto/ts/index.ts b/gen/proto/ts/index.ts new file mode 100644 index 00000000..669754a0 --- /dev/null +++ b/gen/proto/ts/index.ts @@ -0,0 +1 @@ +export * from './unmango/dev/tdl/v1alpha1/uml'; diff --git a/gen/proto/ts/package.json b/gen/proto/ts/package.json index 41a74821..ef3dd868 100644 --- a/gen/proto/ts/package.json +++ b/gen/proto/ts/package.json @@ -2,7 +2,8 @@ "name": "@unmango/tdl-ts", "author": "UnstoppableMango", "dependencies": { - "protobufjs": "^7.2.6" + "protobufjs": "^7.2.6", + "rxjs": "^7.8.1" }, "trustedDependencies": [ "protobufjs" diff --git a/gen/proto/ts/unmango/dev/tdl/v1alpha1/uml.ts b/gen/proto/ts/unmango/dev/tdl/v1alpha1/uml.ts index 98425d65..8c11c0d8 100644 --- a/gen/proto/ts/unmango/dev/tdl/v1alpha1/uml.ts +++ b/gen/proto/ts/unmango/dev/tdl/v1alpha1/uml.ts @@ -2,6 +2,7 @@ import * as _m0 from "protobufjs/minimal"; import { Observable } from "rxjs"; import { map } from "rxjs/operators"; +import { Any } from "../../../../google/protobuf/any"; export const protobufPackage = "unmango.dev.tdl.v1alpha1"; @@ -31,12 +32,19 @@ export interface ToResponse { export interface Spec { name: string; - repository: string; + source: string; version: string; displayName: string; description: string; - tags: string[]; + labels: { [key: string]: string }; types: { [key: string]: Type }; + functions: { [key: string]: Function }; + meta: { [key: string]: Any }; +} + +export interface Spec_LabelsEntry { + key: string; + value: string; } export interface Spec_TypesEntry { @@ -44,8 +52,110 @@ export interface Spec_TypesEntry { value: Type | undefined; } +export interface Spec_FunctionsEntry { + key: string; + value: Function | undefined; +} + +export interface Spec_MetaEntry { + key: string; + value: Any | undefined; +} + export interface Type { - name: string; + type: string; + fields: { [key: string]: Field }; + methods: { [key: string]: Function }; + genericParameters: { [key: string]: GenericParameter }; + constructor?: Constructor | undefined; + meta: { [key: string]: Any }; +} + +export interface Type_FieldsEntry { + key: string; + value: Field | undefined; +} + +export interface Type_MethodsEntry { + key: string; + value: Function | undefined; +} + +export interface Type_GenericParametersEntry { + key: string; + value: GenericParameter | undefined; +} + +export interface Type_MetaEntry { + key: string; + value: Any | undefined; +} + +export interface Field { + type: string; + readonly: boolean; + meta: { [key: string]: Any }; +} + +export interface Field_MetaEntry { + key: string; + value: Any | undefined; +} + +export interface Function { + returnType: Type | undefined; + parameters: { [key: string]: Type }; + genericParameters: { [key: string]: GenericParameter }; + meta: { [key: string]: Any }; +} + +export interface Function_ParametersEntry { + key: string; + value: Type | undefined; +} + +export interface Function_GenericParametersEntry { + key: string; + value: GenericParameter | undefined; +} + +export interface Function_MetaEntry { + key: string; + value: Any | undefined; +} + +export interface GenericParameter { + modifiers: Modifier[]; + meta: { [key: string]: Any }; +} + +export interface GenericParameter_MetaEntry { + key: string; + value: Any | undefined; +} + +export interface Modifier { + meta: { [key: string]: Any }; +} + +export interface Modifier_MetaEntry { + key: string; + value: Any | undefined; +} + +export interface Constructor { + parameters: { [key: string]: Type }; + meta: { [key: string]: Any }; +} + +export interface Constructor_ParametersEntry { + key: string; + value: Type | undefined; +} + +export interface Constructor_MetaEntry { + key: string; + value: Any | undefined; } function createBaseFromRequest(): FromRequest { @@ -391,7 +501,17 @@ export const ToResponse = { }; function createBaseSpec(): Spec { - return { name: "", repository: "", version: "", displayName: "", description: "", tags: [], types: {} }; + return { + name: "", + source: "", + version: "", + displayName: "", + description: "", + labels: {}, + types: {}, + functions: {}, + meta: {}, + }; } export const Spec = { @@ -399,8 +519,8 @@ export const Spec = { if (message.name !== "") { writer.uint32(10).string(message.name); } - if (message.repository !== "") { - writer.uint32(18).string(message.repository); + if (message.source !== "") { + writer.uint32(18).string(message.source); } if (message.version !== "") { writer.uint32(26).string(message.version); @@ -411,12 +531,18 @@ export const Spec = { if (message.description !== "") { writer.uint32(42).string(message.description); } - for (const v of message.tags) { - writer.uint32(50).string(v!); - } + Object.entries(message.labels).forEach(([key, value]) => { + Spec_LabelsEntry.encode({ key: key as any, value }, writer.uint32(50).fork()).ldelim(); + }); Object.entries(message.types).forEach(([key, value]) => { Spec_TypesEntry.encode({ key: key as any, value }, writer.uint32(58).fork()).ldelim(); }); + Object.entries(message.functions).forEach(([key, value]) => { + Spec_FunctionsEntry.encode({ key: key as any, value }, writer.uint32(66).fork()).ldelim(); + }); + Object.entries(message.meta).forEach(([key, value]) => { + Spec_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); return writer; }, @@ -439,7 +565,7 @@ export const Spec = { break; } - message.repository = reader.string(); + message.source = reader.string(); continue; case 3: if (tag !== 26) { @@ -467,7 +593,10 @@ export const Spec = { break; } - message.tags.push(reader.string()); + const entry6 = Spec_LabelsEntry.decode(reader, reader.uint32()); + if (entry6.value !== undefined) { + message.labels[entry6.key] = entry6.value; + } continue; case 7: if (tag !== 58) { @@ -479,6 +608,26 @@ export const Spec = { message.types[entry7.key] = entry7.value; } continue; + case 8: + if (tag !== 66) { + break; + } + + const entry8 = Spec_FunctionsEntry.decode(reader, reader.uint32()); + if (entry8.value !== undefined) { + message.functions[entry8.key] = entry8.value; + } + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Spec_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -491,17 +640,34 @@ export const Spec = { fromJSON(object: any): Spec { return { name: isSet(object.name) ? globalThis.String(object.name) : "", - repository: isSet(object.repository) ? globalThis.String(object.repository) : "", + source: isSet(object.source) ? globalThis.String(object.source) : "", version: isSet(object.version) ? globalThis.String(object.version) : "", displayName: isSet(object.displayName) ? globalThis.String(object.displayName) : "", description: isSet(object.description) ? globalThis.String(object.description) : "", - tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e: any) => globalThis.String(e)) : [], + labels: isObject(object.labels) + ? Object.entries(object.labels).reduce<{ [key: string]: string }>((acc, [key, value]) => { + acc[key] = String(value); + return acc; + }, {}) + : {}, types: isObject(object.types) ? Object.entries(object.types).reduce<{ [key: string]: Type }>((acc, [key, value]) => { acc[key] = Type.fromJSON(value); return acc; }, {}) : {}, + functions: isObject(object.functions) + ? Object.entries(object.functions).reduce<{ [key: string]: Function }>((acc, [key, value]) => { + acc[key] = Function.fromJSON(value); + return acc; + }, {}) + : {}, + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, }; }, @@ -510,8 +676,8 @@ export const Spec = { if (message.name !== "") { obj.name = message.name; } - if (message.repository !== "") { - obj.repository = message.repository; + if (message.source !== "") { + obj.source = message.source; } if (message.version !== "") { obj.version = message.version; @@ -522,8 +688,14 @@ export const Spec = { if (message.description !== "") { obj.description = message.description; } - if (message.tags?.length) { - obj.tags = message.tags; + if (message.labels) { + const entries = Object.entries(message.labels); + if (entries.length > 0) { + obj.labels = {}; + entries.forEach(([k, v]) => { + obj.labels[k] = v; + }); + } } if (message.types) { const entries = Object.entries(message.types); @@ -534,6 +706,24 @@ export const Spec = { }); } } + if (message.functions) { + const entries = Object.entries(message.functions); + if (entries.length > 0) { + obj.functions = {}; + entries.forEach(([k, v]) => { + obj.functions[k] = Function.toJSON(v); + }); + } + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } return obj; }, @@ -543,17 +733,111 @@ export const Spec = { fromPartial, I>>(object: I): Spec { const message = createBaseSpec(); message.name = object.name ?? ""; - message.repository = object.repository ?? ""; + message.source = object.source ?? ""; message.version = object.version ?? ""; message.displayName = object.displayName ?? ""; message.description = object.description ?? ""; - message.tags = object.tags?.map((e) => e) || []; + message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, {}); message.types = Object.entries(object.types ?? {}).reduce<{ [key: string]: Type }>((acc, [key, value]) => { if (value !== undefined) { acc[key] = Type.fromPartial(value); } return acc; }, {}); + message.functions = Object.entries(object.functions ?? {}).reduce<{ [key: string]: Function }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Function.fromPartial(value); + } + return acc; + }, + {}, + ); + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseSpec_LabelsEntry(): Spec_LabelsEntry { + return { key: "", value: "" }; +} + +export const Spec_LabelsEntry = { + encode(message: Spec_LabelsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Spec_LabelsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSpec_LabelsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Spec_LabelsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Spec_LabelsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Spec_LabelsEntry { + return Spec_LabelsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Spec_LabelsEntry { + const message = createBaseSpec_LabelsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; return message; }, }; @@ -632,22 +916,25 @@ export const Spec_TypesEntry = { }, }; -function createBaseType(): Type { - return { name: "" }; +function createBaseSpec_FunctionsEntry(): Spec_FunctionsEntry { + return { key: "", value: undefined }; } -export const Type = { - encode(message: Type, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { - writer.uint32(10).string(message.name); +export const Spec_FunctionsEntry = { + encode(message: Spec_FunctionsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Function.encode(message.value, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Type { + decode(input: _m0.Reader | Uint8Array, length?: number): Spec_FunctionsEntry { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseType(); + const message = createBaseSpec_FunctionsEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -656,7 +943,14 @@ export const Type = { break; } - message.name = reader.string(); + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Function.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { @@ -667,24 +961,1781 @@ export const Type = { return message; }, - fromJSON(object: any): Type { - return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + fromJSON(object: any): Spec_FunctionsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Function.fromJSON(object.value) : undefined, + }; }, - toJSON(message: Type): unknown { + toJSON(message: Spec_FunctionsEntry): unknown { const obj: any = {}; - if (message.name !== "") { - obj.name = message.name; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Function.toJSON(message.value); } return obj; }, - create, I>>(base?: I): Type { - return Type.fromPartial(base ?? ({} as any)); + create, I>>(base?: I): Spec_FunctionsEntry { + return Spec_FunctionsEntry.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Type { - const message = createBaseType(); - message.name = object.name ?? ""; + fromPartial, I>>(object: I): Spec_FunctionsEntry { + const message = createBaseSpec_FunctionsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Function.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseSpec_MetaEntry(): Spec_MetaEntry { + return { key: "", value: undefined }; +} + +export const Spec_MetaEntry = { + encode(message: Spec_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Spec_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSpec_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Spec_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Spec_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Spec_MetaEntry { + return Spec_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Spec_MetaEntry { + const message = createBaseSpec_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseType(): Type { + return { type: "", fields: {}, methods: {}, genericParameters: {}, constructor: undefined, meta: {} }; +} + +export const Type = { + encode(message: Type, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + Object.entries(message.fields).forEach(([key, value]) => { + Type_FieldsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim(); + }); + Object.entries(message.methods).forEach(([key, value]) => { + Type_MethodsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim(); + }); + Object.entries(message.genericParameters).forEach(([key, value]) => { + Type_GenericParametersEntry.encode({ key: key as any, value }, writer.uint32(34).fork()).ldelim(); + }); + if (message.constructor !== undefined) { + Constructor.encode(message.constructor, writer.uint32(42).fork()).ldelim(); + } + Object.entries(message.meta).forEach(([key, value]) => { + Type_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Type { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseType(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + const entry2 = Type_FieldsEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.fields[entry2.key] = entry2.value; + } + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = Type_MethodsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.methods[entry3.key] = entry3.value; + } + continue; + case 4: + if (tag !== 34) { + break; + } + + const entry4 = Type_GenericParametersEntry.decode(reader, reader.uint32()); + if (entry4.value !== undefined) { + message.genericParameters[entry4.key] = entry4.value; + } + continue; + case 5: + if (tag !== 42) { + break; + } + + message.constructor = Constructor.decode(reader, reader.uint32()); + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Type_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Type { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + fields: isObject(object.fields) + ? Object.entries(object.fields).reduce<{ [key: string]: Field }>((acc, [key, value]) => { + acc[key] = Field.fromJSON(value); + return acc; + }, {}) + : {}, + methods: isObject(object.methods) + ? Object.entries(object.methods).reduce<{ [key: string]: Function }>((acc, [key, value]) => { + acc[key] = Function.fromJSON(value); + return acc; + }, {}) + : {}, + genericParameters: isObject(object.genericParameters) + ? Object.entries(object.genericParameters).reduce<{ [key: string]: GenericParameter }>((acc, [key, value]) => { + acc[key] = GenericParameter.fromJSON(value); + return acc; + }, {}) + : {}, + constructor: isSet(object.constructor) ? Constructor.fromJSON(object.constructor) : undefined, + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Type): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.fields) { + const entries = Object.entries(message.fields); + if (entries.length > 0) { + obj.fields = {}; + entries.forEach(([k, v]) => { + obj.fields[k] = Field.toJSON(v); + }); + } + } + if (message.methods) { + const entries = Object.entries(message.methods); + if (entries.length > 0) { + obj.methods = {}; + entries.forEach(([k, v]) => { + obj.methods[k] = Function.toJSON(v); + }); + } + } + if (message.genericParameters) { + const entries = Object.entries(message.genericParameters); + if (entries.length > 0) { + obj.genericParameters = {}; + entries.forEach(([k, v]) => { + obj.genericParameters[k] = GenericParameter.toJSON(v); + }); + } + } + if (message.constructor !== undefined) { + obj.constructor = Constructor.toJSON(message.constructor); + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Type { + return Type.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Type { + const message = createBaseType(); + message.type = object.type ?? ""; + message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: Field }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Field.fromPartial(value); + } + return acc; + }, {}); + message.methods = Object.entries(object.methods ?? {}).reduce<{ [key: string]: Function }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Function.fromPartial(value); + } + return acc; + }, {}); + message.genericParameters = Object.entries(object.genericParameters ?? {}).reduce< + { [key: string]: GenericParameter } + >((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = GenericParameter.fromPartial(value); + } + return acc; + }, {}); + message.constructor = (object.constructor !== undefined && object.constructor !== null) + ? Constructor.fromPartial(object.constructor) + : undefined; + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseType_FieldsEntry(): Type_FieldsEntry { + return { key: "", value: undefined }; +} + +export const Type_FieldsEntry = { + encode(message: Type_FieldsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Field.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Type_FieldsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseType_FieldsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Field.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Type_FieldsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Field.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Type_FieldsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Field.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Type_FieldsEntry { + return Type_FieldsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Type_FieldsEntry { + const message = createBaseType_FieldsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Field.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseType_MethodsEntry(): Type_MethodsEntry { + return { key: "", value: undefined }; +} + +export const Type_MethodsEntry = { + encode(message: Type_MethodsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Function.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Type_MethodsEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseType_MethodsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Function.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Type_MethodsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Function.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Type_MethodsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Function.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Type_MethodsEntry { + return Type_MethodsEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Type_MethodsEntry { + const message = createBaseType_MethodsEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? Function.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseType_GenericParametersEntry(): Type_GenericParametersEntry { + return { key: "", value: undefined }; +} + +export const Type_GenericParametersEntry = { + encode(message: Type_GenericParametersEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + GenericParameter.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Type_GenericParametersEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseType_GenericParametersEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = GenericParameter.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Type_GenericParametersEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? GenericParameter.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Type_GenericParametersEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = GenericParameter.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Type_GenericParametersEntry { + return Type_GenericParametersEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Type_GenericParametersEntry { + const message = createBaseType_GenericParametersEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? GenericParameter.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseType_MetaEntry(): Type_MetaEntry { + return { key: "", value: undefined }; +} + +export const Type_MetaEntry = { + encode(message: Type_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Type_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseType_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Type_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Type_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Type_MetaEntry { + return Type_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Type_MetaEntry { + const message = createBaseType_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseField(): Field { + return { type: "", readonly: false, meta: {} }; +} + +export const Field = { + encode(message: Field, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.readonly === true) { + writer.uint32(16).bool(message.readonly); + } + Object.entries(message.meta).forEach(([key, value]) => { + Field_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Field { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseField(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.readonly = reader.bool(); + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Field_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Field { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + readonly: isSet(object.readonly) ? globalThis.Boolean(object.readonly) : false, + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Field): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.readonly === true) { + obj.readonly = message.readonly; + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Field { + return Field.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Field { + const message = createBaseField(); + message.type = object.type ?? ""; + message.readonly = object.readonly ?? false; + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseField_MetaEntry(): Field_MetaEntry { + return { key: "", value: undefined }; +} + +export const Field_MetaEntry = { + encode(message: Field_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Field_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseField_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Field_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Field_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Field_MetaEntry { + return Field_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Field_MetaEntry { + const message = createBaseField_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseFunction(): Function { + return { returnType: undefined, parameters: {}, genericParameters: {}, meta: {} }; +} + +export const Function = { + encode(message: Function, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.returnType !== undefined) { + Type.encode(message.returnType, writer.uint32(10).fork()).ldelim(); + } + Object.entries(message.parameters).forEach(([key, value]) => { + Function_ParametersEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim(); + }); + Object.entries(message.genericParameters).forEach(([key, value]) => { + Function_GenericParametersEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).ldelim(); + }); + Object.entries(message.meta).forEach(([key, value]) => { + Function_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Function { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.returnType = Type.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + const entry2 = Function_ParametersEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.parameters[entry2.key] = entry2.value; + } + continue; + case 3: + if (tag !== 26) { + break; + } + + const entry3 = Function_GenericParametersEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.genericParameters[entry3.key] = entry3.value; + } + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Function_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Function { + return { + returnType: isSet(object.returnType) ? Type.fromJSON(object.returnType) : undefined, + parameters: isObject(object.parameters) + ? Object.entries(object.parameters).reduce<{ [key: string]: Type }>((acc, [key, value]) => { + acc[key] = Type.fromJSON(value); + return acc; + }, {}) + : {}, + genericParameters: isObject(object.genericParameters) + ? Object.entries(object.genericParameters).reduce<{ [key: string]: GenericParameter }>((acc, [key, value]) => { + acc[key] = GenericParameter.fromJSON(value); + return acc; + }, {}) + : {}, + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Function): unknown { + const obj: any = {}; + if (message.returnType !== undefined) { + obj.returnType = Type.toJSON(message.returnType); + } + if (message.parameters) { + const entries = Object.entries(message.parameters); + if (entries.length > 0) { + obj.parameters = {}; + entries.forEach(([k, v]) => { + obj.parameters[k] = Type.toJSON(v); + }); + } + } + if (message.genericParameters) { + const entries = Object.entries(message.genericParameters); + if (entries.length > 0) { + obj.genericParameters = {}; + entries.forEach(([k, v]) => { + obj.genericParameters[k] = GenericParameter.toJSON(v); + }); + } + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Function { + return Function.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Function { + const message = createBaseFunction(); + message.returnType = (object.returnType !== undefined && object.returnType !== null) + ? Type.fromPartial(object.returnType) + : undefined; + message.parameters = Object.entries(object.parameters ?? {}).reduce<{ [key: string]: Type }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Type.fromPartial(value); + } + return acc; + }, + {}, + ); + message.genericParameters = Object.entries(object.genericParameters ?? {}).reduce< + { [key: string]: GenericParameter } + >((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = GenericParameter.fromPartial(value); + } + return acc; + }, {}); + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseFunction_ParametersEntry(): Function_ParametersEntry { + return { key: "", value: undefined }; +} + +export const Function_ParametersEntry = { + encode(message: Function_ParametersEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Type.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Function_ParametersEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunction_ParametersEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Type.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Function_ParametersEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Type.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Function_ParametersEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Type.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Function_ParametersEntry { + return Function_ParametersEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Function_ParametersEntry { + const message = createBaseFunction_ParametersEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Type.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseFunction_GenericParametersEntry(): Function_GenericParametersEntry { + return { key: "", value: undefined }; +} + +export const Function_GenericParametersEntry = { + encode(message: Function_GenericParametersEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + GenericParameter.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Function_GenericParametersEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunction_GenericParametersEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = GenericParameter.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Function_GenericParametersEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? GenericParameter.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Function_GenericParametersEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = GenericParameter.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Function_GenericParametersEntry { + return Function_GenericParametersEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): Function_GenericParametersEntry { + const message = createBaseFunction_GenericParametersEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) + ? GenericParameter.fromPartial(object.value) + : undefined; + return message; + }, +}; + +function createBaseFunction_MetaEntry(): Function_MetaEntry { + return { key: "", value: undefined }; +} + +export const Function_MetaEntry = { + encode(message: Function_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Function_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFunction_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Function_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Function_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Function_MetaEntry { + return Function_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Function_MetaEntry { + const message = createBaseFunction_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseGenericParameter(): GenericParameter { + return { modifiers: [], meta: {} }; +} + +export const GenericParameter = { + encode(message: GenericParameter, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.modifiers) { + Modifier.encode(v!, writer.uint32(10).fork()).ldelim(); + } + Object.entries(message.meta).forEach(([key, value]) => { + GenericParameter_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenericParameter { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericParameter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.modifiers.push(Modifier.decode(reader, reader.uint32())); + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = GenericParameter_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericParameter { + return { + modifiers: globalThis.Array.isArray(object?.modifiers) + ? object.modifiers.map((e: any) => Modifier.fromJSON(e)) + : [], + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: GenericParameter): unknown { + const obj: any = {}; + if (message.modifiers?.length) { + obj.modifiers = message.modifiers.map((e) => Modifier.toJSON(e)); + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): GenericParameter { + return GenericParameter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenericParameter { + const message = createBaseGenericParameter(); + message.modifiers = object.modifiers?.map((e) => Modifier.fromPartial(e)) || []; + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseGenericParameter_MetaEntry(): GenericParameter_MetaEntry { + return { key: "", value: undefined }; +} + +export const GenericParameter_MetaEntry = { + encode(message: GenericParameter_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenericParameter_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericParameter_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericParameter_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: GenericParameter_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): GenericParameter_MetaEntry { + return GenericParameter_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenericParameter_MetaEntry { + const message = createBaseGenericParameter_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseModifier(): Modifier { + return { meta: {} }; +} + +export const Modifier = { + encode(message: Modifier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.meta).forEach(([key, value]) => { + Modifier_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Modifier { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModifier(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Modifier_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Modifier { + return { + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Modifier): unknown { + const obj: any = {}; + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Modifier { + return Modifier.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Modifier { + const message = createBaseModifier(); + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseModifier_MetaEntry(): Modifier_MetaEntry { + return { key: "", value: undefined }; +} + +export const Modifier_MetaEntry = { + encode(message: Modifier_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Modifier_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModifier_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Modifier_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Modifier_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Modifier_MetaEntry { + return Modifier_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Modifier_MetaEntry { + const message = createBaseModifier_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseConstructor(): Constructor { + return { parameters: {}, meta: {} }; +} + +export const Constructor = { + encode(message: Constructor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + Object.entries(message.parameters).forEach(([key, value]) => { + Constructor_ParametersEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim(); + }); + Object.entries(message.meta).forEach(([key, value]) => { + Constructor_MetaEntry.encode({ key: key as any, value }, writer.uint32(1026).fork()).ldelim(); + }); + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Constructor { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConstructor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + const entry1 = Constructor_ParametersEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.parameters[entry1.key] = entry1.value; + } + continue; + case 128: + if (tag !== 1026) { + break; + } + + const entry128 = Constructor_MetaEntry.decode(reader, reader.uint32()); + if (entry128.value !== undefined) { + message.meta[entry128.key] = entry128.value; + } + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Constructor { + return { + parameters: isObject(object.parameters) + ? Object.entries(object.parameters).reduce<{ [key: string]: Type }>((acc, [key, value]) => { + acc[key] = Type.fromJSON(value); + return acc; + }, {}) + : {}, + meta: isObject(object.meta) + ? Object.entries(object.meta).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + acc[key] = Any.fromJSON(value); + return acc; + }, {}) + : {}, + }; + }, + + toJSON(message: Constructor): unknown { + const obj: any = {}; + if (message.parameters) { + const entries = Object.entries(message.parameters); + if (entries.length > 0) { + obj.parameters = {}; + entries.forEach(([k, v]) => { + obj.parameters[k] = Type.toJSON(v); + }); + } + } + if (message.meta) { + const entries = Object.entries(message.meta); + if (entries.length > 0) { + obj.meta = {}; + entries.forEach(([k, v]) => { + obj.meta[k] = Any.toJSON(v); + }); + } + } + return obj; + }, + + create, I>>(base?: I): Constructor { + return Constructor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Constructor { + const message = createBaseConstructor(); + message.parameters = Object.entries(object.parameters ?? {}).reduce<{ [key: string]: Type }>( + (acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Type.fromPartial(value); + } + return acc; + }, + {}, + ); + message.meta = Object.entries(object.meta ?? {}).reduce<{ [key: string]: Any }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = Any.fromPartial(value); + } + return acc; + }, {}); + return message; + }, +}; + +function createBaseConstructor_ParametersEntry(): Constructor_ParametersEntry { + return { key: "", value: undefined }; +} + +export const Constructor_ParametersEntry = { + encode(message: Constructor_ParametersEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Type.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Constructor_ParametersEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConstructor_ParametersEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Type.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Constructor_ParametersEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Type.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Constructor_ParametersEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Type.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Constructor_ParametersEntry { + return Constructor_ParametersEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Constructor_ParametersEntry { + const message = createBaseConstructor_ParametersEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Type.fromPartial(object.value) : undefined; + return message; + }, +}; + +function createBaseConstructor_MetaEntry(): Constructor_MetaEntry { + return { key: "", value: undefined }; +} + +export const Constructor_MetaEntry = { + encode(message: Constructor_MetaEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + Any.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Constructor_MetaEntry { + const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConstructor_MetaEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): Constructor_MetaEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Any.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: Constructor_MetaEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== undefined) { + obj.value = Any.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): Constructor_MetaEntry { + return Constructor_MetaEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Constructor_MetaEntry { + const message = createBaseConstructor_MetaEntry(); + message.key = object.key ?? ""; + message.value = (object.value !== undefined && object.value !== null) ? Any.fromPartial(object.value) : undefined; return message; }, }; diff --git a/package.json b/package.json index 78846d47..b1a302dc 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,7 @@ "packageManager": "bun@1.1.5", "workspaces": [ "gen/proto/*", - "packages/*", - "src/*" + "packages/*" ], "scripts": { "lint": "eslint" diff --git a/packages/Makefile b/packages/Makefile index 56a8d252..8a3ed0d0 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -1,5 +1,30 @@ -build: +.PHONY: build build_ts build_uml build_uml2ts +build: build_ts build_uml build_uml2ts + +build_ts: cd ts && bun run build +build_uml: + cd uml && bun run build + +build_uml2ts: + cd uml2ts && bun run build + +test: + bun test . + +.PHONY: clean clean_ts clean_uml clean_uml2ts +clean: clean_ts clean_uml clean_uml2ts + +clean_ts: + cd ts && bun clean + +clean_uml: + cd uml && bun clean + +clean_uml2ts: + cd uml2ts && bun clean + +.PHONY: lint lint: - cd ts && bun lint + bun eslint . diff --git a/packages/ts/converter.ts b/packages/ts/converter.ts new file mode 100644 index 00000000..bf256004 --- /dev/null +++ b/packages/ts/converter.ts @@ -0,0 +1,12 @@ +import * as tdl from '@unmango/tdl-ts'; +import * as uml from '@unmango/uml'; +import { Readable, Writable } from 'node:stream'; + +export class Converter implements uml.Converter { + from(reader: Readable): Promise { + throw new Error('Method not implemented.'); + } + to(spec: tdl.Spec, writer: Writable): Promise { + throw new Error('Method not implemented.'); + } +} diff --git a/packages/ts/generator.spec.ts b/packages/ts/generator.spec.ts new file mode 100644 index 00000000..d6708c3e --- /dev/null +++ b/packages/ts/generator.spec.ts @@ -0,0 +1,33 @@ +import * as tdl from '@unmango/tdl-es'; +import { describe, expect, it } from 'bun:test'; +import { generator } from '.'; + +describe('Generator', () => { + it('should work', async () => { + const spec = new tdl.Spec({ + name: 'test-name', + description: 'Some description', + displayName: 'Test Name', + source: 'https://github.com/UnstoppableMango/tdl', + labels: { + test: 'label', + }, + types: { + 'test': { + type: 'string', + fields: { + test: { + type: 'string', + }, + }, + }, + }, + version: '0.1.0', + }); + + const actual = await generator.gen(spec); + + expect(actual).not.toBeNull(); + expect(actual).toEqual(`export interface test {\n readonly test: string;\n}\n`); + }); +}); diff --git a/packages/ts/generator.ts b/packages/ts/generator.ts new file mode 100644 index 00000000..78a5127e --- /dev/null +++ b/packages/ts/generator.ts @@ -0,0 +1,40 @@ +import * as tdl from '@unmango/tdl-es'; +import * as uml from '@unmango/uml'; +import ts from 'typescript'; + +export class Generator implements uml.Generator { + gen(spec: tdl.Spec): Promise { + const source = ts.createSourceFile('types.d.ts', '', ts.ScriptTarget.ES2019, undefined, ts.ScriptKind.TS); + const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); + const result = printer.printList(ts.ListFormat.MultiLine, gen(spec), source); + return Promise.resolve(result); + } +} + +function gen(spec: tdl.Spec): ts.NodeArray { + const types = Object.entries(spec.types).map(x => genType(...x)); + return ts.factory.createNodeArray(types); +} + +function genType(name: string, type: tdl.Type): ts.Node { + const props = Object.entries(type.fields).map(x => genProps(...x)); + + return ts.factory.createInterfaceDeclaration( + [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)], + name, + undefined, + undefined, + props, + ); +} + +function genProps(name: string, field: tdl.Field): ts.PropertySignature { + const type = ts.factory.createTypeReferenceNode(field.type); + + return ts.factory.createPropertySignature( + [ts.factory.createModifier(ts.SyntaxKind.ReadonlyKeyword)], + name, + undefined, + type, + ); +} diff --git a/packages/ts/index.ts b/packages/ts/index.ts index 9dbac40f..6d5d14cf 100644 --- a/packages/ts/index.ts +++ b/packages/ts/index.ts @@ -1,39 +1,5 @@ -import { Command } from '@commander-js/extra-typings'; -import { createPromiseClient } from '@connectrpc/connect'; -import { createGrpcTransport } from '@connectrpc/connect-node'; -import { UmlService } from '@unmango/tdl-es'; -import * as net from 'node:net'; -import { name, version } from './package.json'; +import { Converter } from './converter'; +import { Generator } from './generator'; -const program = new Command() - .name(name) - .description('Plugin to convert UML to typescript.') - .version(version) - .helpOption() - .argument('', 'The thing to do the stuff with') - .option('--broker ', 'address of the broker'); - -program.parse(process.argv); -const opts = program.opts(); - -if (!opts.broker) { - throw new Error('Broker URI is required'); -} - -const transport = createGrpcTransport({ - httpVersion: '2', - baseUrl: opts.broker, - nodeOptions: { - createConnection() { - if (!opts.broker) { - throw new Error('Broker URI is required'); - } - - return net.connect(opts.broker); - }, - }, -}); - -const client = createPromiseClient(UmlService, transport); -// const result = await client.from({ }); -// console.log(result.uml); +export const converter = new Converter(); +export const generator = new Generator(); diff --git a/packages/ts/package.json b/packages/ts/package.json index f76c9cdd..abe6475a 100644 --- a/packages/ts/package.json +++ b/packages/ts/package.json @@ -1,21 +1,17 @@ { "name": "@unmango/2ts", - "version": "0.1.0", "module": "index.ts", "type": "module", "scripts": { - "build": "bun build index.ts --compile --outfile dist/app", + "build": "bun build index.ts --outdir dist", + "clean": "rm -rf dist", "lint": "eslint .", - "lint:fix": "eslint . --fix", - "prestart": "cd ../../../ && make gen", - "start": "bun run index.ts --help" + "lint:fix": "eslint . --fix" }, "dependencies": { - "@commander-js/extra-typings": "^12.0.1", - "@connectrpc/connect": "^1.4.0", - "@connectrpc/connect-node": "^1.4.0", - "typescript": "^5.4.5", - "@unmango/tdl-es": "workspace:*" + "@unmango/uml": "workspace:*", + "@unmango/tdl-es": "workspace:*", + "typescript": "5.4.5" }, "devDependencies": { "@types/bun": "latest" diff --git a/packages/ts/tsconfig.json b/packages/ts/tsconfig.json index b361441c..ffc08abf 100644 --- a/packages/ts/tsconfig.json +++ b/packages/ts/tsconfig.json @@ -1,3 +1,27 @@ { - "extends": "../../tsconfig.base.json" + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/packages/uml/README.md b/packages/uml/README.md new file mode 100644 index 00000000..ec2cec19 --- /dev/null +++ b/packages/uml/README.md @@ -0,0 +1,15 @@ +# @unmango/uml + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run index.ts +``` + +This project was created using `bun init` in bun v1.1.5. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/packages/uml/index.spec.ts b/packages/uml/index.spec.ts new file mode 100644 index 00000000..06e32629 --- /dev/null +++ b/packages/uml/index.spec.ts @@ -0,0 +1,42 @@ +import { Spec } from '@unmango/tdl-es'; +import { describe, expect, it } from 'bun:test'; +import fc from 'fast-check'; +import { read, type SupportedMimeType } from './index'; + +const arbSpec = () => + fc.gen().map(g => + new Spec({ + name: g(fc.string), + description: g(fc.string), + displayName: g(fc.string), + source: g(fc.string), + version: g(fc.string), + }) + ); + +describe('read', () => { + it.each([ + 'application/protobuf', + 'application/x-protobuf', + 'application/vnd.google.protobuf', + ])('should read %s data', (type) => { + fc.assert(fc.property(arbSpec(), (spec): void => { + const bytes = spec.toBinary(); + + const actual = read(bytes, type); + + expect(actual).toEqual(spec); + })); + }); + + it('should read json data', () => { + fc.assert(fc.property(arbSpec(), (spec): void => { + const json = spec.toJsonString(); + const bytes = Buffer.from(json, 'utf-8'); + + const actual = read(bytes, 'application/json'); + + expect(actual).toEqual(spec); + })); + }); +}); diff --git a/packages/uml/index.ts b/packages/uml/index.ts new file mode 100644 index 00000000..d7da1ac6 --- /dev/null +++ b/packages/uml/index.ts @@ -0,0 +1,45 @@ +import * as tdl from '@unmango/tdl-es'; +import { Readable, Writable } from 'node:stream'; + +export interface ConverterFrom { + from(reader: Readable): Promise; +} + +export interface ConverterTo { + to(spec: tdl.Spec, writer: Writable): Promise; +} + +export interface Converter extends ConverterFrom, ConverterTo {} + +export interface Generator { + gen(spec: tdl.Spec): Promise; +} + +export const SUPPORTED_MIME_TYPES = [ + 'application/json', + 'application/x-protobuf', + 'application/protobuf', + 'application/vnd.google.protobuf', +] as const; + +export type SupportedMimeTypeTuple = typeof SUPPORTED_MIME_TYPES; +export type SupportedMimeType = SupportedMimeTypeTuple[number]; + +export function read(data: Uint8Array, type?: SupportedMimeType): tdl.Spec { + switch (type) { + case 'application/json': { + const decoder = new TextDecoder(); + const json = decoder.decode(data); + return tdl.Spec.fromJsonString(json); + } + case 'application/x-protobuf': + case 'application/protobuf': + case 'application/vnd.google.protobuf': + return tdl.Spec.fromBinary(data); + case undefined: + case null: + return tdl.Spec.fromBinary(data); + default: + throw new Error('unrecognized media type'); + } +} diff --git a/packages/uml/package.json b/packages/uml/package.json new file mode 100644 index 00000000..4c0977ff --- /dev/null +++ b/packages/uml/package.json @@ -0,0 +1,23 @@ +{ + "name": "@unmango/uml", + "type": "module", + "module": "index.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "bun build index.ts --outdir dist", + "clean": "rm -rf dist", + "lint": "eslint .", + "lint:fix": "eslint . --fix" + }, + "dependencies": { + "@unmango/tdl-es": "workspace:*" + }, + "devDependencies": { + "@types/bun": "latest", + "fast-check": "^3.18.0" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/packages/uml/tsconfig.json b/packages/uml/tsconfig.json new file mode 100644 index 00000000..b361441c --- /dev/null +++ b/packages/uml/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.base.json" +} diff --git a/packages/uml2ts/Makefile b/packages/uml2ts/Makefile new file mode 100644 index 00000000..0bddb3ef --- /dev/null +++ b/packages/uml2ts/Makefile @@ -0,0 +1,18 @@ +ROOT := $(shell git rev-parse --show-toplevel) + +.PHONY: build test clean docker + +build: + bun run build + +test: + bun test + +clean: + rm -rf dist + +docker: + @$(MAKE) -C ${ROOT}/docker uml2ts + +test_image: + @$(MAKE) -C ${ROOT}/docker uml2ts_test diff --git a/packages/uml2ts/README.md b/packages/uml2ts/README.md new file mode 100644 index 00000000..cd696126 --- /dev/null +++ b/packages/uml2ts/README.md @@ -0,0 +1,15 @@ +# @unmango/2ts + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run index.ts +``` + +This project was created using `bun init` in bun v1.1.5. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/packages/uml2ts/command.spec.ts b/packages/uml2ts/command.spec.ts new file mode 100644 index 00000000..48584e09 --- /dev/null +++ b/packages/uml2ts/command.spec.ts @@ -0,0 +1,65 @@ +import { Spec } from '@unmango/tdl-es'; +import type { SupportedMimeType } from '@unmango/uml'; +import { afterAll, beforeAll, describe, expect, it } from 'bun:test'; +import fs from 'node:fs/promises'; +import path from 'node:path'; + +const binPath = path.join( + __dirname, + 'dist', + 'uml2ts_test', +); + +const ensureClean = async () => { + if (await fs.exists(binPath)) { + await fs.unlink(binPath); + } +}; + +beforeAll(async () => { + await ensureClean(); + const proc = Bun.spawn([ + 'bun', + 'build', + 'index.ts', + '--compile', + '--outfile', + binPath, + ], { cwd: __dirname }); + await proc.exited; +}); + +afterAll(ensureClean); + +describe('gen', () => { + it.each([ + 'application/protobuf', + 'application/x-protobuf', + 'application/vnd.google.protobuf', + ])('should read %s data', async (mime) => { + const name = 'testType'; + const spec = new Spec({ types: { [name]: {} } }); + const bytes = spec.toBinary(); + + const proc = Bun.spawn([binPath, 'gen', '--type', mime], { + stdin: new Blob([bytes]), + }); + + const actual = await Bun.readableStreamToText(proc.stdout); + expect(actual).toEqual(`export interface ${name} {\n}\n`); + }); + + it('should read json data', async () => { + const name = 'testType'; + const spec = new Spec({ types: { [name]: {} } }); + const json = spec.toJsonString(); + const mime: SupportedMimeType = 'application/json'; + + const proc = Bun.spawn([binPath, 'gen', '--type', mime], { + stdin: Buffer.from(json, 'utf-8'), + }); + + const actual = await Bun.readableStreamToText(proc.stdout); + expect(actual).toEqual(`export interface ${name} {\n}\n`); + }); +}); diff --git a/packages/uml2ts/command.ts b/packages/uml2ts/command.ts new file mode 100644 index 00000000..7aaa2ed8 --- /dev/null +++ b/packages/uml2ts/command.ts @@ -0,0 +1,9 @@ +import { generator } from '@unmango/2ts'; +import * as uml from '@unmango/uml'; + +export async function gen(type?: uml.SupportedMimeType): Promise { + const buffer = await Bun.stdin.arrayBuffer(); + const spec = uml.read(new Uint8Array(buffer), type); + const ts = await generator.gen(spec); + await Bun.write(Bun.stdout, ts); +} diff --git a/packages/uml2ts/index.ts b/packages/uml2ts/index.ts new file mode 100644 index 00000000..5cc9d6dc --- /dev/null +++ b/packages/uml2ts/index.ts @@ -0,0 +1,10 @@ +import type { Command } from '@commander-js/extra-typings'; +import { gen, program } from './program'; + +type ApplyCommand = (c: Command) => Command; + +const app = (root: () => Command, ...commands: ApplyCommand[]) => { + return commands.reduce((x, c) => c(x), root()); +}; + +await app(program, gen).parseAsync(); diff --git a/packages/uml2ts/package.json b/packages/uml2ts/package.json new file mode 100644 index 00000000..60a75a61 --- /dev/null +++ b/packages/uml2ts/package.json @@ -0,0 +1,29 @@ +{ + "name": "@unmango/uml2ts", + "version": "0.1.0", + "module": "index.ts", + "type": "module", + "scripts": { + "build": "bun build index.ts --compile --outfile dist/uml2ts", + "clean": "rm -rf dist", + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "start": "bun run index.ts --help", + "test": "bun test" + }, + "dependencies": { + "@commander-js/extra-typings": "^12.0.1", + "@connectrpc/connect": "^1.4.0", + "@connectrpc/connect-node": "^1.4.0", + "@unmango/tdl-es": "workspace:*", + "@unmango/2ts": "workspace:*" + }, + "devDependencies": { + "@types/bun": "latest", + "fast-check": "^3.18.0", + "testcontainers": "^10.9.0" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } +} diff --git a/packages/uml2ts/program.ts b/packages/uml2ts/program.ts new file mode 100644 index 00000000..94f2f6ea --- /dev/null +++ b/packages/uml2ts/program.ts @@ -0,0 +1,20 @@ +import { Command, Option } from '@commander-js/extra-typings'; +import * as uml from '@unmango/uml'; +import * as cmd from './command'; +import { name, version } from './package.json'; + +const mimeTypeOption = new Option('--type ', 'The media type of the input.') + .choices(uml.SUPPORTED_MIME_TYPES); + +export const gen = (program: Command): Command => + program.command('gen') + .description('Generate typescript.') + .addOption(mimeTypeOption) + .action((opts) => cmd.gen(opts.type)); + +export const program = (): Command => + new Command() + .name(name) + .description('Plugin to convert UML to typescript.') + .version(version) + .helpOption(); diff --git a/packages/uml2ts/tsconfig.json b/packages/uml2ts/tsconfig.json new file mode 100644 index 00000000..b361441c --- /dev/null +++ b/packages/uml2ts/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig.base.json" +} diff --git a/pkg/pcl/convert.go b/pkg/pcl/convert.go index 170a81ef..9e59e60b 100644 --- a/pkg/pcl/convert.go +++ b/pkg/pcl/convert.go @@ -3,6 +3,7 @@ package pcl import ( "context" "io" + "strings" "github.com/pulumi/pulumi/pkg/v3/codegen/schema" tdl "github.com/unstoppablemango/tdl/gen/proto/go/unmango/dev/tdl/v1alpha1" @@ -28,11 +29,13 @@ func (c *converter) From(ctx context.Context, reader io.Reader, opts ...uml.Conv func (c *converter) FromPcl(ctx context.Context, pcl schema.PackageSpec) (*tdl.Spec, error) { spec := tdl.Spec{ Name: pcl.Name, - Repository: pcl.Repository, + Source: pcl.Repository, Version: pcl.Version, DisplayName: pcl.DisplayName, Description: pcl.Description, - Tags: pcl.Keywords, + Labels: map[string]string{ + "keywords": strings.Join(pcl.Keywords, ","), + }, } return &spec, nil diff --git a/pkg/pcl/convert_test.go b/pkg/pcl/convert_test.go index 8a1fc067..4c4122f6 100644 --- a/pkg/pcl/convert_test.go +++ b/pkg/pcl/convert_test.go @@ -21,7 +21,7 @@ var _ = Describe("Convert", func() { Description: "test-description", DisplayName: "Test Name", Repository: "github.com/UnstoppableMango/tdl", - Keywords: []string{"pulumi"}, + Keywords: []string{"pulumi", "thing"}, Version: "v0.1.0", } @@ -38,11 +38,11 @@ var _ = Describe("Convert", func() { Expect(spec.DisplayName).NotTo(BeEmpty()) Expect(spec.DisplayName).To(Equal(pcl.DisplayName)) - Expect(spec.Repository).NotTo(BeEmpty()) - Expect(spec.Repository).To(Equal(pcl.Repository)) + Expect(spec.Source).NotTo(BeEmpty()) + Expect(spec.Source).To(Equal(pcl.Repository)) - Expect(spec.Tags).NotTo(BeEmpty()) - Expect(spec.Tags).To(BeEquivalentTo(pcl.Keywords)) + Expect(spec.Labels).NotTo(BeEmpty()) + Expect(spec.Labels["keywords"]).To(BeEquivalentTo("pulumi,thing")) Expect(spec.Version).NotTo(BeEmpty()) Expect(spec.Version).To(Equal(pcl.Version)) diff --git a/proto/buf.lock b/proto/buf.lock new file mode 100644 index 00000000..1b0eba1c --- /dev/null +++ b/proto/buf.lock @@ -0,0 +1,8 @@ +# Generated by buf. DO NOT EDIT. +version: v1 +deps: + - remote: buf.build + owner: googleapis + repository: googleapis + commit: 4ed3bc159a8b4ac68fe253218760d035 + digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13 diff --git a/proto/buf.yaml b/proto/buf.yaml index efae92df..c521254a 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,5 +1,7 @@ version: v1 -name: github.com/unstoppablemango/tdl +# name: github.com/unstoppablemango/tdl +deps: + - buf.build/googleapis/googleapis breaking: use: - FILE diff --git a/proto/unmango/dev/tdl/v1alpha1/uml.proto b/proto/unmango/dev/tdl/v1alpha1/uml.proto index 845ca592..22a310b3 100644 --- a/proto/unmango/dev/tdl/v1alpha1/uml.proto +++ b/proto/unmango/dev/tdl/v1alpha1/uml.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package unmango.dev.tdl.v1alpha1; +import "google/protobuf/any.proto"; + option csharp_namespace = "UnMango.Tdl"; service UmlService { @@ -36,14 +38,48 @@ message ToResponse { message Spec { string name = 1; - string repository = 2; + string source = 2; string version = 3; string display_name = 4; string description = 5; - repeated string tags = 6; + map labels = 6; map types = 7; + map functions = 8; + map meta = 128; } message Type { - string name = 1; + string type = 1; + map fields = 2; + map methods = 3; + map generic_parameters = 4; + optional Constructor constructor = 5; + map meta = 128; +} + +message Field { + string type = 1; + bool readonly = 2; + map meta = 128; +} + +message Function { + Type return_type = 1; + map parameters = 2; + map generic_parameters = 3; + map meta = 128; +} + +message GenericParameter { + repeated Modifier modifiers = 1; + map meta = 128; +} + +message Modifier { + map meta = 128; +} + +message Constructor { + map parameters = 1; + map meta = 128; }