From 4fd5bafaf1c9921bc2079bd50992ab22b9b5a122 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Thu, 9 May 2019 02:05:39 +0900 Subject: [PATCH] cdp service is added --- cdp.proto | 42 ++ generated/cdp.pb.go | 319 ++++++++++++ generated/cdp_grpc_pb.d.ts | 40 ++ generated/cdp_grpc_pb.js | 44 ++ generated/cdp_pb.d.ts | 84 ++++ generated/cdp_pb.js | 455 ++++++++++++++++++ network/network.pb.go | 210 -------- network/network.proto | 24 - network/network_grpc_pb.d.ts | 40 -- network/network_grpc_pb.js | 45 -- network/network_pb.d.ts | 48 -- network/network_pb.js | 300 ------------ package.json | 1 - proto_go.sh => script/proto_go.sh | 2 +- .../proto_typescript.sh | 8 +- 15 files changed, 989 insertions(+), 673 deletions(-) create mode 100644 cdp.proto create mode 100644 generated/cdp.pb.go create mode 100644 generated/cdp_grpc_pb.d.ts create mode 100644 generated/cdp_grpc_pb.js create mode 100644 generated/cdp_pb.d.ts create mode 100644 generated/cdp_pb.js delete mode 100644 network/network.pb.go delete mode 100644 network/network.proto delete mode 100644 network/network_grpc_pb.d.ts delete mode 100644 network/network_grpc_pb.js delete mode 100644 network/network_pb.d.ts delete mode 100644 network/network_pb.js rename proto_go.sh => script/proto_go.sh (78%) rename proto_typescript.sh => script/proto_typescript.sh (67%) diff --git a/cdp.proto b/cdp.proto new file mode 100644 index 0000000..c70b2aa --- /dev/null +++ b/cdp.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; + +option cc_enable_arenas = true; +option java_outer_classname = "CDPProto"; +option java_multiple_files = true; +option java_package = "net.loafle.oddscrawler"; +option go_package = "oddscrawler"; + +package oddscrawler; + +enum TransitionType { + link = 0; + typed =1; + address_bar = 2; + auto_bookmark = 3; + auto_subframe = 4; + manual_subframe = 5; + generated = 6; + auto_toplevel = 7; + form_submit = 8; + reload = 9; + keyword = 10; + keyword_generated = 11; + other = 12; +} + +message NavigateRequest { + string url = 1; + string referrer = 2; + TransitionType transitionType = 3; + string frameId = 4; +} + +message NavigateReply { + string frameId = 1; + string loaderId = 2; + string errorText = 3; +} + +service CDPService { + rpc navigate (NavigateRequest) returns (NavigateReply) {} +} diff --git a/generated/cdp.pb.go b/generated/cdp.pb.go new file mode 100644 index 0000000..7a1854f --- /dev/null +++ b/generated/cdp.pb.go @@ -0,0 +1,319 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: cdp.proto + +package oddscrawler + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type TransitionType int32 + +const ( + TransitionType_link TransitionType = 0 + TransitionType_typed TransitionType = 1 + TransitionType_address_bar TransitionType = 2 + TransitionType_auto_bookmark TransitionType = 3 + TransitionType_auto_subframe TransitionType = 4 + TransitionType_manual_subframe TransitionType = 5 + TransitionType_generated TransitionType = 6 + TransitionType_auto_toplevel TransitionType = 7 + TransitionType_form_submit TransitionType = 8 + TransitionType_reload TransitionType = 9 + TransitionType_keyword TransitionType = 10 + TransitionType_keyword_generated TransitionType = 11 + TransitionType_other TransitionType = 12 +) + +var TransitionType_name = map[int32]string{ + 0: "link", + 1: "typed", + 2: "address_bar", + 3: "auto_bookmark", + 4: "auto_subframe", + 5: "manual_subframe", + 6: "generated", + 7: "auto_toplevel", + 8: "form_submit", + 9: "reload", + 10: "keyword", + 11: "keyword_generated", + 12: "other", +} + +var TransitionType_value = map[string]int32{ + "link": 0, + "typed": 1, + "address_bar": 2, + "auto_bookmark": 3, + "auto_subframe": 4, + "manual_subframe": 5, + "generated": 6, + "auto_toplevel": 7, + "form_submit": 8, + "reload": 9, + "keyword": 10, + "keyword_generated": 11, + "other": 12, +} + +func (x TransitionType) String() string { + return proto.EnumName(TransitionType_name, int32(x)) +} + +func (TransitionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_de20de09a285b695, []int{0} +} + +type NavigateRequest struct { + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + Referrer string `protobuf:"bytes,2,opt,name=referrer,proto3" json:"referrer,omitempty"` + TransitionType TransitionType `protobuf:"varint,3,opt,name=transitionType,proto3,enum=oddscrawler.TransitionType" json:"transitionType,omitempty"` + FrameId string `protobuf:"bytes,4,opt,name=frameId,proto3" json:"frameId,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NavigateRequest) Reset() { *m = NavigateRequest{} } +func (m *NavigateRequest) String() string { return proto.CompactTextString(m) } +func (*NavigateRequest) ProtoMessage() {} +func (*NavigateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_de20de09a285b695, []int{0} +} + +func (m *NavigateRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NavigateRequest.Unmarshal(m, b) +} +func (m *NavigateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NavigateRequest.Marshal(b, m, deterministic) +} +func (m *NavigateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NavigateRequest.Merge(m, src) +} +func (m *NavigateRequest) XXX_Size() int { + return xxx_messageInfo_NavigateRequest.Size(m) +} +func (m *NavigateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NavigateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NavigateRequest proto.InternalMessageInfo + +func (m *NavigateRequest) GetUrl() string { + if m != nil { + return m.Url + } + return "" +} + +func (m *NavigateRequest) GetReferrer() string { + if m != nil { + return m.Referrer + } + return "" +} + +func (m *NavigateRequest) GetTransitionType() TransitionType { + if m != nil { + return m.TransitionType + } + return TransitionType_link +} + +func (m *NavigateRequest) GetFrameId() string { + if m != nil { + return m.FrameId + } + return "" +} + +type NavigateReply struct { + FrameId string `protobuf:"bytes,1,opt,name=frameId,proto3" json:"frameId,omitempty"` + LoaderId string `protobuf:"bytes,2,opt,name=loaderId,proto3" json:"loaderId,omitempty"` + ErrorText string `protobuf:"bytes,3,opt,name=errorText,proto3" json:"errorText,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NavigateReply) Reset() { *m = NavigateReply{} } +func (m *NavigateReply) String() string { return proto.CompactTextString(m) } +func (*NavigateReply) ProtoMessage() {} +func (*NavigateReply) Descriptor() ([]byte, []int) { + return fileDescriptor_de20de09a285b695, []int{1} +} + +func (m *NavigateReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_NavigateReply.Unmarshal(m, b) +} +func (m *NavigateReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_NavigateReply.Marshal(b, m, deterministic) +} +func (m *NavigateReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_NavigateReply.Merge(m, src) +} +func (m *NavigateReply) XXX_Size() int { + return xxx_messageInfo_NavigateReply.Size(m) +} +func (m *NavigateReply) XXX_DiscardUnknown() { + xxx_messageInfo_NavigateReply.DiscardUnknown(m) +} + +var xxx_messageInfo_NavigateReply proto.InternalMessageInfo + +func (m *NavigateReply) GetFrameId() string { + if m != nil { + return m.FrameId + } + return "" +} + +func (m *NavigateReply) GetLoaderId() string { + if m != nil { + return m.LoaderId + } + return "" +} + +func (m *NavigateReply) GetErrorText() string { + if m != nil { + return m.ErrorText + } + return "" +} + +func init() { + proto.RegisterEnum("oddscrawler.TransitionType", TransitionType_name, TransitionType_value) + proto.RegisterType((*NavigateRequest)(nil), "oddscrawler.NavigateRequest") + proto.RegisterType((*NavigateReply)(nil), "oddscrawler.NavigateReply") +} + +func init() { proto.RegisterFile("cdp.proto", fileDescriptor_de20de09a285b695) } + +var fileDescriptor_de20de09a285b695 = []byte{ + // 405 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6e, 0xda, 0x40, + 0x10, 0x86, 0xb3, 0x81, 0x80, 0x3d, 0x14, 0xd8, 0x4c, 0xd5, 0xca, 0xa2, 0x39, 0x44, 0x9c, 0xa2, + 0x1e, 0x38, 0xa4, 0x7d, 0x82, 0x10, 0x55, 0xca, 0xa5, 0x42, 0x94, 0x53, 0x2f, 0x68, 0x61, 0xc7, + 0xa9, 0xe5, 0xb5, 0xd7, 0x1d, 0xaf, 0x49, 0xfd, 0x32, 0x7d, 0xb5, 0xbe, 0x46, 0x8f, 0x95, 0xad, + 0x80, 0x6d, 0xa4, 0xde, 0xfc, 0xff, 0xfe, 0x67, 0xe7, 0xb3, 0xf7, 0x07, 0x7f, 0xaf, 0xb3, 0x45, + 0xc6, 0xd6, 0x59, 0x1c, 0x59, 0xad, 0xf3, 0x3d, 0xab, 0x17, 0x43, 0x3c, 0xff, 0x2d, 0x60, 0xfa, + 0x55, 0x1d, 0xa2, 0x67, 0xe5, 0x68, 0x4d, 0x3f, 0x0b, 0xca, 0x1d, 0x4a, 0xe8, 0x15, 0x6c, 0x02, + 0x71, 0x2b, 0xee, 0xfc, 0x75, 0xf5, 0x88, 0x33, 0xf0, 0x98, 0x42, 0x62, 0x26, 0x0e, 0x2e, 0x6b, + 0xfb, 0xa4, 0x71, 0x09, 0x13, 0xc7, 0x2a, 0xcd, 0x23, 0x17, 0xd9, 0x74, 0x53, 0x66, 0x14, 0xf4, + 0x6e, 0xc5, 0xdd, 0xe4, 0xfe, 0xc3, 0xa2, 0xb5, 0x67, 0xb1, 0xe9, 0x44, 0xd6, 0x67, 0x23, 0x18, + 0xc0, 0x30, 0x64, 0x95, 0xd0, 0x93, 0x0e, 0xfa, 0xf5, 0xf9, 0x47, 0x39, 0xdf, 0xc3, 0xb8, 0xe1, + 0xcb, 0x4c, 0xd9, 0x8e, 0x8a, 0x4e, 0xb4, 0xa2, 0x34, 0x56, 0x69, 0xe2, 0x27, 0x7d, 0xa4, 0x3c, + 0x6a, 0xbc, 0x01, 0x9f, 0x98, 0x2d, 0x6f, 0xe8, 0x97, 0xab, 0x01, 0xfd, 0x75, 0x63, 0x7c, 0xfc, + 0x23, 0x60, 0xd2, 0x25, 0x44, 0x0f, 0xfa, 0x26, 0x4a, 0x63, 0x79, 0x81, 0x3e, 0x5c, 0xb9, 0x32, + 0x23, 0x2d, 0x05, 0x4e, 0x61, 0xa4, 0xb4, 0x66, 0xca, 0xf3, 0xed, 0x4e, 0xb1, 0xbc, 0xc4, 0x6b, + 0x18, 0xab, 0xc2, 0xd9, 0xed, 0xce, 0xda, 0x38, 0x51, 0x1c, 0xcb, 0xde, 0xc9, 0xca, 0x8b, 0x5d, + 0x0d, 0x26, 0xfb, 0xf8, 0x16, 0xa6, 0x89, 0x4a, 0x0b, 0x65, 0x1a, 0xf3, 0x0a, 0xc7, 0xe0, 0x3f, + 0x53, 0x4a, 0xac, 0x1c, 0x69, 0x39, 0x38, 0x8d, 0x39, 0x9b, 0x19, 0x3a, 0x90, 0x91, 0xc3, 0x6a, + 0x5b, 0x68, 0x39, 0xa9, 0x86, 0x92, 0xc8, 0x49, 0x0f, 0x01, 0x06, 0x4c, 0xd5, 0x27, 0x49, 0x1f, + 0x47, 0x30, 0x8c, 0xa9, 0x7c, 0xb1, 0xac, 0x25, 0xe0, 0x3b, 0xb8, 0x7e, 0x15, 0xdb, 0xe6, 0xcc, + 0x51, 0x45, 0x6e, 0xdd, 0x0f, 0x62, 0xf9, 0xe6, 0x7e, 0x03, 0xb0, 0x7c, 0x5c, 0x7d, 0x23, 0x3e, + 0x44, 0x7b, 0xc2, 0x2f, 0xe0, 0xa5, 0xaf, 0x3f, 0x15, 0x6f, 0x3a, 0xf7, 0x74, 0xd6, 0x85, 0xd9, + 0xec, 0x3f, 0x6f, 0x33, 0x53, 0xce, 0x2f, 0x1e, 0x3e, 0xc3, 0xfb, 0x94, 0xdc, 0xc2, 0x58, 0x15, + 0x1a, 0x6a, 0x27, 0x1f, 0xbc, 0xe5, 0xe3, 0x6a, 0x55, 0xd5, 0x6d, 0x25, 0xbe, 0xb7, 0x0b, 0xf7, + 0x57, 0x88, 0xdd, 0xa0, 0xee, 0xe1, 0xa7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x50, 0x49, 0xea, + 0x60, 0x94, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// CDPServiceClient is the client API for CDPService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CDPServiceClient interface { + Navigate(ctx context.Context, in *NavigateRequest, opts ...grpc.CallOption) (*NavigateReply, error) +} + +type cDPServiceClient struct { + cc *grpc.ClientConn +} + +func NewCDPServiceClient(cc *grpc.ClientConn) CDPServiceClient { + return &cDPServiceClient{cc} +} + +func (c *cDPServiceClient) Navigate(ctx context.Context, in *NavigateRequest, opts ...grpc.CallOption) (*NavigateReply, error) { + out := new(NavigateReply) + err := c.cc.Invoke(ctx, "/oddscrawler.CDPService/navigate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CDPServiceServer is the server API for CDPService service. +type CDPServiceServer interface { + Navigate(context.Context, *NavigateRequest) (*NavigateReply, error) +} + +// UnimplementedCDPServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCDPServiceServer struct { +} + +func (*UnimplementedCDPServiceServer) Navigate(ctx context.Context, req *NavigateRequest) (*NavigateReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Navigate not implemented") +} + +func RegisterCDPServiceServer(s *grpc.Server, srv CDPServiceServer) { + s.RegisterService(&_CDPService_serviceDesc, srv) +} + +func _CDPService_Navigate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NavigateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CDPServiceServer).Navigate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/oddscrawler.CDPService/Navigate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CDPServiceServer).Navigate(ctx, req.(*NavigateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _CDPService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "oddscrawler.CDPService", + HandlerType: (*CDPServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "navigate", + Handler: _CDPService_Navigate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cdp.proto", +} diff --git a/generated/cdp_grpc_pb.d.ts b/generated/cdp_grpc_pb.d.ts new file mode 100644 index 0000000..a0a16c7 --- /dev/null +++ b/generated/cdp_grpc_pb.d.ts @@ -0,0 +1,40 @@ +// package: oddscrawler +// file: cdp.proto + +/* tslint:disable */ + +import * as grpc from "grpc"; +import * as cdp_pb from "./cdp_pb"; + +interface ICDPServiceService extends grpc.ServiceDefinition { + navigate: ICDPServiceService_Inavigate; +} + +interface ICDPServiceService_Inavigate extends grpc.MethodDefinition { + path: string; // "/oddscrawler.CDPService/navigate" + requestStream: boolean; // false + responseStream: boolean; // false + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; +} + +export const CDPServiceService: ICDPServiceService; + +export interface ICDPServiceServer { + navigate: grpc.handleUnaryCall; +} + +export interface ICDPServiceClient { + navigate(request: cdp_pb.NavigateRequest, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; + navigate(request: cdp_pb.NavigateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; + navigate(request: cdp_pb.NavigateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; +} + +export class CDPServiceClient extends grpc.Client implements ICDPServiceClient { + constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); + public navigate(request: cdp_pb.NavigateRequest, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; + public navigate(request: cdp_pb.NavigateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; + public navigate(request: cdp_pb.NavigateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cdp_pb.NavigateReply) => void): grpc.ClientUnaryCall; +} diff --git a/generated/cdp_grpc_pb.js b/generated/cdp_grpc_pb.js new file mode 100644 index 0000000..0cc402b --- /dev/null +++ b/generated/cdp_grpc_pb.js @@ -0,0 +1,44 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var grpc = require('grpc'); +var cdp_pb = require('./cdp_pb.js'); + +function serialize_oddscrawler_NavigateReply(arg) { + if (!(arg instanceof cdp_pb.NavigateReply)) { + throw new Error('Expected argument of type oddscrawler.NavigateReply'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_oddscrawler_NavigateReply(buffer_arg) { + return cdp_pb.NavigateReply.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_oddscrawler_NavigateRequest(arg) { + if (!(arg instanceof cdp_pb.NavigateRequest)) { + throw new Error('Expected argument of type oddscrawler.NavigateRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_oddscrawler_NavigateRequest(buffer_arg) { + return cdp_pb.NavigateRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var CDPServiceService = exports.CDPServiceService = { + navigate: { + path: '/oddscrawler.CDPService/navigate', + requestStream: false, + responseStream: false, + requestType: cdp_pb.NavigateRequest, + responseType: cdp_pb.NavigateReply, + requestSerialize: serialize_oddscrawler_NavigateRequest, + requestDeserialize: deserialize_oddscrawler_NavigateRequest, + responseSerialize: serialize_oddscrawler_NavigateReply, + responseDeserialize: deserialize_oddscrawler_NavigateReply, + }, +}; + +exports.CDPServiceClient = grpc.makeGenericClientConstructor(CDPServiceService); diff --git a/generated/cdp_pb.d.ts b/generated/cdp_pb.d.ts new file mode 100644 index 0000000..b3bc8f2 --- /dev/null +++ b/generated/cdp_pb.d.ts @@ -0,0 +1,84 @@ +// package: oddscrawler +// file: cdp.proto + +/* tslint:disable */ + +import * as jspb from "google-protobuf"; + +export class NavigateRequest extends jspb.Message { + getUrl(): string; + setUrl(value: string): void; + + getReferrer(): string; + setReferrer(value: string): void; + + getTransitiontype(): TransitionType; + setTransitiontype(value: TransitionType): void; + + getFrameid(): string; + setFrameid(value: string): void; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NavigateRequest.AsObject; + static toObject(includeInstance: boolean, msg: NavigateRequest): NavigateRequest.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NavigateRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NavigateRequest; + static deserializeBinaryFromReader(message: NavigateRequest, reader: jspb.BinaryReader): NavigateRequest; +} + +export namespace NavigateRequest { + export type AsObject = { + url: string, + referrer: string, + transitiontype: TransitionType, + frameid: string, + } +} + +export class NavigateReply extends jspb.Message { + getFrameid(): string; + setFrameid(value: string): void; + + getLoaderid(): string; + setLoaderid(value: string): void; + + getErrortext(): string; + setErrortext(value: string): void; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): NavigateReply.AsObject; + static toObject(includeInstance: boolean, msg: NavigateReply): NavigateReply.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: NavigateReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): NavigateReply; + static deserializeBinaryFromReader(message: NavigateReply, reader: jspb.BinaryReader): NavigateReply; +} + +export namespace NavigateReply { + export type AsObject = { + frameid: string, + loaderid: string, + errortext: string, + } +} + +export enum TransitionType { + LINK = 0, + TYPED = 1, + ADDRESS_BAR = 2, + AUTO_BOOKMARK = 3, + AUTO_SUBFRAME = 4, + MANUAL_SUBFRAME = 5, + GENERATED = 6, + AUTO_TOPLEVEL = 7, + FORM_SUBMIT = 8, + RELOAD = 9, + KEYWORD = 10, + KEYWORD_GENERATED = 11, + OTHER = 12, +} diff --git a/generated/cdp_pb.js b/generated/cdp_pb.js new file mode 100644 index 0000000..8c16df0 --- /dev/null +++ b/generated/cdp_pb.js @@ -0,0 +1,455 @@ +/** + * @fileoverview + * @enhanceable + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! + +var jspb = require('google-protobuf'); +var goog = jspb; +var global = Function('return this')(); + +goog.exportSymbol('proto.oddscrawler.NavigateReply', null, global); +goog.exportSymbol('proto.oddscrawler.NavigateRequest', null, global); +goog.exportSymbol('proto.oddscrawler.TransitionType', null, global); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.oddscrawler.NavigateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.oddscrawler.NavigateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.oddscrawler.NavigateRequest.displayName = 'proto.oddscrawler.NavigateRequest'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.oddscrawler.NavigateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.oddscrawler.NavigateRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.oddscrawler.NavigateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.oddscrawler.NavigateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ""), + referrer: jspb.Message.getFieldWithDefault(msg, 2, ""), + transitiontype: jspb.Message.getFieldWithDefault(msg, 3, 0), + frameid: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.oddscrawler.NavigateRequest} + */ +proto.oddscrawler.NavigateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.oddscrawler.NavigateRequest; + return proto.oddscrawler.NavigateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.oddscrawler.NavigateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.oddscrawler.NavigateRequest} + */ +proto.oddscrawler.NavigateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setReferrer(value); + break; + case 3: + var value = /** @type {!proto.oddscrawler.TransitionType} */ (reader.readEnum()); + msg.setTransitiontype(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setFrameid(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.oddscrawler.NavigateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.oddscrawler.NavigateRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.oddscrawler.NavigateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.oddscrawler.NavigateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUrl(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getReferrer(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getTransitiontype(); + if (f !== 0.0) { + writer.writeEnum( + 3, + f + ); + } + f = message.getFrameid(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional string url = 1; + * @return {string} + */ +proto.oddscrawler.NavigateRequest.prototype.getUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateRequest.prototype.setUrl = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string referrer = 2; + * @return {string} + */ +proto.oddscrawler.NavigateRequest.prototype.getReferrer = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateRequest.prototype.setReferrer = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional TransitionType transitionType = 3; + * @return {!proto.oddscrawler.TransitionType} + */ +proto.oddscrawler.NavigateRequest.prototype.getTransitiontype = function() { + return /** @type {!proto.oddscrawler.TransitionType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** @param {!proto.oddscrawler.TransitionType} value */ +proto.oddscrawler.NavigateRequest.prototype.setTransitiontype = function(value) { + jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional string frameId = 4; + * @return {string} + */ +proto.oddscrawler.NavigateRequest.prototype.getFrameid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateRequest.prototype.setFrameid = function(value) { + jspb.Message.setProto3StringField(this, 4, value); +}; + + + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.oddscrawler.NavigateReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.oddscrawler.NavigateReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + proto.oddscrawler.NavigateReply.displayName = 'proto.oddscrawler.NavigateReply'; +} + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto suitable for use in Soy templates. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. + * @param {boolean=} opt_includeInstance Whether to include the JSPB instance + * for transitional soy proto support: http://goto/soy-param-migration + * @return {!Object} + */ +proto.oddscrawler.NavigateReply.prototype.toObject = function(opt_includeInstance) { + return proto.oddscrawler.NavigateReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Whether to include the JSPB + * instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.oddscrawler.NavigateReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.oddscrawler.NavigateReply.toObject = function(includeInstance, msg) { + var f, obj = { + frameid: jspb.Message.getFieldWithDefault(msg, 1, ""), + loaderid: jspb.Message.getFieldWithDefault(msg, 2, ""), + errortext: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.oddscrawler.NavigateReply} + */ +proto.oddscrawler.NavigateReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.oddscrawler.NavigateReply; + return proto.oddscrawler.NavigateReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.oddscrawler.NavigateReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.oddscrawler.NavigateReply} + */ +proto.oddscrawler.NavigateReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setFrameid(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setLoaderid(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setErrortext(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.oddscrawler.NavigateReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.oddscrawler.NavigateReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.oddscrawler.NavigateReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.oddscrawler.NavigateReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFrameid(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getLoaderid(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getErrortext(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string frameId = 1; + * @return {string} + */ +proto.oddscrawler.NavigateReply.prototype.getFrameid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateReply.prototype.setFrameid = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string loaderId = 2; + * @return {string} + */ +proto.oddscrawler.NavigateReply.prototype.getLoaderid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateReply.prototype.setLoaderid = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string errorText = 3; + * @return {string} + */ +proto.oddscrawler.NavigateReply.prototype.getErrortext = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.oddscrawler.NavigateReply.prototype.setErrortext = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * @enum {number} + */ +proto.oddscrawler.TransitionType = { + LINK: 0, + TYPED: 1, + ADDRESS_BAR: 2, + AUTO_BOOKMARK: 3, + AUTO_SUBFRAME: 4, + MANUAL_SUBFRAME: 5, + GENERATED: 6, + AUTO_TOPLEVEL: 7, + FORM_SUBMIT: 8, + RELOAD: 9, + KEYWORD: 10, + KEYWORD_GENERATED: 11, + OTHER: 12 +}; + +goog.object.extend(exports, proto.oddscrawler); diff --git a/network/network.pb.go b/network/network.pb.go deleted file mode 100644 index f74412d..0000000 --- a/network/network.pb.go +++ /dev/null @@ -1,210 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: network.proto - -package network - -import ( - context "context" - fmt "fmt" - proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -// The request message containing the user's name. -type NetworkRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NetworkRequest) Reset() { *m = NetworkRequest{} } -func (m *NetworkRequest) String() string { return proto.CompactTextString(m) } -func (*NetworkRequest) ProtoMessage() {} -func (*NetworkRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8571034d60397816, []int{0} -} - -func (m *NetworkRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NetworkRequest.Unmarshal(m, b) -} -func (m *NetworkRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NetworkRequest.Marshal(b, m, deterministic) -} -func (m *NetworkRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkRequest.Merge(m, src) -} -func (m *NetworkRequest) XXX_Size() int { - return xxx_messageInfo_NetworkRequest.Size(m) -} -func (m *NetworkRequest) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkRequest proto.InternalMessageInfo - -func (m *NetworkRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// The response message containing the greetings -type NetworkReply struct { - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *NetworkReply) Reset() { *m = NetworkReply{} } -func (m *NetworkReply) String() string { return proto.CompactTextString(m) } -func (*NetworkReply) ProtoMessage() {} -func (*NetworkReply) Descriptor() ([]byte, []int) { - return fileDescriptor_8571034d60397816, []int{1} -} - -func (m *NetworkReply) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NetworkReply.Unmarshal(m, b) -} -func (m *NetworkReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NetworkReply.Marshal(b, m, deterministic) -} -func (m *NetworkReply) XXX_Merge(src proto.Message) { - xxx_messageInfo_NetworkReply.Merge(m, src) -} -func (m *NetworkReply) XXX_Size() int { - return xxx_messageInfo_NetworkReply.Size(m) -} -func (m *NetworkReply) XXX_DiscardUnknown() { - xxx_messageInfo_NetworkReply.DiscardUnknown(m) -} - -var xxx_messageInfo_NetworkReply proto.InternalMessageInfo - -func (m *NetworkReply) GetMessage() string { - if m != nil { - return m.Message - } - return "" -} - -func init() { - proto.RegisterType((*NetworkRequest)(nil), "oddscrawler.NetworkRequest") - proto.RegisterType((*NetworkReply)(nil), "oddscrawler.NetworkReply") -} - -func init() { proto.RegisterFile("network.proto", fileDescriptor_8571034d60397816) } - -var fileDescriptor_8571034d60397816 = []byte{ - // 180 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4b, 0x2d, 0x29, - 0xcf, 0x2f, 0xca, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xce, 0x4f, 0x49, 0x29, 0x4e, - 0x2e, 0x4a, 0x2c, 0xcf, 0x49, 0x2d, 0x52, 0x52, 0xe1, 0xe2, 0xf3, 0x83, 0xc8, 0x06, 0xa5, 0x16, - 0x96, 0xa6, 0x16, 0x97, 0x08, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, - 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x4a, 0x1a, 0x5c, 0x3c, 0x70, 0x55, 0x05, 0x39, 0x95, 0x42, 0x12, - 0x5c, 0xec, 0xb9, 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0x30, 0x65, 0x30, 0xae, 0x51, 0x20, 0x17, 0x27, - 0x54, 0x65, 0x6a, 0x91, 0x90, 0x0b, 0x17, 0x47, 0x70, 0x62, 0xa5, 0x47, 0x6a, 0x4e, 0x4e, 0xbe, - 0x90, 0xb4, 0x1e, 0x92, 0xb5, 0x7a, 0xa8, 0x76, 0x4a, 0x49, 0x62, 0x97, 0x2c, 0xc8, 0xa9, 0x54, - 0x62, 0x70, 0x32, 0xe1, 0x12, 0xcb, 0x4b, 0x2d, 0xd1, 0xcb, 0xc9, 0x4f, 0x4c, 0xcb, 0x49, 0x45, - 0x56, 0xe8, 0x04, 0x73, 0x54, 0x00, 0xc8, 0x5f, 0x01, 0x8c, 0x51, 0xec, 0x50, 0x8f, 0xfe, 0x60, - 0x64, 0x4c, 0x62, 0x03, 0x7b, 0xd6, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x36, 0x32, 0xf1, 0x15, - 0xfd, 0x00, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// NetworkerClient is the client API for Networker service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type NetworkerClient interface { - // Sends a greeting - SayHello(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkReply, error) -} - -type networkerClient struct { - cc *grpc.ClientConn -} - -func NewNetworkerClient(cc *grpc.ClientConn) NetworkerClient { - return &networkerClient{cc} -} - -func (c *networkerClient) SayHello(ctx context.Context, in *NetworkRequest, opts ...grpc.CallOption) (*NetworkReply, error) { - out := new(NetworkReply) - err := c.cc.Invoke(ctx, "/oddscrawler.Networker/SayHello", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// NetworkerServer is the server API for Networker service. -type NetworkerServer interface { - // Sends a greeting - SayHello(context.Context, *NetworkRequest) (*NetworkReply, error) -} - -// UnimplementedNetworkerServer can be embedded to have forward compatible implementations. -type UnimplementedNetworkerServer struct { -} - -func (*UnimplementedNetworkerServer) SayHello(ctx context.Context, req *NetworkRequest) (*NetworkReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method SayHello not implemented") -} - -func RegisterNetworkerServer(s *grpc.Server, srv NetworkerServer) { - s.RegisterService(&_Networker_serviceDesc, srv) -} - -func _Networker_SayHello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NetworkRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NetworkerServer).SayHello(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/oddscrawler.Networker/SayHello", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NetworkerServer).SayHello(ctx, req.(*NetworkRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Networker_serviceDesc = grpc.ServiceDesc{ - ServiceName: "oddscrawler.Networker", - HandlerType: (*NetworkerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SayHello", - Handler: _Networker_SayHello_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "network.proto", -} diff --git a/network/network.proto b/network/network.proto deleted file mode 100644 index 7926591..0000000 --- a/network/network.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; - -option cc_enable_arenas = true; -option java_outer_classname = "NetworkProto"; -option java_multiple_files = true; -option java_package = "net.loafle.oddscrawler"; -option go_package = "network"; - -package oddscrawler; - -// The request message containing the user's name. -message NetworkRequest { - string name = 1; -} - -// The response message containing the greetings -message NetworkReply { - string message = 1; -} - -service Networker { - // Sends a greeting - rpc SayHello (NetworkRequest) returns (NetworkReply) {} -} diff --git a/network/network_grpc_pb.d.ts b/network/network_grpc_pb.d.ts deleted file mode 100644 index 9ff42fd..0000000 --- a/network/network_grpc_pb.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -// package: oddscrawler -// file: network.proto - -/* tslint:disable */ - -import * as grpc from "grpc"; -import * as network_pb from "./network_pb"; - -interface INetworkerService extends grpc.ServiceDefinition { - sayHello: INetworkerService_ISayHello; -} - -interface INetworkerService_ISayHello extends grpc.MethodDefinition { - path: string; // "/oddscrawler.Networker/SayHello" - requestStream: boolean; // false - responseStream: boolean; // false - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} - -export const NetworkerService: INetworkerService; - -export interface INetworkerServer { - sayHello: grpc.handleUnaryCall; -} - -export interface INetworkerClient { - sayHello(request: network_pb.NetworkRequest, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; - sayHello(request: network_pb.NetworkRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; - sayHello(request: network_pb.NetworkRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; -} - -export class NetworkerClient extends grpc.Client implements INetworkerClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: object); - public sayHello(request: network_pb.NetworkRequest, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; - public sayHello(request: network_pb.NetworkRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; - public sayHello(request: network_pb.NetworkRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: network_pb.NetworkReply) => void): grpc.ClientUnaryCall; -} diff --git a/network/network_grpc_pb.js b/network/network_grpc_pb.js deleted file mode 100644 index 1fc0e0b..0000000 --- a/network/network_grpc_pb.js +++ /dev/null @@ -1,45 +0,0 @@ -// GENERATED CODE -- DO NOT EDIT! - -'use strict'; -var grpc = require('grpc'); -var network_pb = require('./network_pb.js'); - -function serialize_oddscrawler_NetworkReply(arg) { - if (!(arg instanceof network_pb.NetworkReply)) { - throw new Error('Expected argument of type oddscrawler.NetworkReply'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_oddscrawler_NetworkReply(buffer_arg) { - return network_pb.NetworkReply.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_oddscrawler_NetworkRequest(arg) { - if (!(arg instanceof network_pb.NetworkRequest)) { - throw new Error('Expected argument of type oddscrawler.NetworkRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_oddscrawler_NetworkRequest(buffer_arg) { - return network_pb.NetworkRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - - -var NetworkerService = exports.NetworkerService = { - // Sends a greeting - sayHello: { - path: '/oddscrawler.Networker/SayHello', - requestStream: false, - responseStream: false, - requestType: network_pb.NetworkRequest, - responseType: network_pb.NetworkReply, - requestSerialize: serialize_oddscrawler_NetworkRequest, - requestDeserialize: deserialize_oddscrawler_NetworkRequest, - responseSerialize: serialize_oddscrawler_NetworkReply, - responseDeserialize: deserialize_oddscrawler_NetworkReply, - }, -}; - -exports.NetworkerClient = grpc.makeGenericClientConstructor(NetworkerService); diff --git a/network/network_pb.d.ts b/network/network_pb.d.ts deleted file mode 100644 index 0b9030b..0000000 --- a/network/network_pb.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// package: oddscrawler -// file: network.proto - -/* tslint:disable */ - -import * as jspb from "google-protobuf"; - -export class NetworkRequest extends jspb.Message { - getName(): string; - setName(value: string): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NetworkRequest.AsObject; - static toObject(includeInstance: boolean, msg: NetworkRequest): NetworkRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NetworkRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NetworkRequest; - static deserializeBinaryFromReader(message: NetworkRequest, reader: jspb.BinaryReader): NetworkRequest; -} - -export namespace NetworkRequest { - export type AsObject = { - name: string, - } -} - -export class NetworkReply extends jspb.Message { - getMessage(): string; - setMessage(value: string): void; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): NetworkReply.AsObject; - static toObject(includeInstance: boolean, msg: NetworkReply): NetworkReply.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: NetworkReply, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): NetworkReply; - static deserializeBinaryFromReader(message: NetworkReply, reader: jspb.BinaryReader): NetworkReply; -} - -export namespace NetworkReply { - export type AsObject = { - message: string, - } -} diff --git a/network/network_pb.js b/network/network_pb.js deleted file mode 100644 index 852db88..0000000 --- a/network/network_pb.js +++ /dev/null @@ -1,300 +0,0 @@ -/** - * @fileoverview - * @enhanceable - * @suppress {messageConventions} JS Compiler reports an error if a variable or - * field starts with 'MSG_' and isn't a translatable message. - * @public - */ -// GENERATED CODE -- DO NOT EDIT! - -var jspb = require('google-protobuf'); -var goog = jspb; -var global = Function('return this')(); - -goog.exportSymbol('proto.oddscrawler.NetworkReply', null, global); -goog.exportSymbol('proto.oddscrawler.NetworkRequest', null, global); - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.oddscrawler.NetworkRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.oddscrawler.NetworkRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.oddscrawler.NetworkRequest.displayName = 'proto.oddscrawler.NetworkRequest'; -} - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ -proto.oddscrawler.NetworkRequest.prototype.toObject = function(opt_includeInstance) { - return proto.oddscrawler.NetworkRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.oddscrawler.NetworkRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.oddscrawler.NetworkRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.oddscrawler.NetworkRequest} - */ -proto.oddscrawler.NetworkRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.oddscrawler.NetworkRequest; - return proto.oddscrawler.NetworkRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.oddscrawler.NetworkRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.oddscrawler.NetworkRequest} - */ -proto.oddscrawler.NetworkRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.oddscrawler.NetworkRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.oddscrawler.NetworkRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.oddscrawler.NetworkRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.oddscrawler.NetworkRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.oddscrawler.NetworkRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** @param {string} value */ -proto.oddscrawler.NetworkRequest.prototype.setName = function(value) { - jspb.Message.setProto3StringField(this, 1, value); -}; - - - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.oddscrawler.NetworkReply = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.oddscrawler.NetworkReply, jspb.Message); -if (goog.DEBUG && !COMPILED) { - proto.oddscrawler.NetworkReply.displayName = 'proto.oddscrawler.NetworkReply'; -} - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto suitable for use in Soy templates. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. - * @param {boolean=} opt_includeInstance Whether to include the JSPB instance - * for transitional soy proto support: http://goto/soy-param-migration - * @return {!Object} - */ -proto.oddscrawler.NetworkReply.prototype.toObject = function(opt_includeInstance) { - return proto.oddscrawler.NetworkReply.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Whether to include the JSPB - * instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.oddscrawler.NetworkReply} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.oddscrawler.NetworkReply.toObject = function(includeInstance, msg) { - var f, obj = { - message: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.oddscrawler.NetworkReply} - */ -proto.oddscrawler.NetworkReply.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.oddscrawler.NetworkReply; - return proto.oddscrawler.NetworkReply.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.oddscrawler.NetworkReply} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.oddscrawler.NetworkReply} - */ -proto.oddscrawler.NetworkReply.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setMessage(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.oddscrawler.NetworkReply.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.oddscrawler.NetworkReply.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.oddscrawler.NetworkReply} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.oddscrawler.NetworkReply.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getMessage(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string message = 1; - * @return {string} - */ -proto.oddscrawler.NetworkReply.prototype.getMessage = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** @param {string} value */ -proto.oddscrawler.NetworkReply.prototype.setMessage = function(value) { - jspb.Message.setProto3StringField(this, 1, value); -}; - - -goog.object.extend(exports, proto.oddscrawler); diff --git a/package.json b/package.json index fd048ac..d8bf045 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "repository": "https://git.loafle.net/odds_crawler/odds-crawler-proto.git", "license": "MIT", "devDependencies": { - "grpc-tools": "^1.7.3", "grpc_tools_node_protoc_ts": "^2.5.0" } } diff --git a/proto_go.sh b/script/proto_go.sh similarity index 78% rename from proto_go.sh rename to script/proto_go.sh index d43245f..6dee45c 100755 --- a/proto_go.sh +++ b/script/proto_go.sh @@ -4,4 +4,4 @@ set -eu TARGET_DIR=$1 -protoc -I ${TARGET_DIR}/ ${TARGET_DIR}/*.proto --go_out=plugins=grpc:${TARGET_DIR} +protoc -I ${TARGET_DIR}/ ${TARGET_DIR}/*.proto --go_out=plugins=grpc:${TARGET_DIR}/generated diff --git a/proto_typescript.sh b/script/proto_typescript.sh similarity index 67% rename from proto_typescript.sh rename to script/proto_typescript.sh index 5e5c5fd..39efd75 100755 --- a/proto_typescript.sh +++ b/script/proto_typescript.sh @@ -5,14 +5,14 @@ set -eu TARGET_DIR=$1 ./node_modules/.bin/grpc_tools_node_protoc \ - --js_out=import_style=commonjs,binary:${TARGET_DIR} \ - --grpc_out=${TARGET_DIR} \ + --js_out=import_style=commonjs,binary:${TARGET_DIR}/generated \ + --grpc_out=${TARGET_DIR}/generated \ --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \ -I ${TARGET_DIR} \ ${TARGET_DIR}/*.proto ./node_modules/.bin/grpc_tools_node_protoc \ --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ - --ts_out=${TARGET_DIR} \ + --ts_out=${TARGET_DIR}/generated \ -I ${TARGET_DIR} \ - ${TARGET_DIR}/*.proto \ No newline at end of file + ${TARGET_DIR}/*.proto