Update example, remove strict types
This commit is contained in:
parent
47277242ae
commit
b3b9aec439
@ -5,108 +5,109 @@ import base64 from 'base64-js'
|
|||||||
import test_pb from './test_pb'
|
import test_pb from './test_pb'
|
||||||
|
|
||||||
|
|
||||||
export type TestEnum = {|
|
export type TestEnum = {
|
||||||
ELEMENT_A?: 0;
|
ELEMENT_A?: 0;
|
||||||
ELEMENT_B?: 1;
|
ELEMENT_B?: 1;
|
||||||
|};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type TestMessage$TestNestedEnum = {
|
||||||
|
ELEMENT_C?: 0;
|
||||||
|
ELEMENT_D?: 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type TestMessage$TestNestedMessage = {
|
||||||
|
s?: string;
|
||||||
|
t?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TestMessage = {
|
||||||
|
a?: string;
|
||||||
|
b?: number;
|
||||||
|
c?: number;
|
||||||
|
d?: number;
|
||||||
|
e?: number;
|
||||||
|
n?: Array<string>;
|
||||||
|
o?: Array<number>;
|
||||||
|
p?: Array<number>;
|
||||||
|
q?: Array<number>;
|
||||||
|
r?: Array<number>;
|
||||||
|
u?: TestEnum;
|
||||||
|
v?: TestMessage$TestNestedEnum;
|
||||||
|
w?: Array<TestMessage$TestNestedMessage>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestMessage$TestNestedEnum = {|
|
export type TestNoStreamRequest = {
|
||||||
ELEMENT_C?: 0;
|
message?: TestMessage;
|
||||||
ELEMENT_D?: 1;
|
};
|
||||||
|};
|
|
||||||
|
|
||||||
|
|
||||||
export type TestMessage$TestNestedMessage = {|
|
|
||||||
s?: string;
|
|
||||||
t?: number;
|
|
||||||
|};
|
|
||||||
|
|
||||||
export type TestMessage = {|
|
|
||||||
a?: string;
|
|
||||||
b?: number;
|
|
||||||
c?: number;
|
|
||||||
d?: number;
|
|
||||||
e?: number;
|
|
||||||
n?: Array<string>;
|
|
||||||
o?: Array<number>;
|
|
||||||
p?: Array<number>;
|
|
||||||
q?: Array<number>;
|
|
||||||
r?: Array<number>;
|
|
||||||
u?: TestEnum;
|
|
||||||
v?: TestMessage$TestNestedEnum;
|
|
||||||
w?: Array<TestMessage$TestNestedMessage>;
|
|
||||||
|};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestNoStreamRequest = {|
|
|
||||||
message?: TestMessage;
|
export type TestNoStreamReply = {
|
||||||
|};
|
message?: TestMessage;
|
||||||
|
err_msg?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestNoStreamReply = {|
|
|
||||||
message?: TestMessage;
|
export type TestStreamRequestRequest = {
|
||||||
err_msg?: string;
|
message?: TestMessage;
|
||||||
|};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestStreamRequestRequest = {|
|
|
||||||
message?: TestMessage;
|
export type TestStreamRequestReply = {
|
||||||
|};
|
message?: TestMessage;
|
||||||
|
err_msg?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestStreamRequestReply = {|
|
|
||||||
message?: TestMessage;
|
export type TestStreamReplyRequest = {
|
||||||
err_msg?: string;
|
message?: TestMessage;
|
||||||
|};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestStreamReplyRequest = {|
|
|
||||||
message?: TestMessage;
|
export type TestStreamReplyReply = {
|
||||||
|};
|
message?: TestMessage;
|
||||||
|
err_msg?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestStreamReplyReply = {|
|
|
||||||
message?: TestMessage;
|
export type TestStreamBothRequest = {
|
||||||
err_msg?: string;
|
message?: TestMessage;
|
||||||
|};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export type TestStreamBothRequest = {|
|
|
||||||
message?: TestMessage;
|
|
||||||
|};
|
|
||||||
|
|
||||||
|
export type TestStreamBothReply = {
|
||||||
|
message?: TestMessage;
|
||||||
|
err_msg?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const serializeToBase64 = (byteArray: Uint8Array): string => base64.fromByteArray(byteArray)
|
||||||
|
const deserializeFromBase64 = (base64Encoded: string): Uint8Array => new Uint8Array(base64.toByteArray(base64Encoded))
|
||||||
export type TestStreamBothReply = {|
|
|
||||||
message?: TestMessage;
|
|
||||||
err_msg?: string;
|
|
||||||
|};
|
|
||||||
|
|
||||||
|
|
||||||
const serializeToBase64 = (byteArray: Uint8Array): string =>
|
|
||||||
base64.fromByteArray(byteArray)
|
|
||||||
|
|
||||||
const deserializeFromBase64 = (base64Encoded: string): Uint8Array =>
|
|
||||||
new Uint8Array(base64.toByteArray(base64Encoded))
|
|
||||||
|
|
||||||
|
|
||||||
function serialize_test_TestNoStreamRequest(arg : TestNoStreamRequest): string {
|
function serialize_test_TestNoStreamRequest(arg : TestNoStreamRequest): string {
|
||||||
|
@ -1,32 +1,49 @@
|
|||||||
// @flow
|
// @flow
|
||||||
// GENERATED CODE -- DO NOT EDIT!
|
// GENERATED CODE -- DO NOT EDIT!
|
||||||
{{$Package:=.File.Package}}
|
|
||||||
|
{{- $Package:=.File.Package}}
|
||||||
|
|
||||||
import base64 from 'base64-js'
|
import base64 from 'base64-js'
|
||||||
import {{$Package}}_pb from './{{$Package}}_pb'{{range .File.Dependency}}
|
import {{$Package}}_pb from './{{$Package}}_pb'
|
||||||
import {{. | replace "/" "_" | trimSuffix ".proto" }}_pb from '../{{. | trimSuffix ".proto" }}_pb'{{end}}
|
|
||||||
|
{{- range .File.Dependency}}
|
||||||
|
import {{. | replace "/" "_" | trimSuffix ".proto" }}_pb from '../{{. | trimSuffix ".proto" }}_pb'
|
||||||
|
{{- end}}
|
||||||
|
|
||||||
{{range .File.EnumType}}
|
{{range .File.EnumType}}
|
||||||
export type {{.Name}} = {|{{range .Value}}
|
export type {{.Name}} = {
|
||||||
{{.Name}}?: {{.Number}};{{end}}
|
{{- range .Value}}
|
||||||
|};
|
{{.Name}}?: {{.Number}};
|
||||||
{{end}}
|
{{- end}}
|
||||||
|
};
|
||||||
|
{{- end}}
|
||||||
|
|
||||||
|
{{- range .File.MessageType}}
|
||||||
|
{{- $MessageType := .Name}}
|
||||||
|
|
||||||
{{range .File.MessageType}}
|
|
||||||
{{$MessageType := .Name}}
|
|
||||||
{{range .EnumType}}
|
{{range .EnumType}}
|
||||||
export type {{$MessageType}}${{.Name}} = {|{{range .Value}}
|
export type {{$MessageType}}${{.Name}} = {
|
||||||
{{.Name}}?: {{.Number}};{{end}}
|
{{- range .Value}}
|
||||||
|};
|
{{.Name}}?: {{.Number}};
|
||||||
{{end}}
|
{{- end}}
|
||||||
|
};
|
||||||
|
{{- end}}
|
||||||
|
|
||||||
{{range .NestedType}}
|
{{range .NestedType}}
|
||||||
export type {{$MessageType}}${{.Name}} = {|{{range .Field}}
|
export type {{$MessageType}}${{.Name}} = {
|
||||||
{{.Name}}?: {{. | jsType}};{{end}}
|
{{- range .Field}}
|
||||||
|};
|
{{.Name}}?: {{. | jsType}};
|
||||||
{{end}}
|
{{- end}}
|
||||||
export type {{.Name}} = {|{{range .Field}}
|
};
|
||||||
{{.Name}}?: {{. | jsType}};{{end}}
|
{{- end}}
|
||||||
|};
|
|
||||||
{{end}}
|
export type {{.Name}} = {
|
||||||
|
{{- range .Field}}
|
||||||
|
{{.Name}}?: {{. | jsType}};
|
||||||
|
{{- end}}
|
||||||
|
};
|
||||||
|
|
||||||
|
{{- end}}
|
||||||
|
|
||||||
const serializeToBase64 = (byteArray: Uint8Array): string => base64.fromByteArray(byteArray)
|
const serializeToBase64 = (byteArray: Uint8Array): string => base64.fromByteArray(byteArray)
|
||||||
const deserializeFromBase64 = (base64Encoded: string): Uint8Array => new Uint8Array(base64.toByteArray(base64Encoded))
|
const deserializeFromBase64 = (base64Encoded: string): Uint8Array => new Uint8Array(base64.toByteArray(base64Encoded))
|
||||||
|
Loading…
Reference in New Issue
Block a user