mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into rename-repo-url
This commit is contained in:
Vendored
+45
-45
@@ -5,10 +5,10 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module ProtoBuf {
|
||||
declare namespace ProtoBuf {
|
||||
// ==========
|
||||
// protobufjs/src/ProtoBuf.js
|
||||
|
||||
|
||||
var Builder: Builder;
|
||||
var ByteBuffer: Buffer;
|
||||
var Long: LongStatic;
|
||||
@@ -17,23 +17,23 @@ declare module ProtoBuf {
|
||||
|
||||
// var Lang: Lang; TODO: implement interface Lang
|
||||
// var Util: Util; TODO: implement interface Util
|
||||
|
||||
|
||||
export function loadJson(json: string, builder?: ProtoBuilder,
|
||||
filename?: string): ProtoBuilder;
|
||||
|
||||
|
||||
export function loadJsonFile(filename: string,
|
||||
callback?: (error: any, builder: ProtoBuilder) => void,
|
||||
builder?: ProtoBuilder): ProtoBuilder;
|
||||
|
||||
|
||||
export function loadProto(proto: string, builder?: ProtoBuilder,
|
||||
filename?: string): ProtoBuilder;
|
||||
|
||||
|
||||
export function loadProtoFile(filePath: string,
|
||||
callback?: (error: any, builder: ProtoBuilder) => void,
|
||||
builder?: ProtoBuilder): ProtoBuilder;
|
||||
|
||||
|
||||
export function newBuilder(options?: {[key: string]: any}): ProtoBuilder;
|
||||
|
||||
|
||||
export interface LongStatic {
|
||||
new(low?: number, high?: number, unsigned?:boolean): Long;
|
||||
|
||||
@@ -97,10 +97,10 @@ declare module ProtoBuf {
|
||||
toUnsigned(): Long;
|
||||
xor(other: Long | number | string): Long;
|
||||
}
|
||||
|
||||
|
||||
// ==========
|
||||
// protobufjs/src/ProtoBuf/Builder.js
|
||||
|
||||
|
||||
export interface Builder {
|
||||
new(options?: {[key: string]: any}): ProtoBuilder;
|
||||
Message: Message;
|
||||
@@ -111,7 +111,7 @@ declare module ProtoBuf {
|
||||
isValidService(def: {[key: string]: any}): boolean;
|
||||
isValidExtend(def: {[key: string]: any}): boolean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Confirm that message needs no further implementation
|
||||
*/
|
||||
@@ -119,18 +119,18 @@ declare module ProtoBuf {
|
||||
new(values?: {[key: string]: any}, var_args?: string[]): Message;
|
||||
[field: string]: any;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Implement service interface
|
||||
*/
|
||||
export interface Service {
|
||||
new(rpcImpl?: Function): Service;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ==========
|
||||
// meta objects for constructing protobufs
|
||||
|
||||
|
||||
export interface ProtoBuilder {
|
||||
ns: ReflectNamespace;
|
||||
ptr: ReflectNamespace;
|
||||
@@ -147,11 +147,11 @@ declare module ProtoBuf {
|
||||
build(path?: string): ProtoBuf;
|
||||
lookup(path?: string): ReflectT;
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoBuf {
|
||||
[package: string]: {[key: string]: MetaMessage | any};
|
||||
}
|
||||
|
||||
|
||||
export interface MetaMessage {
|
||||
new(values?: {[key: string]: any}, var_args?: string[]): Message;
|
||||
decode(buffer?: Buffer, enc?: string): Message;
|
||||
@@ -159,22 +159,22 @@ declare module ProtoBuf {
|
||||
decode64(str: string): Message;
|
||||
decodeHex(str: string): Message;
|
||||
}
|
||||
|
||||
|
||||
// ==========
|
||||
// protobufjs/src/ProtoBuf/DotProto.js
|
||||
|
||||
|
||||
export interface DotProto {
|
||||
Parser: Parser;
|
||||
Tokenizer: Tokenizer;
|
||||
}
|
||||
|
||||
|
||||
export interface Parser {
|
||||
new(proto: string): Parser;
|
||||
tn: Tokenizer;
|
||||
parse(): MetaProto;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
export interface Tokenizer {
|
||||
new(proto: string): Tokenizer;
|
||||
source: string;
|
||||
@@ -187,10 +187,10 @@ declare module ProtoBuf {
|
||||
peek(): string;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
// ==========
|
||||
// proto meta information returned by the Parser
|
||||
|
||||
|
||||
export interface MetaProto {
|
||||
package: string;
|
||||
messages: ProtoMessage[];
|
||||
@@ -199,18 +199,18 @@ declare module ProtoBuf {
|
||||
options: {[key: string]: any};
|
||||
services: ProtoService[];
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoEnum {
|
||||
name: string;
|
||||
values: ProtoEnumValue;
|
||||
options: {[key: string]: any};
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoEnumValue {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoField {
|
||||
rule: string;
|
||||
options: {[key: string]: any};
|
||||
@@ -219,7 +219,7 @@ declare module ProtoBuf {
|
||||
id: number;
|
||||
oneof?: string;
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoMessage {
|
||||
name: string;
|
||||
isGroup?: boolean;
|
||||
@@ -229,23 +229,23 @@ declare module ProtoBuf {
|
||||
options: {[key: string]: any};
|
||||
oneofs: {[key: string]:number[]};
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoRpcService {
|
||||
request: string;
|
||||
response: string;
|
||||
options: {[key: string]: any};
|
||||
}
|
||||
|
||||
|
||||
export interface ProtoService {
|
||||
name: string;
|
||||
rpc: {[key: string]:ProtoRpcService};
|
||||
options: {[key: string]: any};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ==========
|
||||
// protobufjs/src/ProtoBuf/Reflect.js
|
||||
|
||||
|
||||
export interface Reflect {
|
||||
T: ReflectT;
|
||||
Namespace: ReflectNamespace;
|
||||
@@ -254,7 +254,7 @@ declare module ProtoBuf {
|
||||
Extension: ReflectExtension;
|
||||
Service: ReflectService;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectT {
|
||||
new(builder?: ProtoBuilder, parent?: ReflectT, name?: string): ReflectT;
|
||||
builder: ProtoBuilder;
|
||||
@@ -263,7 +263,7 @@ declare module ProtoBuf {
|
||||
fqn(): string;
|
||||
toString(includeClass?: boolean): string;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectNamespace extends ReflectT {
|
||||
new(builder?: ProtoBuilder, parent?: ReflectNamespace, name?: string,
|
||||
options?: {[key: string]: any}): ReflectNamespace;
|
||||
@@ -279,7 +279,7 @@ declare module ProtoBuf {
|
||||
buildOpt(): {[key: string]: any};
|
||||
getOption(name?: string): any;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectMessage extends ReflectNamespace {
|
||||
new(builder?: ProtoBuilder, parent?: ReflectNamespace, name?: string,
|
||||
options?: {[key: string]: any}, isGroup?: boolean): ReflectMessage;
|
||||
@@ -295,7 +295,7 @@ declare module ProtoBuf {
|
||||
calculate(message: Message): number;
|
||||
decode(buffer: Buffer, length?: number, expectedGroupEndId?: number): Message;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectEnum extends ReflectNamespace {
|
||||
new(builder?: ProtoBuilder, parent?: ReflectT, name?: string,
|
||||
options?: {[key: string]: any}): ReflectEnum;
|
||||
@@ -303,13 +303,13 @@ declare module ProtoBuf {
|
||||
object: {[key: string]:number};
|
||||
build(): {[key: string]: any};
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectExtension extends ReflectT {
|
||||
new(builder?: ProtoBuilder, parent?: ReflectT, name?: string,
|
||||
field?: ReflectField): ReflectExtension;
|
||||
field: ReflectField;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectService extends ReflectNamespace {
|
||||
new(): ReflectService;
|
||||
Method: ReflectMethod; // NOTE: only for new ProtoBuf.Reflect.Service.Method();
|
||||
@@ -317,7 +317,7 @@ declare module ProtoBuf {
|
||||
clazz(): Function;
|
||||
build(rebuild?: boolean): Function|any;
|
||||
}
|
||||
|
||||
|
||||
// TODO: check that the runtime instance of this type reflects this definition
|
||||
export interface ReflectField extends ReflectT {
|
||||
new(builder: ProtoBuilder, message: ReflectMessage, rule: string, type: string,
|
||||
@@ -341,30 +341,30 @@ declare module ProtoBuf {
|
||||
calculateValue(value: any): number;
|
||||
decode(wireType: number, buffer: Buffer, skipRepeated?: boolean): any;
|
||||
}
|
||||
|
||||
|
||||
export interface WireTuple {
|
||||
name: string;
|
||||
wireType: number;
|
||||
}
|
||||
|
||||
|
||||
// TODO: check that the runtime instance of this type reflects this definition
|
||||
export interface ReflectExtensionField extends ReflectField {
|
||||
new(builder: ProtoBuilder, message: ReflectMessage, rule: string, type: string,
|
||||
name: string, id: number, options: {[key: string]: any}): ReflectExtensionField;
|
||||
extension: ReflectExtension;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectOneOf extends ReflectT {
|
||||
new(builder?: ProtoBuilder, message?: ReflectMessage, name?: string): ReflectOneOf;
|
||||
fields: ReflectField[];
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectValue extends ReflectT {
|
||||
new(builder?: ProtoBuilder, enm?: ReflectEnum, name?: string, id?: number): ReflectValue;
|
||||
className: string;
|
||||
id: number;
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectMethod extends ReflectT {
|
||||
new(builder?: ProtoBuilder, svc?: ReflectService, name?: string,
|
||||
options?: {[key: string]: any}): ReflectMethod;
|
||||
@@ -372,7 +372,7 @@ declare module ProtoBuf {
|
||||
options: {[key: string]: any};
|
||||
buildOpt(): {[key: string]: any};
|
||||
}
|
||||
|
||||
|
||||
export interface ReflectRPCMethod extends ReflectMethod {
|
||||
new(builder?: ProtoBuilder, svc?: ReflectService, name?: string, request?: string,
|
||||
response?: string, options?: {[key: string]: any}): ReflectRPCMethod;
|
||||
|
||||
Reference in New Issue
Block a user