diff --git a/package.json b/package.json index d8bf045..fd048ac 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "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/pkg/.gitkeep b/pkg/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pkg/api/.gitkeep b/pkg/api/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pkg/api/v1/.gitkeep b/pkg/api/v1/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pkg/api/v1/cdp-service.pb.go b/pkg/api/v1/cdp-service.pb.go new file mode 100644 index 0000000..228a8c4 --- /dev/null +++ b/pkg/api/v1/cdp-service.pb.go @@ -0,0 +1,319 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: cdp-service.proto + +package v1 + +import ( + context "context" + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + 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_2d5fb18e228de6bf, []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=v1.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_2d5fb18e228de6bf, []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_2d5fb18e228de6bf, []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("v1.TransitionType", TransitionType_name, TransitionType_value) + proto.RegisterType((*NavigateRequest)(nil), "v1.NavigateRequest") + proto.RegisterType((*NavigateReply)(nil), "v1.NavigateReply") +} + +func init() { proto.RegisterFile("cdp-service.proto", fileDescriptor_2d5fb18e228de6bf) } + +var fileDescriptor_2d5fb18e228de6bf = []byte{ + // 389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x92, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x86, 0x71, 0x92, 0x26, 0xf1, 0x84, 0x24, 0x9b, 0xa9, 0x90, 0xac, 0x08, 0x89, 0xaa, 0xa7, + 0x0a, 0x89, 0x54, 0x0d, 0x37, 0x4e, 0x48, 0x70, 0xe9, 0x05, 0xa1, 0x90, 0x7b, 0xb4, 0xce, 0x8e, + 0x8d, 0xe5, 0xb5, 0x77, 0x19, 0xaf, 0x0d, 0x7e, 0x10, 0x9e, 0x8f, 0x57, 0x41, 0x76, 0x71, 0x8c, + 0x7b, 0xf3, 0xff, 0xfb, 0x9f, 0xd9, 0x6f, 0x77, 0x06, 0x36, 0x67, 0x65, 0xdf, 0x15, 0xc4, 0x55, + 0x72, 0xa6, 0x9d, 0x65, 0xe3, 0x0c, 0x8e, 0xaa, 0x87, 0xed, 0x9b, 0xd8, 0x98, 0x58, 0xd3, 0x7d, + 0xeb, 0x84, 0x65, 0x74, 0xef, 0x92, 0x8c, 0x0a, 0x27, 0x33, 0xfb, 0x14, 0xba, 0xfd, 0xed, 0xc1, + 0xfa, 0x8b, 0xac, 0x92, 0x58, 0x3a, 0x3a, 0xd0, 0x8f, 0x92, 0x0a, 0x87, 0x02, 0xc6, 0x25, 0xeb, + 0xc0, 0xbb, 0xf1, 0xee, 0xfc, 0x43, 0xf3, 0x89, 0x5b, 0x98, 0x33, 0x45, 0xc4, 0x4c, 0x1c, 0x8c, + 0x5a, 0xfb, 0xa2, 0xf1, 0x03, 0xac, 0x1c, 0xcb, 0xbc, 0x48, 0x5c, 0x62, 0xf2, 0x63, 0x6d, 0x29, + 0x18, 0xdf, 0x78, 0x77, 0xab, 0x3d, 0xee, 0xaa, 0x87, 0xdd, 0x71, 0xf0, 0xe7, 0xf0, 0x2c, 0x89, + 0x01, 0xcc, 0x22, 0x96, 0x19, 0x3d, 0xaa, 0x60, 0xd2, 0xb6, 0xed, 0xe4, 0xed, 0x19, 0x96, 0x3d, + 0x96, 0xd5, 0xf5, 0xff, 0x51, 0x6f, 0x10, 0x6d, 0xe0, 0xb4, 0x91, 0x8a, 0xf8, 0x51, 0x75, 0x70, + 0x9d, 0xc6, 0xd7, 0xe0, 0x13, 0xb3, 0xe1, 0x23, 0xfd, 0x72, 0x2d, 0x97, 0x7f, 0xe8, 0x8d, 0xb7, + 0x7f, 0x3c, 0x58, 0x0d, 0x09, 0x71, 0x0e, 0x13, 0x9d, 0xe4, 0xa9, 0x78, 0x81, 0x3e, 0x5c, 0xb9, + 0xda, 0x92, 0x12, 0x1e, 0xae, 0x61, 0x21, 0x95, 0x62, 0x2a, 0x8a, 0x53, 0x28, 0x59, 0x8c, 0x70, + 0x03, 0x4b, 0x59, 0x3a, 0x73, 0x0a, 0x8d, 0x49, 0x33, 0xc9, 0xa9, 0x18, 0x5f, 0xac, 0xa2, 0x0c, + 0x5b, 0x30, 0x31, 0xc1, 0x6b, 0x58, 0x67, 0x32, 0x2f, 0xa5, 0xee, 0xcd, 0x2b, 0x5c, 0x82, 0x1f, + 0x53, 0x4e, 0x2c, 0x1d, 0x29, 0x31, 0xbd, 0x94, 0x39, 0x63, 0x35, 0x55, 0xa4, 0xc5, 0xac, 0x39, + 0x2d, 0x32, 0x9c, 0x35, 0x45, 0x59, 0xe2, 0xc4, 0x1c, 0x01, 0xa6, 0x4c, 0xcd, 0x95, 0x84, 0x8f, + 0x0b, 0x98, 0xa5, 0x54, 0xff, 0x34, 0xac, 0x04, 0xe0, 0x2b, 0xd8, 0xfc, 0x13, 0xa7, 0xbe, 0xe7, + 0xa2, 0x21, 0x37, 0xee, 0x3b, 0xb1, 0x78, 0xb9, 0xff, 0x08, 0xf0, 0xe9, 0xf3, 0xd7, 0x6f, 0x4f, + 0x7b, 0x81, 0x7b, 0x98, 0x77, 0x8f, 0x8a, 0xd7, 0xcd, 0x78, 0x9e, 0x4d, 0x7e, 0xbb, 0x19, 0x9a, + 0x56, 0xd7, 0xe1, 0xb4, 0xdd, 0x93, 0xf7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x60, 0xab, 0x50, + 0x6c, 0x61, 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, "/v1.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: "/v1.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: "v1.CDPService", + HandlerType: (*CDPServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Navigate", + Handler: _CDPService_Navigate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cdp-service.proto", +} diff --git a/pkg/api/v1/cdp-service_grpc_pb.d.ts b/pkg/api/v1/cdp-service_grpc_pb.d.ts new file mode 100644 index 0000000..f3dfa81 --- /dev/null +++ b/pkg/api/v1/cdp-service_grpc_pb.d.ts @@ -0,0 +1,41 @@ +// package: v1 +// file: cdp-service.proto + +/* tslint:disable */ + +import * as grpc from "grpc"; +import * as cdp_service_pb from "./cdp-service_pb"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +interface ICDPServiceService extends grpc.ServiceDefinition { + navigate: ICDPServiceService_INavigate; +} + +interface ICDPServiceService_INavigate extends grpc.MethodDefinition { + path: string; // "/v1.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_service_pb.NavigateRequest, callback: (error: grpc.ServiceError | null, response: cdp_service_pb.NavigateReply) => void): grpc.ClientUnaryCall; + navigate(request: cdp_service_pb.NavigateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cdp_service_pb.NavigateReply) => void): grpc.ClientUnaryCall; + navigate(request: cdp_service_pb.NavigateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cdp_service_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_service_pb.NavigateRequest, callback: (error: grpc.ServiceError | null, response: cdp_service_pb.NavigateReply) => void): grpc.ClientUnaryCall; + public navigate(request: cdp_service_pb.NavigateRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cdp_service_pb.NavigateReply) => void): grpc.ClientUnaryCall; + public navigate(request: cdp_service_pb.NavigateRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cdp_service_pb.NavigateReply) => void): grpc.ClientUnaryCall; +} diff --git a/pkg/api/v1/cdp-service_grpc_pb.js b/pkg/api/v1/cdp-service_grpc_pb.js new file mode 100644 index 0000000..17adf4e --- /dev/null +++ b/pkg/api/v1/cdp-service_grpc_pb.js @@ -0,0 +1,45 @@ +// GENERATED CODE -- DO NOT EDIT! + +'use strict'; +var grpc = require('grpc'); +var cdp$service_pb = require('./cdp-service_pb.js'); +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); + +function serialize_v1_NavigateReply(arg) { + if (!(arg instanceof cdp$service_pb.NavigateReply)) { + throw new Error('Expected argument of type v1.NavigateReply'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_v1_NavigateReply(buffer_arg) { + return cdp$service_pb.NavigateReply.deserializeBinary(new Uint8Array(buffer_arg)); +} + +function serialize_v1_NavigateRequest(arg) { + if (!(arg instanceof cdp$service_pb.NavigateRequest)) { + throw new Error('Expected argument of type v1.NavigateRequest'); + } + return Buffer.from(arg.serializeBinary()); +} + +function deserialize_v1_NavigateRequest(buffer_arg) { + return cdp$service_pb.NavigateRequest.deserializeBinary(new Uint8Array(buffer_arg)); +} + + +var CDPServiceService = exports.CDPServiceService = { + navigate: { + path: '/v1.CDPService/Navigate', + requestStream: false, + responseStream: false, + requestType: cdp$service_pb.NavigateRequest, + responseType: cdp$service_pb.NavigateReply, + requestSerialize: serialize_v1_NavigateRequest, + requestDeserialize: deserialize_v1_NavigateRequest, + responseSerialize: serialize_v1_NavigateReply, + responseDeserialize: deserialize_v1_NavigateReply, + }, +}; + +exports.CDPServiceClient = grpc.makeGenericClientConstructor(CDPServiceService); diff --git a/pkg/api/v1/cdp-service_pb.d.ts b/pkg/api/v1/cdp-service_pb.d.ts new file mode 100644 index 0000000..81667b5 --- /dev/null +++ b/pkg/api/v1/cdp-service_pb.d.ts @@ -0,0 +1,85 @@ +// package: v1 +// file: cdp-service.proto + +/* tslint:disable */ + +import * as jspb from "google-protobuf"; +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +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/pkg/api/v1/cdp-service_pb.js b/pkg/api/v1/cdp-service_pb.js new file mode 100644 index 0000000..c590b46 --- /dev/null +++ b/pkg/api/v1/cdp-service_pb.js @@ -0,0 +1,465 @@ +/** + * @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')(); + +var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); +goog.object.extend(proto, google_protobuf_timestamp_pb); +goog.exportSymbol('proto.v1.NavigateReply', null, global); +goog.exportSymbol('proto.v1.NavigateRequest', null, global); +goog.exportSymbol('proto.v1.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.v1.NavigateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.v1.NavigateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.v1.NavigateRequest.displayName = 'proto.v1.NavigateRequest'; +} +/** + * 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.v1.NavigateReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.v1.NavigateReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.v1.NavigateReply.displayName = 'proto.v1.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.v1.NavigateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.v1.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.v1.NavigateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.v1.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.v1.NavigateRequest} + */ +proto.v1.NavigateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.v1.NavigateRequest; + return proto.v1.NavigateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.v1.NavigateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.v1.NavigateRequest} + */ +proto.v1.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.v1.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.v1.NavigateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.v1.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.v1.NavigateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.v1.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.v1.NavigateRequest.prototype.getUrl = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateRequest.prototype.setUrl = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string referrer = 2; + * @return {string} + */ +proto.v1.NavigateRequest.prototype.getReferrer = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateRequest.prototype.setReferrer = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional TransitionType transitionType = 3; + * @return {!proto.v1.TransitionType} + */ +proto.v1.NavigateRequest.prototype.getTransitiontype = function() { + return /** @type {!proto.v1.TransitionType} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** @param {!proto.v1.TransitionType} value */ +proto.v1.NavigateRequest.prototype.setTransitiontype = function(value) { + jspb.Message.setProto3EnumField(this, 3, value); +}; + + +/** + * optional string frameId = 4; + * @return {string} + */ +proto.v1.NavigateRequest.prototype.getFrameid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateRequest.prototype.setFrameid = function(value) { + jspb.Message.setProto3StringField(this, 4, value); +}; + + + + + +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.v1.NavigateReply.prototype.toObject = function(opt_includeInstance) { + return proto.v1.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.v1.NavigateReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.v1.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.v1.NavigateReply} + */ +proto.v1.NavigateReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.v1.NavigateReply; + return proto.v1.NavigateReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.v1.NavigateReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.v1.NavigateReply} + */ +proto.v1.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.v1.NavigateReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.v1.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.v1.NavigateReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.v1.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.v1.NavigateReply.prototype.getFrameid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateReply.prototype.setFrameid = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string loaderId = 2; + * @return {string} + */ +proto.v1.NavigateReply.prototype.getLoaderid = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateReply.prototype.setLoaderid = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string errorText = 3; + * @return {string} + */ +proto.v1.NavigateReply.prototype.getErrortext = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** @param {string} value */ +proto.v1.NavigateReply.prototype.setErrortext = function(value) { + jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * @enum {number} + */ +proto.v1.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.v1); diff --git a/third_party/protoc-gen-go.cmd b/third_party/protoc-gen-go.cmd index 4eea9e4..2aa0ab0 100644 --- a/third_party/protoc-gen-go.cmd +++ b/third_party/protoc-gen-go.cmd @@ -1 +1 @@ -protoc --proto_path=api/proto/v1 --proto_path=third_party --go_out=plugins=grpc:pkg/api/v1 *.proto +protoc --proto_path=api/proto/v1 --proto_path=third_party --go_out=plugins=grpc:pkg/api/v1 -I api/proto/v1 api/proto/v1/*.proto diff --git a/third_party/protoc-gen-go.sh b/third_party/protoc-gen-go.sh old mode 100644 new mode 100755 index 91a40ab..42dfd9d --- a/third_party/protoc-gen-go.sh +++ b/third_party/protoc-gen-go.sh @@ -2,4 +2,4 @@ set -eu -protoc --proto_path=api/proto/v1 --proto_path=third_party --go_out=plugins=grpc:pkg/api/v1 *.proto +protoc --proto_path=api/proto/v1 --proto_path=third_party --go_out=plugins=grpc:pkg/api/v1 -I api/proto/v1 api/proto/v1/*.proto diff --git a/third_party/protoc-gen-ts.sh b/third_party/protoc-gen-ts.sh old mode 100644 new mode 100755 index 52733e7..9a34dd9 --- a/third_party/protoc-gen-ts.sh +++ b/third_party/protoc-gen-ts.sh @@ -2,19 +2,33 @@ set -eu -TARGET_DIR=$1 +# ./node_modules/.bin/grpc_tools_node_protoc \ +# --js_out=import_style=commonjs,binary:pkg/api/v1 \ +# --grpc_out=pkg/api/v1 \ +# --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \ +# --proto_path=api/proto/v1 +# --proto_path=third_party +# -I api/proto/v1 api/proto/v1/*.proto -./node_modules/.bin/grpc_tools_node_protoc \ - --proto_path=api/proto/v1 - --proto_path=third_party - --js_out=import_style=commonjs,binary:pkg/api/v1 \ - --grpc_out=pkg/api/v1 \ - --plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \ - *.proto +# ./node_modules/.bin/grpc_tools_node_protoc \ +# --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ +# --ts_out=pkg/api/v1 \ +# --proto_path=api/proto/v1 +# --proto_path=third_party +# -I api/proto/v1 api/proto/v1/*.proto -./node_modules/.bin/grpc_tools_node_protoc \ - --proto_path=api/proto/v1 - --proto_path=third_party - --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ - --ts_out=pkg/api/v1 \ - *.proto +PLUGIN_TS=./node_modules/.bin/protoc-gen-ts +PLUGIN_GRPC=./node_modules/.bin/grpc_tools_node_protoc_plugin +SRC_DIR=./api/proto/v1 +DIST_DIR=./pkg/api/v1 + +protoc \ +--js_out=import_style=commonjs,binary:"${DIST_DIR}"/ \ +--ts_out=import_style=commonjs,binary:"${DIST_DIR}"/ \ +--grpc_out="${DIST_DIR}"/ \ +--plugin=protoc-gen-grpc="${PLUGIN_GRPC}" \ +--plugin=protoc-gen-ts="${PLUGIN_TS}" \ +--proto_path=${SRC_DIR} \ +--proto_path=third_party \ +-I ${DIST_DIR} \ +${SRC_DIR}/*.proto \ No newline at end of file