Skip to content

Commit

Permalink
fix(proto): use 64 bit chan_id ints as strings
Browse files Browse the repository at this point in the history
This adds `jstype = JS_STRING` annotations on the channel ids in the
lnd proto definition so that they use `string` types instead of numbers.
Javascript does not natively support 64 bit numbers and precision
can be lost, and the channel ids are known to cause issues because of
this.

This also adds a new package to generate type definitions from the
`.proto` files. This is because of a known bug in the previously used
plugin, agreatfool/grpc_tools_node_protoc_ts#10, which does not update
the generated type definition when `jstype = JS_STRING` is used.

Fixes #745.
  • Loading branch information
sangaman committed Dec 13, 2018
1 parent ec086bf commit 053678e
Show file tree
Hide file tree
Showing 11 changed files with 4,644 additions and 5,026 deletions.
5 changes: 2 additions & 3 deletions lib/proto/annotations_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

225 changes: 103 additions & 122 deletions lib/proto/google/api/http_pb.d.ts
Original file line number Diff line number Diff line change
@@ -1,147 +1,128 @@
// package: google.api
// file: google/api/http.proto

/* tslint:disable */

import * as jspb from "google-protobuf";

export class Http extends jspb.Message {
clearRulesList(): void;
getRulesList(): Array<HttpRule>;
setRulesList(value: Array<HttpRule>): void;
addRules(value?: HttpRule, index?: number): HttpRule;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Http.AsObject;
static toObject(includeInstance: boolean, msg: Http): Http.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Http, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Http;
static deserializeBinaryFromReader(message: Http, reader: jspb.BinaryReader): Http;
export class Http extends jspb.Message {
clearRulesList(): void;
getRulesList(): Array<HttpRule>;
setRulesList(value: Array<HttpRule>): void;
addRules(value?: HttpRule, index?: number): HttpRule;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Http.AsObject;
static toObject(includeInstance: boolean, msg: Http): Http.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Http, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Http;
static deserializeBinaryFromReader(message: Http, reader: jspb.BinaryReader): Http;
}

export namespace Http {
export type AsObject = {
rulesList: Array<HttpRule.AsObject>,
}
export type AsObject = {
rulesList: Array<HttpRule.AsObject>,
}
}

export class HttpRule extends jspb.Message {
getSelector(): string;
setSelector(value: string): void;


hasGet(): boolean;
clearGet(): void;
getGet(): string;
setGet(value: string): void;


hasPut(): boolean;
clearPut(): void;
getPut(): string;
setPut(value: string): void;


hasPost(): boolean;
clearPost(): void;
getPost(): string;
setPost(value: string): void;


hasDelete(): boolean;
clearDelete(): void;
getDelete(): string;
setDelete(value: string): void;


hasPatch(): boolean;
clearPatch(): void;
getPatch(): string;
setPatch(value: string): void;


hasCustom(): boolean;
clearCustom(): void;
getCustom(): CustomHttpPattern | undefined;
setCustom(value?: CustomHttpPattern): void;

getBody(): string;
setBody(value: string): void;

clearAdditionalBindingsList(): void;
getAdditionalBindingsList(): Array<HttpRule>;
setAdditionalBindingsList(value: Array<HttpRule>): void;
addAdditionalBindings(value?: HttpRule, index?: number): HttpRule;


getPatternCase(): HttpRule.PatternCase;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HttpRule.AsObject;
static toObject(includeInstance: boolean, msg: HttpRule): HttpRule.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HttpRule, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HttpRule;
static deserializeBinaryFromReader(message: HttpRule, reader: jspb.BinaryReader): HttpRule;
export class HttpRule extends jspb.Message {
getSelector(): string;
setSelector(value: string): void;

hasGet(): boolean;
clearGet(): void;
getGet(): string;
setGet(value: string): void;

hasPut(): boolean;
clearPut(): void;
getPut(): string;
setPut(value: string): void;

hasPost(): boolean;
clearPost(): void;
getPost(): string;
setPost(value: string): void;

hasDelete(): boolean;
clearDelete(): void;
getDelete(): string;
setDelete(value: string): void;

hasPatch(): boolean;
clearPatch(): void;
getPatch(): string;
setPatch(value: string): void;

hasCustom(): boolean;
clearCustom(): void;
getCustom(): CustomHttpPattern | undefined;
setCustom(value?: CustomHttpPattern): void;

getBody(): string;
setBody(value: string): void;

clearAdditionalBindingsList(): void;
getAdditionalBindingsList(): Array<HttpRule>;
setAdditionalBindingsList(value: Array<HttpRule>): void;
addAdditionalBindings(value?: HttpRule, index?: number): HttpRule;

getPatternCase(): HttpRule.PatternCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): HttpRule.AsObject;
static toObject(includeInstance: boolean, msg: HttpRule): HttpRule.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: HttpRule, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): HttpRule;
static deserializeBinaryFromReader(message: HttpRule, reader: jspb.BinaryReader): HttpRule;
}

export namespace HttpRule {
export type AsObject = {
selector: string,
get: string,
put: string,
post: string,
pb_delete: string,
patch: string,
custom?: CustomHttpPattern.AsObject,
body: string,
additionalBindingsList: Array<HttpRule.AsObject>,
}

export enum PatternCase {
PATTERN_NOT_SET = 0,

export type AsObject = {
selector: string,
get: string,
put: string,
post: string,
pb_delete: string,
patch: string,
custom?: CustomHttpPattern.AsObject,
body: string,
additionalBindingsList: Array<HttpRule.AsObject>,
}

export enum PatternCase {
PATTERN_NOT_SET = 0,
GET = 2,

PUT = 3,

POST = 4,

DELETE = 5,

PATCH = 6,

CUSTOM = 8,

}

}
}

export class CustomHttpPattern extends jspb.Message {
getKind(): string;
setKind(value: string): void;

getPath(): string;
setPath(value: string): void;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CustomHttpPattern.AsObject;
static toObject(includeInstance: boolean, msg: CustomHttpPattern): CustomHttpPattern.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CustomHttpPattern, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CustomHttpPattern;
static deserializeBinaryFromReader(message: CustomHttpPattern, reader: jspb.BinaryReader): CustomHttpPattern;
export class CustomHttpPattern extends jspb.Message {
getKind(): string;
setKind(value: string): void;

getPath(): string;
setPath(value: string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CustomHttpPattern.AsObject;
static toObject(includeInstance: boolean, msg: CustomHttpPattern): CustomHttpPattern.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CustomHttpPattern, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CustomHttpPattern;
static deserializeBinaryFromReader(message: CustomHttpPattern, reader: jspb.BinaryReader): CustomHttpPattern;
}

export namespace CustomHttpPattern {
export type AsObject = {
kind: string,
path: string,
}
export type AsObject = {
kind: string,
path: string,
}
}

Loading

0 comments on commit 053678e

Please sign in to comment.