Skip to content

Commit

Permalink
Other: Use typedefs in ext/descriptor (like everywhere else), see #757
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Apr 13, 2017
1 parent b9f1790 commit 2a30df8
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 100 deletions.
2 changes: 1 addition & 1 deletion ext/descriptor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var buffer = descriptor.FileDescriptorSet.encode(fileDescriptorSet).finish();
var decoded = descriptor.FileDescriptorSet.decode(buffer);

// convert it back to a protobuf.js root
root = protobuf.Root.fromDescriptor(decoded, "proto2");
root = protobuf.Root.fromDescriptor(decoded);

// and start all over again
```
Expand Down
98 changes: 49 additions & 49 deletions ext/descriptor/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,107 +1,107 @@
import * as $protobuf from "../..";

export interface IFileDescriptorSet {
file: IFileDescriptorProto[];
}
type FileDescriptorSetProperties = {
file: FileDescriptorProtoProperties[];
};

export interface IFileDescriptorProto {
type FileDescriptorProtoProperties = {
name?: string;
package?: string;
dependency?: any;
publicDependency?: any;
weakDependency?: any;
messageType?: IDescriptorProto[];
enumType?: IEnumDescriptorProto[];
service?: IServiceDescriptorProto[];
extension?: IFieldDescriptorProto[];
messageType?: DescriptorProtoProperties[];
enumType?: EnumDescriptorProtoProperties[];
service?: ServiceDescriptorProtoProperties[];
extension?: FieldDescriptorProtoProperties[];
options?: any;
sourceCodeInfo?: any;
syntax?: string;
}
};

export interface IDescriptorProto {
type DescriptorProtoProperties = {
name?: string;
field?: IFieldDescriptorProto[];
extension?: IFieldDescriptorProto[];
nestedType?: IDescriptorProto[];
enumType?: IEnumDescriptorProto[];
extensionRange?: IExtensionRange[];
oneofDecl?: IOneofDescriptorProto[];
options?: IMessageOptions;
reservedRange?: IReservedRange[];
field?: FieldDescriptorProtoProperties[];
extension?: FieldDescriptorProtoProperties[];
nestedType?: DescriptorProtoProperties[];
enumType?: EnumDescriptorProtoProperties[];
extensionRange?: ExtensionRangeProperties[];
oneofDecl?: OneofDescriptorProtoProperties[];
options?: MessageOptionsProperties;
reservedRange?: ReservedRangeProperties[];
reservedName?: string[];
}
};

export interface IMessageOptions {
type MessageOptionsProperties = {
mapEntry?: boolean;
}
};

export interface IExtensionRange {
type ExtensionRangeProperties = {
start?: number;
end?: number;
}
};

export interface IReservedRange {
type ReservedRangeProperties = {
start?: number;
end?: number;
}
};

export interface IFieldOptions {
type FieldOptionsProperties = {
packed?: boolean;
}
};

export interface IFieldDescriptorProto {
type FieldDescriptorProtoProperties = {
name?: string;
number?: number;
label?: IFieldDescriptorProto_Label;
type?: IFieldDescriptorProto_Type;
label?: FieldDescriptorProtoLabel;
type?: FieldDescriptorProtoType;
typeName?: string;
extendee?: string;
defaultValue?: any;
oneofIndex?: number;
jsonName?: any;
options?: IFieldOptions;
}
options?: FieldOptionsProperties;
};

type IFieldDescriptorProto_Label = number;
type FieldDescriptorProtoLabel = number;

type IFieldDescriptorProto_Type = number;
type FieldDescriptorProtoType = number;

export interface IEnumDescriptorProto {
type EnumDescriptorProtoProperties = {
name?: string;
value?: IEnumValueDescriptorProto[];
options?: IEnumOptions;
}
value?: EnumValueDescriptorProtoProperties[];
options?: EnumOptionsProperties;
};

export interface IEnumValueDescriptorProto {
type EnumValueDescriptorProtoProperties = {
name?: string;
number?: number;
options?: any;
}
};

export interface IEnumOptions {
type EnumOptionsProperties = {
allowAlias?: boolean;
}
};

export interface IOneofDescriptorProto {
type OneofDescriptorProtoProperties = {
name?: string;
options?: any;
}
};

export interface IServiceDescriptorProto {
type ServiceDescriptorProtoProperties = {
name?: string;
method?: IMethodDescriptorProto[];
method?: MethodDescriptorProtoProperties[];
options?: any;
}
};

export interface IMethodDescriptorProto {
type MethodDescriptorProtoProperties = {
name?: string;
inputType?: string;
outputType?: string;
options?: any;
clientStreaming?: boolean;
serverStreaming?: boolean;
}
};
export const FileDescriptorSet: $protobuf.Type;
export const FileDescriptorProto: $protobuf.Type;
export const DescriptorProto: $protobuf.Type;
Expand Down
Loading

0 comments on commit 2a30df8

Please sign in to comment.