diff --git a/taxi/grpc/service/default_routes.json b/taxi/default_bus_routes.json similarity index 100% rename from taxi/grpc/service/default_routes.json rename to taxi/default_bus_routes.json diff --git a/taxi/docker-compose.yaml b/taxi/docker-compose.yaml index 33d7076..60bdbbf 100644 --- a/taxi/docker-compose.yaml +++ b/taxi/docker-compose.yaml @@ -12,7 +12,7 @@ services: - 7190:7190 volumes: - ./zilla.yaml:/etc/zilla/zilla.yaml - - ./grpc/taxi_route.proto:/etc/zilla/proto/taxi_route.proto + - ./taxi_route.proto:/etc/zilla/proto/taxi_route.proto environment: TAXI_ROUTE_SERVER_HOST: taxi-service TAXI_ROUTE_SERVER_PORT: 50051 @@ -21,9 +21,8 @@ services: command: start -v -e -Pzilla.engine.worker.capacity=512 taxi-gateway: - build: ./grpc/gateway + image: ghcr.io/aklivity/extras-taxi-gateway:sha-5ac7a9c container_name: taxi-gateway - image: aklivity/taxi-gateway:local restart: unless-stopped depends_on: - zilla @@ -34,14 +33,13 @@ services: - 8085:8085 taxi-service: - build: ./grpc/service + image: ghcr.io/aklivity/extras-taxi-service:sha-5ac7a9c container_name: taxi-service - image: aklivity/taxi-service:local restart: unless-stopped depends_on: - zilla volumes: - - ./grpc/service/default_routes.json:/usr/src/app/default_routes.json + - ./default_bus_routes.json:/usr/src/app/default_routes.json environment: PRINT_SIM_LOGS: false DEFAUlT_ROUTES: true @@ -50,9 +48,8 @@ services: - 50051:50051 taxi-map-ui: - build: ./map-ui + image: ghcr.io/aklivity/extras-taxi-map-ui:sha-5ac7a9c container_name: taxi-map-ui - image: aklivity/taxi-map-ui:local restart: unless-stopped depends_on: - zilla diff --git a/taxi/grpc/buf.gen.yaml b/taxi/grpc/buf.gen.yaml deleted file mode 100644 index d6b0dad..0000000 --- a/taxi/grpc/buf.gen.yaml +++ /dev/null @@ -1,27 +0,0 @@ -version: v1 -plugins: - - plugin: buf.build/protocolbuffers/go:v1.31.0 - out: gateway/taxiroute - opt: - - paths=source_relative - - plugin: buf.build/grpc/go:v1.3.0 - out: gateway/taxiroute - opt: - - paths=source_relative - - plugin: buf.build/grpc-ecosystem/gateway:v2.16.2 - out: gateway/taxiroute - opt: - - paths=source_relative - - generate_unbound_methods=true - - plugin: buf.build/grpc-ecosystem/openapiv2:v2.16.2 - out: gateway/taxiroute/openapiv2 - opt: - - generate_unbound_methods=true - - plugin: buf.build/protocolbuffers/go:v1.31.0 - out: service/taxiroute - opt: - - paths=source_relative - - plugin: buf.build/grpc/go:v1.3.0 - out: service/taxiroute - opt: - - paths=source_relative diff --git a/taxi/grpc/buf.lock b/taxi/grpc/buf.lock deleted file mode 100644 index 2c3ca1c..0000000 --- a/taxi/grpc/buf.lock +++ /dev/null @@ -1,13 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: googleapis - repository: googleapis - commit: 28151c0d0a1641bf938a7672c500e01d - digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de - - remote: buf.build - owner: grpc-ecosystem - repository: grpc-gateway - commit: f460f71081c14a80b66cc72526e0b322 - digest: shake256:122def85e91fc3ef4ab351680060b8f70e9d09a7ae6d1412aeb2bddfeee5c4d3fc8819da33fef56192cec0a817ac0c3e6d49bb2acf02eb5c9e9131739a60ddfc diff --git a/taxi/grpc/buf.yaml b/taxi/grpc/buf.yaml deleted file mode 100644 index 31a65f7..0000000 --- a/taxi/grpc/buf.yaml +++ /dev/null @@ -1,8 +0,0 @@ -version: v1 -name: buf.build/aklivity/taxi-demo -deps: - - buf.build/googleapis/googleapis - - buf.build/grpc-ecosystem/grpc-gateway -lint: - use: - - DEFAULT diff --git a/taxi/grpc/gateway/Dockerfile b/taxi/grpc/gateway/Dockerfile deleted file mode 100644 index 6eb5d88..0000000 --- a/taxi/grpc/gateway/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM golang:1.21-alpine AS build -WORKDIR /src -COPY . . -RUN go build -o /bin/gateway ./main.go - -FROM alpine -COPY --from=build /bin/gateway /usr/bin/gateway -EXPOSE 8085 -CMD ["gateway", "-logtostderr=true"] diff --git a/taxi/grpc/gateway/go.mod b/taxi/grpc/gateway/go.mod deleted file mode 100644 index edcf494..0000000 --- a/taxi/grpc/gateway/go.mod +++ /dev/null @@ -1,22 +0,0 @@ -module github.com/aklivity/zilla-demos/taxi/grpc/gateway - -go 1.21.0 - -require ( - github.com/caitlinelfring/go-env-default v1.1.0 - github.com/golang/glog v1.1.2 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 - github.com/rs/cors v1.10.0 - google.golang.org/grpc v1.57.1 - google.golang.org/protobuf v1.31.0 -) - -require ( - github.com/golang/protobuf v1.5.3 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect -) diff --git a/taxi/grpc/gateway/go.sum b/taxi/grpc/gateway/go.sum deleted file mode 100644 index 97c76dc..0000000 --- a/taxi/grpc/gateway/go.sum +++ /dev/null @@ -1,33 +0,0 @@ -github.com/caitlinelfring/go-env-default v1.1.0 h1:bhDfXmUolvcIGfQCX8qevQX8wxC54NGz0aimoUnhvDM= -github.com/caitlinelfring/go-env-default v1.1.0/go.mod h1:tESXPr8zFPP/cRy3cwxrHBmjJIf2A1x/o4C9CET2rEk= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1 h1:LSsiG61v9IzzxMkqEr6nrix4miJI62xlRjwT7BYD2SM= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.17.1/go.mod h1:Hbb13e3/WtqQ8U5hLGkek9gJvBLasHuPFI0UEGfnQ10= -github.com/rs/cors v1.10.0 h1:62NOS1h+r8p1mW6FM0FSB0exioXLhd/sh15KpjWBZ+8= -github.com/rs/cors v1.10.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/taxi/grpc/gateway/main.go b/taxi/grpc/gateway/main.go deleted file mode 100644 index ad5f0d7..0000000 --- a/taxi/grpc/gateway/main.go +++ /dev/null @@ -1,62 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "net/http" - - "github.com/golang/glog" - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/rs/cors" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - - gw "github.com/aklivity/zilla-demos/taxi/grpc/gateway/taxiroute" // Update - env "github.com/caitlinelfring/go-env-default" -) - -var ( - // command-line options: - // gRPC server endpoint - grpcServerEndpoint = env.GetDefault("GRPC_SERVER_ENDPOINT", "localhost:7114") - gatewayPort = env.GetIntDefault("GATEWAY_PORT", 8085) -) - -func run() error { - ctx := context.Background() - ctx, cancel := context.WithCancel(ctx) - defer cancel() - - // Register gRPC server endpoint - // Note: Make sure the gRPC server is running properly and accessible - mux := runtime.NewServeMux() - opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} - err := gw.RegisterTaxiRouteHandlerFromEndpoint(ctx, mux, grpcServerEndpoint, opts) - if err != nil { - return err - } - - handler := cors.New(cors.Options{ - AllowedOrigins: []string{"*"}, - AllowedMethods: []string{ - http.MethodPost, - http.MethodGet, - }, - AllowedHeaders: []string{"*"}, - AllowCredentials: false, - }).Handler(mux) - - // Start HTTP server (and proxy calls to gRPC server endpoint) - glog.Info("running on :", gatewayPort) - return http.ListenAndServe(fmt.Sprintf(":%d", gatewayPort), handler) -} - -func main() { - flag.Parse() - defer glog.Flush() - - if err := run(); err != nil { - glog.Fatal(err) - } -} diff --git a/taxi/grpc/gateway/taxiroute/openapiv2/taxi_route.swagger.json b/taxi/grpc/gateway/taxiroute/openapiv2/taxi_route.swagger.json deleted file mode 100644 index c2728b0..0000000 --- a/taxi/grpc/gateway/taxiroute/openapiv2/taxi_route.swagger.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "taxi_route.proto", - "version": "version not set" - }, - "tags": [ - { - "name": "TaxiRoute" - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/taxiroute.TaxiRoute/CreateTaxi": { - "post": { - "operationId": "TaxiRoute_CreateTaxi", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/taxirouteRouteResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/taxirouteRoute" - } - } - ], - "tags": [ - "TaxiRoute" - ] - } - } - }, - "definitions": { - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - }, - "protobufNullValue": { - "type": "string", - "enum": [ - "NULL_VALUE" - ], - "default": "NULL_VALUE", - "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value." - }, - "rpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - }, - "taxirouteRoute": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "bbox": { - "type": "array", - "items": { - "type": "number", - "format": "double" - } - }, - "distance": { - "type": "number", - "format": "double" - }, - "duration": { - "type": "number", - "format": "double" - }, - "coordinates": { - "type": "array", - "items": { - "type": "array", - "items": { - "type": "object" - } - } - } - } - }, - "taxirouteRouteResponse": { - "type": "object", - "properties": { - "topic": { - "type": "string" - } - } - } - } -} diff --git a/taxi/grpc/gateway/taxiroute/taxi_route.pb.go b/taxi/grpc/gateway/taxiroute/taxi_route.pb.go deleted file mode 100644 index 88cd491..0000000 --- a/taxi/grpc/gateway/taxiroute/taxi_route.pb.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: taxi_route.proto - -package taxiroute - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/emptypb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Route struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Bbox []float64 `protobuf:"fixed64,2,rep,packed,name=bbox,proto3" json:"bbox,omitempty"` - Distance float64 `protobuf:"fixed64,3,opt,name=distance,proto3" json:"distance,omitempty"` - Duration float64 `protobuf:"fixed64,4,opt,name=duration,proto3" json:"duration,omitempty"` - Coordinates []*structpb.ListValue `protobuf:"bytes,5,rep,name=coordinates,proto3" json:"coordinates,omitempty"` -} - -func (x *Route) Reset() { - *x = Route{} - if protoimpl.UnsafeEnabled { - mi := &file_taxi_route_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Route) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Route) ProtoMessage() {} - -func (x *Route) ProtoReflect() protoreflect.Message { - mi := &file_taxi_route_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Route.ProtoReflect.Descriptor instead. -func (*Route) Descriptor() ([]byte, []int) { - return file_taxi_route_proto_rawDescGZIP(), []int{0} -} - -func (x *Route) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Route) GetBbox() []float64 { - if x != nil { - return x.Bbox - } - return nil -} - -func (x *Route) GetDistance() float64 { - if x != nil { - return x.Distance - } - return 0 -} - -func (x *Route) GetDuration() float64 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *Route) GetCoordinates() []*structpb.ListValue { - if x != nil { - return x.Coordinates - } - return nil -} - -type RouteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` -} - -func (x *RouteResponse) Reset() { - *x = RouteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_taxi_route_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteResponse) ProtoMessage() {} - -func (x *RouteResponse) ProtoReflect() protoreflect.Message { - mi := &file_taxi_route_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteResponse.ProtoReflect.Descriptor instead. -func (*RouteResponse) Descriptor() ([]byte, []int) { - return file_taxi_route_proto_rawDescGZIP(), []int{1} -} - -func (x *RouteResponse) GetTopic() string { - if x != nil { - return x.Topic - } - return "" -} - -var File_taxi_route_proto protoreflect.FileDescriptor - -var file_taxi_route_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x74, 0x61, 0x78, 0x69, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x09, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x1a, 0x1b, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x05, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x62, 0x6f, 0x78, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x01, 0x52, 0x04, 0x62, 0x62, 0x6f, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x3c, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x22, 0x25, - 0x0a, 0x0d, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x74, 0x6f, 0x70, 0x69, 0x63, 0x32, 0x47, 0x0a, 0x09, 0x54, 0x61, 0x78, 0x69, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x78, 0x69, - 0x12, 0x10, 0x2e, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x1a, 0x18, 0x2e, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x35, - 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x6b, 0x6c, - 0x69, 0x76, 0x69, 0x74, 0x79, 0x2f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2d, 0x64, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x74, 0x61, 0x78, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x78, 0x69, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_taxi_route_proto_rawDescOnce sync.Once - file_taxi_route_proto_rawDescData = file_taxi_route_proto_rawDesc -) - -func file_taxi_route_proto_rawDescGZIP() []byte { - file_taxi_route_proto_rawDescOnce.Do(func() { - file_taxi_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_taxi_route_proto_rawDescData) - }) - return file_taxi_route_proto_rawDescData -} - -var file_taxi_route_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_taxi_route_proto_goTypes = []interface{}{ - (*Route)(nil), // 0: taxiroute.Route - (*RouteResponse)(nil), // 1: taxiroute.RouteResponse - (*structpb.ListValue)(nil), // 2: google.protobuf.ListValue -} -var file_taxi_route_proto_depIdxs = []int32{ - 2, // 0: taxiroute.Route.coordinates:type_name -> google.protobuf.ListValue - 0, // 1: taxiroute.TaxiRoute.CreateTaxi:input_type -> taxiroute.Route - 1, // 2: taxiroute.TaxiRoute.CreateTaxi:output_type -> taxiroute.RouteResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_taxi_route_proto_init() } -func file_taxi_route_proto_init() { - if File_taxi_route_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_taxi_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Route); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_taxi_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_taxi_route_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_taxi_route_proto_goTypes, - DependencyIndexes: file_taxi_route_proto_depIdxs, - MessageInfos: file_taxi_route_proto_msgTypes, - }.Build() - File_taxi_route_proto = out.File - file_taxi_route_proto_rawDesc = nil - file_taxi_route_proto_goTypes = nil - file_taxi_route_proto_depIdxs = nil -} diff --git a/taxi/grpc/gateway/taxiroute/taxi_route.pb.gw.go b/taxi/grpc/gateway/taxiroute/taxi_route.pb.gw.go deleted file mode 100644 index dacb6d9..0000000 --- a/taxi/grpc/gateway/taxiroute/taxi_route.pb.gw.go +++ /dev/null @@ -1,171 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: taxi_route.proto - -/* -Package taxiroute is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package taxiroute - -import ( - "context" - "io" - "net/http" - - "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = metadata.Join - -func request_TaxiRoute_CreateTaxi_0(ctx context.Context, marshaler runtime.Marshaler, client TaxiRouteClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq Route - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CreateTaxi(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_TaxiRoute_CreateTaxi_0(ctx context.Context, marshaler runtime.Marshaler, server TaxiRouteServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq Route - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.CreateTaxi(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterTaxiRouteHandlerServer registers the http handlers for service TaxiRoute to "mux". -// UnaryRPC :call TaxiRouteServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTaxiRouteHandlerFromEndpoint instead. -func RegisterTaxiRouteHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TaxiRouteServer) error { - - mux.Handle("POST", pattern_TaxiRoute_CreateTaxi_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/taxiroute.TaxiRoute/CreateTaxi", runtime.WithHTTPPathPattern("/taxiroute.TaxiRoute/CreateTaxi")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_TaxiRoute_CreateTaxi_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_TaxiRoute_CreateTaxi_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterTaxiRouteHandlerFromEndpoint is same as RegisterTaxiRouteHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterTaxiRouteHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterTaxiRouteHandler(ctx, mux, conn) -} - -// RegisterTaxiRouteHandler registers the http handlers for service TaxiRoute to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterTaxiRouteHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterTaxiRouteHandlerClient(ctx, mux, NewTaxiRouteClient(conn)) -} - -// RegisterTaxiRouteHandlerClient registers the http handlers for service TaxiRoute -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TaxiRouteClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TaxiRouteClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "TaxiRouteClient" to call the correct interceptors. -func RegisterTaxiRouteHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TaxiRouteClient) error { - - mux.Handle("POST", pattern_TaxiRoute_CreateTaxi_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/taxiroute.TaxiRoute/CreateTaxi", runtime.WithHTTPPathPattern("/taxiroute.TaxiRoute/CreateTaxi")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_TaxiRoute_CreateTaxi_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_TaxiRoute_CreateTaxi_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_TaxiRoute_CreateTaxi_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"taxiroute.TaxiRoute", "CreateTaxi"}, "")) -) - -var ( - forward_TaxiRoute_CreateTaxi_0 = runtime.ForwardResponseMessage -) diff --git a/taxi/grpc/gateway/taxiroute/taxi_route_grpc.pb.go b/taxi/grpc/gateway/taxiroute/taxi_route_grpc.pb.go deleted file mode 100644 index e3aa368..0000000 --- a/taxi/grpc/gateway/taxiroute/taxi_route_grpc.pb.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: taxi_route.proto - -package taxiroute - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - TaxiRoute_CreateTaxi_FullMethodName = "/taxiroute.TaxiRoute/CreateTaxi" -) - -// TaxiRouteClient is the client API for TaxiRoute service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type TaxiRouteClient interface { - CreateTaxi(ctx context.Context, in *Route, opts ...grpc.CallOption) (*RouteResponse, error) -} - -type taxiRouteClient struct { - cc grpc.ClientConnInterface -} - -func NewTaxiRouteClient(cc grpc.ClientConnInterface) TaxiRouteClient { - return &taxiRouteClient{cc} -} - -func (c *taxiRouteClient) CreateTaxi(ctx context.Context, in *Route, opts ...grpc.CallOption) (*RouteResponse, error) { - out := new(RouteResponse) - err := c.cc.Invoke(ctx, TaxiRoute_CreateTaxi_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TaxiRouteServer is the server API for TaxiRoute service. -// All implementations must embed UnimplementedTaxiRouteServer -// for forward compatibility -type TaxiRouteServer interface { - CreateTaxi(context.Context, *Route) (*RouteResponse, error) - mustEmbedUnimplementedTaxiRouteServer() -} - -// UnimplementedTaxiRouteServer must be embedded to have forward compatible implementations. -type UnimplementedTaxiRouteServer struct { -} - -func (UnimplementedTaxiRouteServer) CreateTaxi(context.Context, *Route) (*RouteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTaxi not implemented") -} -func (UnimplementedTaxiRouteServer) mustEmbedUnimplementedTaxiRouteServer() {} - -// UnsafeTaxiRouteServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to TaxiRouteServer will -// result in compilation errors. -type UnsafeTaxiRouteServer interface { - mustEmbedUnimplementedTaxiRouteServer() -} - -func RegisterTaxiRouteServer(s grpc.ServiceRegistrar, srv TaxiRouteServer) { - s.RegisterService(&TaxiRoute_ServiceDesc, srv) -} - -func _TaxiRoute_CreateTaxi_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Route) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TaxiRouteServer).CreateTaxi(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: TaxiRoute_CreateTaxi_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TaxiRouteServer).CreateTaxi(ctx, req.(*Route)) - } - return interceptor(ctx, in, info, handler) -} - -// TaxiRoute_ServiceDesc is the grpc.ServiceDesc for TaxiRoute service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var TaxiRoute_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "taxiroute.TaxiRoute", - HandlerType: (*TaxiRouteServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateTaxi", - Handler: _TaxiRoute_CreateTaxi_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "taxi_route.proto", -} diff --git a/taxi/grpc/go.work b/taxi/grpc/go.work deleted file mode 100644 index db12580..0000000 --- a/taxi/grpc/go.work +++ /dev/null @@ -1,6 +0,0 @@ -go 1.21.0 - -use ( - ./gateway - ./service -) diff --git a/taxi/grpc/go.work.sum b/taxi/grpc/go.work.sum deleted file mode 100644 index 62183b9..0000000 --- a/taxi/grpc/go.work.sum +++ /dev/null @@ -1,144 +0,0 @@ -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= -cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= -cloud.google.com/go/aiplatform v1.48.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/analytics v0.21.3/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= -cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= -cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= -cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= -cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= -cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= -cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= -cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= -cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= -cloud.google.com/go/baremetalsolution v1.1.1/go.mod h1:D1AV6xwOksJMV4OSlWHtWuFNZZYujJknMAP4Qa27QIA= -cloud.google.com/go/batch v1.3.1/go.mod h1:VguXeQKXIYaeeIYbuozUmBR13AfL4SJP7IltNPS+A4A= -cloud.google.com/go/beyondcorp v1.0.0/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/bigquery v1.53.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= -cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= -cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= -cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= -cloud.google.com/go/cloudbuild v1.13.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= -cloud.google.com/go/cloudtasks v1.12.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/container v1.24.0/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= -cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= -cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= -cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= -cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= -cloud.google.com/go/dataplex v1.9.0/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataproc/v2 v2.0.1/go.mod h1:7Ez3KRHdFGcfY7GcevBbvozX+zyWGcwLJvvAMwCaoZ4= -cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= -cloud.google.com/go/datastore v1.13.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastream v1.10.0/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/deploy v1.13.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/dialogflow v1.40.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= -cloud.google.com/go/documentai v1.22.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= -cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= -cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= -cloud.google.com/go/firestore v1.12.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= -cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= -cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= -cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= -cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= -cloud.google.com/go/gkemulticloud v1.0.0/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= -cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= -cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= -cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= -cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= -cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= -cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= -cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= -cloud.google.com/go/maps v1.4.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= -cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= -cloud.google.com/go/metastore v1.12.0/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= -cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= -cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= -cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= -cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= -cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= -cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= -cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= -cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= -cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= -cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= -cloud.google.com/go/policytroubleshooter v1.8.0/go.mod h1:tmn5Ir5EToWe384EuboTcVQT7nTag2+DuH3uHmKd1HU= -cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= -cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= -cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= -cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= -cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= -cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= -cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= -cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= -cloud.google.com/go/run v1.2.0/go.mod h1:36V1IlDzQ0XxbQjUx6IYbw8H3TJnWvhii963WW3B/bo= -cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= -cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= -cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= -cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= -cloud.google.com/go/servicedirectory v1.11.0/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= -cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= -cloud.google.com/go/speech v1.19.0/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= -cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= -cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= -cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= -cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= -cloud.google.com/go/translate v1.8.2/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/video v1.19.0/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= -cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= -cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= -cloud.google.com/go/vmwareengine v1.0.0/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= -cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= -cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= -cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/taxi/grpc/service/Dockerfile b/taxi/grpc/service/Dockerfile deleted file mode 100644 index 92519f0..0000000 --- a/taxi/grpc/service/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM golang:1.21-alpine AS build -WORKDIR /src -COPY . . -RUN go build -o /bin/service ./main.go - -FROM python:3.11-alpine - -WORKDIR /usr/src/app - -COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt -COPY mqtt-simulator mqtt-simulator - -COPY --from=build /bin/service /usr/bin/service -EXPOSE 50051 -CMD ["service", "-logtostderr=true"] diff --git a/taxi/grpc/service/README.md b/taxi/grpc/service/README.md deleted file mode 100644 index 382eea3..0000000 --- a/taxi/grpc/service/README.md +++ /dev/null @@ -1,2 +0,0 @@ - -go run main.go -logtostderr=true diff --git a/taxi/grpc/service/default_routes_load_test.json b/taxi/grpc/service/default_routes_load_test.json deleted file mode 100644 index 1223ce8..0000000 --- a/taxi/grpc/service/default_routes_load_test.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "BROKER_URL": "zilla", - "BROKER_PORT": 7183, - "PROTOCOL_VERSION": 5, - "CLEAN_SESSION": false, - "QOS": 0, - "TOPICS": [ - { - "TYPE": "multiple", - "RANGE_START": 1, - "RANGE_END": 500, - "PREFIX": "Irish_Pub", - "TIME_INTERVAL": 15, - "DATA": [ - { - "NAME": "coordinate", - "PAYLOAD_ROOT": { "key": "Irish_Pub", "icon": "airport_shuttle" }, - "TYPE": "raw_values", - "VALUES": [ - [-121.888074, 37.328473, 29], - [-121.886911, 37.329319, 29], - [-121.886852, 37.329337, 29], - [-121.886696, 37.329454, 29], - [-121.886858, 37.329592, 29], - [-121.88737, 37.330014, 29], - [-121.88768, 37.33027, 28.9], - [-121.887763, 37.330342, 28.9], - [-121.887917, 37.330475, 28.8], - [-121.887981, 37.33053, 28.7], - [-121.88817, 37.330694, 28.6], - [-121.888328, 37.330859, 28.5], - [-121.888303, 37.331019, 28.5], - [-121.888469, 37.331252, 28.9], - [-121.888716, 37.331595, 30.1], - [-121.889845, 37.333084, 31.5], - [-121.889923, 37.333155, 31.1], - [-121.890059, 37.333205, 30.8], - [-121.890251, 37.333251, 30.4], - [-121.890395, 37.333318, 30], - [-121.890631, 37.333522, 29.1], - [-121.890706, 37.333628, 28.9], - [-121.891026, 37.334073, 27.8], - [-121.891197, 37.334308, 27.3], - [-121.891415, 37.334595, 27.1], - [-121.892223, 37.334207, 27.9], - [-121.892876, 37.335082, 30.1], - [-121.893036, 37.335005, 30.3], - [-121.893036, 37.335005, 30.3] - ] - } - ] - }, - { - "TYPE": "multiple", - "RANGE_START": 1, - "RANGE_END": 500, - "PREFIX": "ISO_Beers", - "TIME_INTERVAL": 10, - "DATA": [ - { - "NAME": "coordinate", - "PAYLOAD_ROOT": { "key": "ISO_Beers", "icon": "airport_shuttle" }, - "TYPE": "raw_values", - "VALUES": [ - [-121.888074, 37.328473, 29], - [-121.886911, 37.329319, 29], - [-121.886852, 37.329337, 29], - [-121.886696, 37.329454, 29], - [-121.886858, 37.329592, 29], - [-121.88737, 37.330014, 29], - [-121.88768, 37.33027, 28.9], - [-121.887763, 37.330342, 28.9], - [-121.887917, 37.330475, 28.8], - [-121.887981, 37.33053, 28.7], - [-121.88817, 37.330694, 28.6], - [-121.888328, 37.330859, 28.5], - [-121.887074, 37.331448, 28.3], - [-121.886361, 37.331789, 28.7], - [-121.885995, 37.331967, 28.8], - [-121.88499, 37.332454, 28.5], - [-121.885054, 37.332547, 28.4], - [-121.885284, 37.332846, 28.1], - [-121.885321, 37.332895, 28], - [-121.885411, 37.333013, 27.9], - [-121.885783, 37.333534, 27.3], - [-121.886346, 37.334275, 27], - [-121.886681, 37.33472, 27], - [-121.886836, 37.334931, 27], - [-121.887118, 37.335311, 27], - [-121.888366, 37.336979, 25.4], - [-121.888502, 37.337167, 25.1], - [-121.888913, 37.336971, 24.7], - [-121.889097, 37.336876, 24.6], - [-121.889146, 37.336852, 24.5], - [-121.889146, 37.336852, 24.5] - ] - } - ] - } - ] -} diff --git a/taxi/grpc/service/go.mod b/taxi/grpc/service/go.mod deleted file mode 100644 index 7bad74e..0000000 --- a/taxi/grpc/service/go.mod +++ /dev/null @@ -1,18 +0,0 @@ -module github.com/aklivity/zilla-demos/taxi/grpc/service - -go 1.21.0 - -require ( - github.com/caitlinelfring/go-env-default v1.1.0 - github.com/golang/glog v1.1.2 - google.golang.org/grpc v1.57.1 - google.golang.org/protobuf v1.31.0 -) - -require ( - github.com/golang/protobuf v1.5.3 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect -) diff --git a/taxi/grpc/service/go.sum b/taxi/grpc/service/go.sum deleted file mode 100644 index e89f380..0000000 --- a/taxi/grpc/service/go.sum +++ /dev/null @@ -1,25 +0,0 @@ -github.com/caitlinelfring/go-env-default v1.1.0 h1:bhDfXmUolvcIGfQCX8qevQX8wxC54NGz0aimoUnhvDM= -github.com/caitlinelfring/go-env-default v1.1.0/go.mod h1:tESXPr8zFPP/cRy3cwxrHBmjJIf2A1x/o4C9CET2rEk= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= diff --git a/taxi/grpc/service/main.go b/taxi/grpc/service/main.go deleted file mode 100644 index 5ee3464..0000000 --- a/taxi/grpc/service/main.go +++ /dev/null @@ -1,202 +0,0 @@ -package main - -import ( - "bufio" - "context" - "encoding/json" - "flag" - "fmt" - "io" - "net" - "os" - "os/exec" - - pb "github.com/aklivity/zilla-demos/taxi/grpc/service/taxiroute" - env "github.com/caitlinelfring/go-env-default" - "github.com/golang/glog" - "google.golang.org/grpc" - "google.golang.org/protobuf/encoding/protojson" -) - -var ( - servicePort = env.GetIntDefault("SERVICE_PORT", 50051) - brokerURL = env.GetDefault("BROKER_HOST", "localhost") - brokerPort = env.GetIntDefault("BROKER_PORT", 7183) - printSim = env.GetBoolDefault("PRINT_SIM_LOGS", false) - defaultRoutes = env.GetBoolDefault("DEFAUlT_ROUTES", false) - logChannel = make(chan string) -) - -type dataConfig struct { - Name string `json:"NAME"` - PayloadRoot any `json:"PAYLOAD_ROOT"` - Type string `json:"TYPE"` - Values [][]float64 `json:"VALUES"` -} - -type topicConfig struct { - Type string `json:"TYPE"` - Prefix string `json:"PREFIX"` - TimeInterval int `json:"TIME_INTERVAL"` - Data []dataConfig `json:"DATA"` -} - -type simulatorConfig struct { - BrokerURL string `json:"BROKER_URL"` - BrokerPort int `json:"BROKER_PORT"` - ProtocolVersion int `json:"PROTOCOL_VERSION"` - CleanSession bool `json:"CLEAN_SESSION"` - Qos int `json:"QOS"` - Topics []topicConfig `json:"TOPICS"` -} - -type taxiRouteServer struct { - pb.UnimplementedTaxiRouteServer -} - -func printStdPipe(pipe io.ReadCloser, ch chan string) { - go func(ch chan string) { - defer glog.Flush() - reader := bufio.NewReader(pipe) - for { - line, err := reader.ReadString('\n') - if err != nil { - glog.Fatal(err) - glog.Flush() - close(ch) - return - } - for err == nil { - glog.Info(line) - glog.Flush() - line, err = reader.ReadString('\n') - } - ch <- line - } - }(ch) -} - -func runSim(fileName string) { - defer glog.Flush() - cmd := exec.Command("python3", "mqtt-simulator/main.py", "-f", fileName) - glog.Info("python3", "mqtt-simulator/main.py", "-f", fileName) - pipe, _ := cmd.StdoutPipe() - pipeErr, _ := cmd.StderrPipe() - if err := cmd.Start(); err != nil { - glog.Fatal(err) - glog.Flush() - } - glog.Info("Running simulator for file: ", fileName) - if printSim { - printStdPipe(pipe, logChannel) - printStdPipe(pipeErr, logChannel) - } - go func() { - defer glog.Flush() - if err := cmd.Wait(); err != nil { - if exiterr, ok := err.(*exec.ExitError); ok { - glog.Info("Exit Status: ", exiterr.ExitCode()) - glog.Info(exiterr) - } else { - glog.Info("Exit Status: ", exiterr.ExitCode()) - glog.Fatal("Simulation Error: ", err) - } - } - if fileName != "" { - glog.Info("Simulation done deleting: ", fileName) - os.Remove(fileName) - } - - }() -} - -func (s *taxiRouteServer) CreateTaxi(ctx context.Context, in *pb.Route) (*pb.RouteResponse, error) { - defer glog.Flush() - file, errs := os.CreateTemp("", fmt.Sprintf("%s-route-*.json", in.GetKey())) - if errs != nil { - glog.Fatal(errs) - } - - inJson := protojson.Format(in) - - var coords struct { - Values [][]float64 `json:"coordinates"` - } - json.Unmarshal([]byte(inJson), &coords) - endMark := coords.Values[len(coords.Values)-1] - endMark = append(endMark, -1) - coords.Values = append(coords.Values, endMark) - - routeKey := fmt.Sprintf("taxi/%s/location", in.GetKey()) - simConfig := simulatorConfig{ - BrokerURL: brokerURL, - BrokerPort: brokerPort, - ProtocolVersion: 5, - CleanSession: false, - Qos: 0, - Topics: []topicConfig{ - { - Type: "single", - Prefix: routeKey, - TimeInterval: int(in.GetDuration() / float64(len(coords.Values))), - Data: []dataConfig{ - { - Name: "coordinate", - PayloadRoot: struct { - Key string `json:"key"` - }{Key: routeKey}, - Type: "raw_values", - Values: coords.Values, - }, - }, - }, - }, - } - jsonConfig, errs := json.Marshal(simConfig) - if errs != nil { - glog.Fatal(errs) - } - _, errs = file.Write(jsonConfig) - if errs != nil { - glog.Fatal(errs) - } - - if printSim { - glog.Info(simConfig) - } - - runSim(file.Name()) - - return &pb.RouteResponse{ - Topic: routeKey, - }, errs -} - -func main() { - flag.Parse() - defer glog.Flush() - defer close(logChannel) - - if _, err := os.Stat("mqtt-simulator/main.py"); err == nil { - glog.Info("Simulator files exist\n") - if _, err := os.Stat("default_routes.json"); defaultRoutes && err == nil { - glog.Info("default_routes file exist\n") - if defaultRoutes { - runSim("default_routes.json") - } - } - } else { - glog.Info("Simulator files do not exist\n") - } - - lis, err := net.Listen("tcp", fmt.Sprintf(":%d", servicePort)) - if err != nil { - glog.Fatal("failed to listen:", err) - } - glog.Info("Listening on port: ", servicePort) - s := grpc.NewServer() - pb.RegisterTaxiRouteServer(s, &taxiRouteServer{}) - if err := s.Serve(lis); err != nil { - glog.Fatal("failed to serve:", err) - } -} diff --git a/taxi/grpc/service/mqtt-simulator/client_settings.py b/taxi/grpc/service/mqtt-simulator/client_settings.py deleted file mode 100644 index 0b41589..0000000 --- a/taxi/grpc/service/mqtt-simulator/client_settings.py +++ /dev/null @@ -1,8 +0,0 @@ -from dataclasses import dataclass - -@dataclass -class ClientSettings: - clean: bool - retain: bool - qos: int - time_interval: int diff --git a/taxi/grpc/service/mqtt-simulator/expression_evaluator.py b/taxi/grpc/service/mqtt-simulator/expression_evaluator.py deleted file mode 100644 index 873d4b1..0000000 --- a/taxi/grpc/service/mqtt-simulator/expression_evaluator.py +++ /dev/null @@ -1,33 +0,0 @@ -import math -import random - - -class ExpressionEvaluator(): - def __init__(self, math_expression, interval_start, interval_end, min_delta, max_delta): - self._math_expression = self.generate_compiled_expression(math_expression) - self._interval_start = interval_start - self._interval_end = interval_end - self._min_delta = min_delta - self._max_delta = max_delta - self._x = interval_start - - def evaluate_expression(self): - if self._x > self._interval_end: - self._x = self._interval_start - return self.get_current_expression_value() - step = random.uniform(self._min_delta, self._max_delta) - self._x += step - return self.get_current_expression_value() - - def get_current_expression_value(self): - return self._math_expression(self._x) - - def generate_compiled_expression(self, expression): - lambda_expression = "lambda x: "+expression - code = compile(lambda_expression, "", "eval") - ALLOWED_FUNCTIONS = {function_name: func for function_name, func in math.__dict__.items() if not function_name.startswith("__")} - - for name in code.co_names: - if name not in ALLOWED_FUNCTIONS: - raise NameError(f"The use of '{name}' is not allowed") - return eval(code, {"__builtins__": {}, "math":math}, ALLOWED_FUNCTIONS) diff --git a/taxi/grpc/service/mqtt-simulator/main.py b/taxi/grpc/service/mqtt-simulator/main.py deleted file mode 100644 index 63a98d7..0000000 --- a/taxi/grpc/service/mqtt-simulator/main.py +++ /dev/null @@ -1,21 +0,0 @@ -import argparse -from pathlib import Path -from simulator import Simulator - -def default_settings(): - base_folder = Path(__file__).resolve().parent.parent - settings_file = base_folder / 'config/settings.json' - return settings_file - -def is_valid_file(parser, arg): - settings_file = Path(arg) - if not settings_file.is_file(): - return parser.error(f"argument -f/--file: can't open '{arg}'") - return settings_file - -parser = argparse.ArgumentParser() -parser.add_argument('-f', '--file', dest='settings_file', type=lambda x: is_valid_file(parser, x), help='settings file', default=default_settings()) -args = parser.parse_args() - -simulator = Simulator(args.settings_file) -simulator.run() diff --git a/taxi/grpc/service/mqtt-simulator/simulator.py b/taxi/grpc/service/mqtt-simulator/simulator.py deleted file mode 100644 index 6d6c1b3..0000000 --- a/taxi/grpc/service/mqtt-simulator/simulator.py +++ /dev/null @@ -1,58 +0,0 @@ -import json -from client_settings import ClientSettings -from topic import TopicAuto - -class Simulator: - def __init__(self, settings_file): - self.topics = [] - self.default_client_settings = ClientSettings( - clean=True, - retain=False, - qos=2, - time_interval=10 - ) - self.load_topics(settings_file) - - def read_client_settings(self, settings_dict: dict, default: ClientSettings): - return ClientSettings( - clean=settings_dict.get('CLEAN_SESSION', default.clean), - retain=settings_dict.get('RETAIN', default.retain), - qos=settings_dict.get('QOS', default.qos), - time_interval= settings_dict.get('TIME_INTERVAL', default.time_interval) - ) - - def load_topics(self, settings_file): - with open(settings_file) as json_file: - config = json.load(json_file) - broker_url = config.get('BROKER_URL', 'localhost') - broker_port = config.get('BROKER_PORT', 7183) - broker_protocol = config.get('PROTOCOL_VERSION', 4) # mqtt.MQTTv311 - broker_client_settings = self.read_client_settings(config, default=self.default_client_settings) - # read each configured topic - for topic in config['TOPICS']: - topic_data = topic['DATA'] - topic_client_settings = self.read_client_settings(topic, default=broker_client_settings) - if topic['TYPE'] == 'single': - # create single topic with format: /{PREFIX} - topic_url = topic['PREFIX'] - self.topics.append(TopicAuto(broker_url, broker_port, broker_protocol, topic_url, topic_data, topic_client_settings)) - elif topic['TYPE'] == 'multiple': - # create multiple topics with format: /{PREFIX}/{id} - for id in range(topic['RANGE_START'], topic['RANGE_END']+1): - topic_url = topic['PREFIX'] + '/' + str(id) - self.topics.append(TopicAuto(broker_url, broker_port, broker_protocol, topic_url, topic_data, topic_client_settings)) - elif topic['TYPE'] == 'list': - # create multiple topics with format: /{PREFIX}/{item} - for item in topic['LIST']: - topic_url = topic['PREFIX'] + '/' + str(item) - self.topics.append(TopicAuto(broker_url, broker_port, broker_protocol, topic_url, topic_data, topic_client_settings)) - - def run(self): - for topic in self.topics: - print(f'Starting: {topic.topic_url} ...') - topic.start() - - def stop(self): - for topic in self.topics: - print(f'Stopping: {topic.topic_url} ...') - topic.stop() diff --git a/taxi/grpc/service/mqtt-simulator/topic.py b/taxi/grpc/service/mqtt-simulator/topic.py deleted file mode 100644 index 9772299..0000000 --- a/taxi/grpc/service/mqtt-simulator/topic.py +++ /dev/null @@ -1,131 +0,0 @@ -import time -import json -import random -import threading -from abc import ABC, abstractmethod -import paho.mqtt.client as mqtt -from client_settings import ClientSettings -from expression_evaluator import ExpressionEvaluator - -class Topic(ABC): - def __init__(self, broker_url: str, broker_port: int, broker_protocol: int, topic_url: str, topic_data: list[object], topic_client_settings: ClientSettings): - self.broker_url = broker_url - self.broker_port = broker_port - self.broker_protocol = broker_protocol - - self.topic_url = topic_url - self.topic_data = topic_data - self.topic_client_settings = topic_client_settings - - self.loop = False - self.client = None - self.old_payload = None - - @abstractmethod - def generate_initial_value(self, data): - pass - - @abstractmethod - def generate_next_value(self, data, old_value): - pass - - def connect(self): - self.loop = True - if self.broker_protocol == mqtt.MQTTv5: - self.client = mqtt.Client(self.topic_url, protocol=self.broker_protocol) - else: - self.client = mqtt.Client(self.topic_url, protocol=self.broker_protocol, clean_session=self.topic_client_settings.clean) - self.client.on_publish = self.on_publish - self.client.connect(self.broker_url, self.broker_port) - self.client.loop_start() - - def disconnect(self): - self.loop = False - self.client.loop_stop() - self.client.disconnect() - - def run(self): - self.connect() - while self.loop: - payload = self.generate_payload() - self.old_payload = payload - self.client.publish(topic=self.topic_url, payload=json.dumps(payload), qos=self.topic_client_settings.qos, retain=self.topic_client_settings.retain) - time.sleep(self.topic_client_settings.time_interval) - - def on_publish(self, client, userdata, result): - print(f'[{time.strftime("%H:%M:%S")}] Data published on: {self.topic_url}') - - def generate_payload(self): - payload = {} - if self.old_payload == None: - # generate initial data - for data in self.topic_data: - payload = data.get('PAYLOAD_ROOT', payload) - payload[data['NAME']] = self.generate_initial_value(data) - else: - # generate next data - for data in self.topic_data: - payload = data.get('PAYLOAD_ROOT', payload) - payload[data['NAME']] = self.generate_next_value(data, self.old_payload[data['NAME']]) - return payload - - -class TopicAuto(Topic, threading.Thread): - def __init__(self, broker_url: str, broker_port: int, broker_protocol: int, topic_url: str, topic_data: list[object], topic_client_settings: ClientSettings): - Topic.__init__(self, broker_url, broker_port, broker_protocol, topic_url, topic_data, topic_client_settings) - threading.Thread.__init__(self, args = (), kwargs = None) - - # Relevant for when TYPE is 'math_expression' - self.expression_evaluators = {} - - # Relevant for when TYPE is 'raw_values' - self.raw_values_index = 0 - - def generate_initial_value(self, data): - if 'INITIAL_VALUE' in data: - return data['INITIAL_VALUE'] - elif data['TYPE'] == 'int': - return random.randint(data['MIN_VALUE'], data['MAX_VALUE']) - elif data['TYPE'] == 'float': - return random.uniform(data['MIN_VALUE'], data['MAX_VALUE']) - elif data['TYPE'] == 'bool': - return random.choice([True, False]) - elif data['TYPE'] == 'math_expression': - self.expression_evaluators[data['NAME']] = ExpressionEvaluator(data['MATH_EXPRESSION'], data['INTERVAL_START'], data['INTERVAL_END'], data['MIN_DELTA'], data['MAX_DELTA']) - return self.expression_evaluators[data['NAME']].get_current_expression_value() - elif data['TYPE'] == 'raw_values': - self.raw_values_index = data.get('INDEX_START', 0) - values = data['VALUES'] - return values[self.raw_values_index] - - def generate_next_value(self, data, old_value): - randN = random.random() - if randN < data.get('RESET_PROBABILITY', 0): - return self.generate_initial_value(data) - if data.get('RESTART_ON_BOUNDARIES', False) and (old_value == data.get('MIN_VALUE') or old_value == data.get('MAX_VALUE')): - return self.generate_initial_value(data) - if randN < data.get('RETAIN_PROBABILITY', 0): - return old_value - if data['TYPE'] == 'bool': - return not old_value - elif data['TYPE'] == 'math_expression': - return self.expression_evaluators[data['NAME']].evaluate_expression() - elif data['TYPE'] == 'raw_values': - # iterate the raw_values then restart, return next, or disconnect at the end_index - values = data['VALUES'] - end_index = data.get('INDEX_END', len(values) - 1) - self.raw_values_index += 1 - if data.get('RESTART_ON_END', False) and self.raw_values_index > end_index: - return self.generate_initial_value(data) - elif self.raw_values_index <= end_index: - return values[self.raw_values_index] - else: - self.disconnect() - else: - # generating value for int or float - step = random.uniform(0, data['MAX_STEP']) - step = round(step) if data['TYPE'] == 'int' else step - increase_probability = data['INCREASE_PROBABILITY'] if 'INCREASE_PROBABILITY' in data else 0.5 - if randN < (1 - increase_probability): - step *= -1 - return max(old_value + step, data['MIN_VALUE']) if step < 0 else min(old_value + step, data['MAX_VALUE']) diff --git a/taxi/grpc/service/requirements.txt b/taxi/grpc/service/requirements.txt deleted file mode 100644 index f6c4882..0000000 --- a/taxi/grpc/service/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -paho-mqtt==1.5.0 diff --git a/taxi/grpc/service/taxiroute/taxi_route.pb.go b/taxi/grpc/service/taxiroute/taxi_route.pb.go deleted file mode 100644 index 88cd491..0000000 --- a/taxi/grpc/service/taxiroute/taxi_route.pb.go +++ /dev/null @@ -1,261 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: taxi_route.proto - -package taxiroute - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/emptypb" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Route struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Bbox []float64 `protobuf:"fixed64,2,rep,packed,name=bbox,proto3" json:"bbox,omitempty"` - Distance float64 `protobuf:"fixed64,3,opt,name=distance,proto3" json:"distance,omitempty"` - Duration float64 `protobuf:"fixed64,4,opt,name=duration,proto3" json:"duration,omitempty"` - Coordinates []*structpb.ListValue `protobuf:"bytes,5,rep,name=coordinates,proto3" json:"coordinates,omitempty"` -} - -func (x *Route) Reset() { - *x = Route{} - if protoimpl.UnsafeEnabled { - mi := &file_taxi_route_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Route) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Route) ProtoMessage() {} - -func (x *Route) ProtoReflect() protoreflect.Message { - mi := &file_taxi_route_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Route.ProtoReflect.Descriptor instead. -func (*Route) Descriptor() ([]byte, []int) { - return file_taxi_route_proto_rawDescGZIP(), []int{0} -} - -func (x *Route) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Route) GetBbox() []float64 { - if x != nil { - return x.Bbox - } - return nil -} - -func (x *Route) GetDistance() float64 { - if x != nil { - return x.Distance - } - return 0 -} - -func (x *Route) GetDuration() float64 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *Route) GetCoordinates() []*structpb.ListValue { - if x != nil { - return x.Coordinates - } - return nil -} - -type RouteResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` -} - -func (x *RouteResponse) Reset() { - *x = RouteResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_taxi_route_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RouteResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RouteResponse) ProtoMessage() {} - -func (x *RouteResponse) ProtoReflect() protoreflect.Message { - mi := &file_taxi_route_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RouteResponse.ProtoReflect.Descriptor instead. -func (*RouteResponse) Descriptor() ([]byte, []int) { - return file_taxi_route_proto_rawDescGZIP(), []int{1} -} - -func (x *RouteResponse) GetTopic() string { - if x != nil { - return x.Topic - } - return "" -} - -var File_taxi_route_proto protoreflect.FileDescriptor - -var file_taxi_route_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x74, 0x61, 0x78, 0x69, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x09, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x1a, 0x1b, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, - 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x05, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x62, 0x6f, 0x78, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x01, 0x52, 0x04, 0x62, 0x62, 0x6f, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x64, 0x69, 0x73, 0x74, - 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x3c, 0x0a, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x0b, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x73, 0x22, 0x25, - 0x0a, 0x0d, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x74, 0x6f, 0x70, 0x69, 0x63, 0x32, 0x47, 0x0a, 0x09, 0x54, 0x61, 0x78, 0x69, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x78, 0x69, - 0x12, 0x10, 0x2e, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x1a, 0x18, 0x2e, 0x74, 0x61, 0x78, 0x69, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x52, - 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x35, - 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x6b, 0x6c, - 0x69, 0x76, 0x69, 0x74, 0x79, 0x2f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0x2d, 0x64, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x74, 0x61, 0x78, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x74, 0x61, 0x78, 0x69, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_taxi_route_proto_rawDescOnce sync.Once - file_taxi_route_proto_rawDescData = file_taxi_route_proto_rawDesc -) - -func file_taxi_route_proto_rawDescGZIP() []byte { - file_taxi_route_proto_rawDescOnce.Do(func() { - file_taxi_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_taxi_route_proto_rawDescData) - }) - return file_taxi_route_proto_rawDescData -} - -var file_taxi_route_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_taxi_route_proto_goTypes = []interface{}{ - (*Route)(nil), // 0: taxiroute.Route - (*RouteResponse)(nil), // 1: taxiroute.RouteResponse - (*structpb.ListValue)(nil), // 2: google.protobuf.ListValue -} -var file_taxi_route_proto_depIdxs = []int32{ - 2, // 0: taxiroute.Route.coordinates:type_name -> google.protobuf.ListValue - 0, // 1: taxiroute.TaxiRoute.CreateTaxi:input_type -> taxiroute.Route - 1, // 2: taxiroute.TaxiRoute.CreateTaxi:output_type -> taxiroute.RouteResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_taxi_route_proto_init() } -func file_taxi_route_proto_init() { - if File_taxi_route_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_taxi_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Route); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_taxi_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RouteResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_taxi_route_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_taxi_route_proto_goTypes, - DependencyIndexes: file_taxi_route_proto_depIdxs, - MessageInfos: file_taxi_route_proto_msgTypes, - }.Build() - File_taxi_route_proto = out.File - file_taxi_route_proto_rawDesc = nil - file_taxi_route_proto_goTypes = nil - file_taxi_route_proto_depIdxs = nil -} diff --git a/taxi/grpc/service/taxiroute/taxi_route_grpc.pb.go b/taxi/grpc/service/taxiroute/taxi_route_grpc.pb.go deleted file mode 100644 index e3aa368..0000000 --- a/taxi/grpc/service/taxiroute/taxi_route_grpc.pb.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: taxi_route.proto - -package taxiroute - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - TaxiRoute_CreateTaxi_FullMethodName = "/taxiroute.TaxiRoute/CreateTaxi" -) - -// TaxiRouteClient is the client API for TaxiRoute service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type TaxiRouteClient interface { - CreateTaxi(ctx context.Context, in *Route, opts ...grpc.CallOption) (*RouteResponse, error) -} - -type taxiRouteClient struct { - cc grpc.ClientConnInterface -} - -func NewTaxiRouteClient(cc grpc.ClientConnInterface) TaxiRouteClient { - return &taxiRouteClient{cc} -} - -func (c *taxiRouteClient) CreateTaxi(ctx context.Context, in *Route, opts ...grpc.CallOption) (*RouteResponse, error) { - out := new(RouteResponse) - err := c.cc.Invoke(ctx, TaxiRoute_CreateTaxi_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TaxiRouteServer is the server API for TaxiRoute service. -// All implementations must embed UnimplementedTaxiRouteServer -// for forward compatibility -type TaxiRouteServer interface { - CreateTaxi(context.Context, *Route) (*RouteResponse, error) - mustEmbedUnimplementedTaxiRouteServer() -} - -// UnimplementedTaxiRouteServer must be embedded to have forward compatible implementations. -type UnimplementedTaxiRouteServer struct { -} - -func (UnimplementedTaxiRouteServer) CreateTaxi(context.Context, *Route) (*RouteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateTaxi not implemented") -} -func (UnimplementedTaxiRouteServer) mustEmbedUnimplementedTaxiRouteServer() {} - -// UnsafeTaxiRouteServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to TaxiRouteServer will -// result in compilation errors. -type UnsafeTaxiRouteServer interface { - mustEmbedUnimplementedTaxiRouteServer() -} - -func RegisterTaxiRouteServer(s grpc.ServiceRegistrar, srv TaxiRouteServer) { - s.RegisterService(&TaxiRoute_ServiceDesc, srv) -} - -func _TaxiRoute_CreateTaxi_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Route) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TaxiRouteServer).CreateTaxi(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: TaxiRoute_CreateTaxi_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TaxiRouteServer).CreateTaxi(ctx, req.(*Route)) - } - return interceptor(ctx, in, info, handler) -} - -// TaxiRoute_ServiceDesc is the grpc.ServiceDesc for TaxiRoute service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var TaxiRoute_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "taxiroute.TaxiRoute", - HandlerType: (*TaxiRouteServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateTaxi", - Handler: _TaxiRoute_CreateTaxi_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "taxi_route.proto", -} diff --git a/taxi/map-ui/.babelrc b/taxi/map-ui/.babelrc deleted file mode 100644 index cdf250d..0000000 --- a/taxi/map-ui/.babelrc +++ /dev/null @@ -1,32 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "modules": false, - "targets": { - "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] - } - }, - "stage-2" - ] - ], - "plugins": [ - [ - "transform-imports", - { - "vuetify": { - "transform": "vuetify/es5/components/${member}", - "preventFullImport": true - } - } - ], - ["@babel/plugin-proposal-class-properties"] - ], - "env": { - "test": { - "presets": ["@babel/preset-env"], - "plugins": ["istanbul"] - } - } -} diff --git a/taxi/map-ui/.dockerignore b/taxi/map-ui/.dockerignore deleted file mode 100644 index f6cc1bb..0000000 --- a/taxi/map-ui/.dockerignore +++ /dev/null @@ -1,18 +0,0 @@ -.idea -.git -.github -.editorconfig -.gitignore -.versionrc -static -cypress -tests -docs -node_modules -CHANGELOG.md -README.md -Dockerfile -docker-compose.yml -index.html -LICENSE -nginx diff --git a/taxi/map-ui/.editorconfig b/taxi/map-ui/.editorconfig deleted file mode 100644 index 9d08a1a..0000000 --- a/taxi/map-ui/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 2 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/taxi/map-ui/.eslintignore b/taxi/map-ui/.eslintignore deleted file mode 100644 index 1beed69..0000000 --- a/taxi/map-ui/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -/build/ -/config/ -/dist/ -/*.js -/src/ors-js/node_modules/ diff --git a/taxi/map-ui/.eslintrc.js b/taxi/map-ui/.eslintrc.js deleted file mode 100644 index 315fe0b..0000000 --- a/taxi/map-ui/.eslintrc.js +++ /dev/null @@ -1,44 +0,0 @@ -// https://eslint.org/docs/user-guide/configuring - -module.exports = { - root: true, - parserOptions: { - parser: '@babel/eslint-parser', - sourceType: 'module', - requireConfigFile: false - }, - env: { - node: true, - browser: true, - }, - // https://github.com/standard/standard/blob/master/docs/RULES-en.md - extends: [ - "eslint:recommended", - "plugin:vue/base", - "plugin:cypress/recommended" - ], - // add your custom rules here - rules: { - // allow async-await - 'generator-star-spacing': 'off', - // allow debugger during development - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - "indent": [ - "error", - 2, - { "SwitchCase": 1 } - ], - "linebreak-style": [ - "error", - "unix" - ], - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "never" - ] - } -} diff --git a/taxi/map-ui/.gitignore b/taxi/map-ui/.gitignore deleted file mode 100644 index 7ad3358..0000000 --- a/taxi/map-ui/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -.DS_Store -node_modules/ -**/node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -/src/ors-js/ - -# Editor directories and files -.idea -.vscode -*.suo -*.ntvs* -*.njsproj -*.sln - -## The ignores below can be removed/commented in the case -## you want to include the config files, the plugins -## and the built static app in a custom repo. - -# Ignore config file -!/src/config/.gitkeep - -# Ignore config file -!/src/plugins/plugin-example/ - -# Built web app # -static -!/static/css/.gitkeep -!/static/fonts/.gitkeep -!/static/img/.gitkeep - -# leaflet helpers - -/images - -# cypress tests -/cypress/videos/ -/cypress/screenshots/ -/cypress/downloads/ -/index.html -/nginx/ diff --git a/taxi/map-ui/.postcssrc.js b/taxi/map-ui/.postcssrc.js deleted file mode 100644 index eee3e92..0000000 --- a/taxi/map-ui/.postcssrc.js +++ /dev/null @@ -1,10 +0,0 @@ -// https://github.com/michael-ciniawsky/postcss-load-config - -module.exports = { - "plugins": { - "postcss-import": {}, - "postcss-url": {}, - // to edit target browsers: use "browserslist" field in package.json - "autoprefixer": {} - } -} diff --git a/taxi/map-ui/Dockerfile b/taxi/map-ui/Dockerfile deleted file mode 100644 index 038a8b7..0000000 --- a/taxi/map-ui/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -# Multistage build -# 1. Stage: Build the app -FROM node:19-alpine as build-stage -WORKDIR /opt/client/ - -# System deps and app setup: -RUN apk --no-cache add 'build-base>=0.5' 'git>=2.38' \ - && npm install -g 'pnpm@^8.14' - -# Add diretories with necessary config files -COPY pnpm-lock.yaml package.json /opt/client/ - -# Only install production. -RUN pnpm install --only=prod - -COPY build /opt/client/build -COPY src /opt/client/src -COPY config /opt/client/config -COPY .eslintignore pnpm-lock.yaml cypress.config.js .babelrc .eslintrc.js dev.html package.json .postcssrc.js /opt/client/ - -RUN pnpm build - -# 2. Stage: Start server with needed files only -FROM nginx:stable-alpine as production-stage - -RUN apk add --no-cache 'openssl>=3.0' 'bash>=5.1' \ - && rm -rf /usr/share/nginx/html/* - -USER nginx - -COPY --from=build-stage /opt/client/static /usr/share/nginx/html/static -COPY --from=build-stage /opt/client/index.html /usr/share/nginx/html/ -COPY templates/nginx.ors-map-client.conf.nginx /etc/nginx/conf.d/default.conf - -CMD ["nginx", "-g", "daemon off;"] diff --git a/taxi/map-ui/README.md b/taxi/map-ui/README.md deleted file mode 100644 index 70b1f8a..0000000 --- a/taxi/map-ui/README.md +++ /dev/null @@ -1,522 +0,0 @@ -# ORS map client - -[![Test](https://github.com/GIScience/ors-map-client/actions/workflows/test.yml/badge.svg)](https://github.com/GIScience/ors-map-client/actions/workflows/test.yml) - -This application implements a map client for the [openrouteservice API](https://openrouteservice.org/dev/#/api-docs/) as -Single Page Application (SPA). It is a base application that can be used for multiple purposes, -customized via configurations and extended via plug-ins. - -The base application is using VueJS, Vuetify and a set of custom components, directives and services. -The structure uses a feature-by-folder design, allowing view, code and translation elements to be contained in a folder. - -This app uses single file components and others non-native javascript code that are transpiled to native javascript -during the build process. -Therefore, the app needs to be compiled before running it either in dev or production mode. -The VueJS components allow a better code organization, weak and clear coupling between components and an easier -code understanding. - -![ORS map client](docs/ors-map-client.png?raw=true "ORS map client") - -## Sections - -- [Set up and run](#set-up-and-run) -- [App folders](#app-folders) -- [App flow overview](#app-flow-overview) -- [Feature-by-folder design](#feature-by-folder-design) -- [Reserved methods and accessors](#reserved-methods-and-accessors) -- [pages](#pages) -- [Configuration, theming, customization and extension](#configuration-theming-customization-and-extension) -- [Add language](#add-language) -- [Menu](#menu) -- [Debug](#debug) -- [Build and deploy](#build-and-deploy) -- [Tests](#tests) -- [Contribute](#contribute) -- [Additional documentation](#additional-documentation) - -### Set up and run - -The app can be run with `docker`, `docker-compose`, and `natively`. - -First of all, checkout the repository to get the relevant code: - -```sh -git clone https://github.com/GIScience/ors-map-client.git -# Go to your local repository root folder -cd ors-map-client -``` - -##### Configure - -In order to run the app either with `docker`, `docker-compose`, or `native`, you have to configure you application -first. - -1. Copy the files in the `src/config-example` to `src/config`, without `-example` in their names. The files are: - -- app-config-`example`.js => **app-config.js** -- ors-map-filters`-example`.js => **ors-map-filters.js** -- layer-zoom-mapping`-example`.js => **layer-zoom-mapping.js** -- hooks`-example`.js => **hooks.js** -- theme`-example`.js => **theme.js** -- default-map-settings`-example`.js => **default-map-settings.js** -- settings-options`-example`.js => **settings-options.js** - - If you are using a linux/unix compatible terminal, you can do that by running: - - ```sh - cd src && cp config-examples/* config && for i in config/*-example.js; do mv -- "$i" "${i%-example.js}.js"; done - ``` - -2. Set the app-config.js values for: - -- `orsApiKey` - ORS API key to be used when ot running the app from localhost or ors valid domains -- `bitlyApiKey` - the Bitly key (used to shorten the share URL) -- `bitlyLogin` - the Bitly login (used to shorten the share URL) - -3. The ORS menu is loaded/used by default. If you want to use a custom menu, have a look in the `hooks-example.js`. - -The filters, theme and hooks of the map client can be customized if needed. - -##### Run with `Docker` - -```shell -# Build the image -docker build --tag ors-map-client:local . - -# Run a container -docker run -d -it -v "$(pwd)"/nginx/logs:/var/log/nginx:rw -p 127.0.0.1:8080:80 --name ors-map-client ors-map-client:local - -# Check the logs with -docker logs --follow ors-map-client -``` - -The app should now be running at http://127.0.0.1:8080. - -##### Run with `docker-compose` - -```shell -# Build and run the image -docker-compose up -d - -# Check the logs with -docker-compose logs -ft -``` - -The app should now be running at http://127.0.0.1:8080. - -##### Run `natively` - -Run the app locally without docker in three steps: set the environment up, and define a configuration file. - -1. To manage dependencies and pack the app it is necessary to have Node version 16. - If you already have it, skip this step. - If you don't, please install it by running: - -```sh -curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ -apt-get update && \ -apt-get install -y nodejs && \ -npm install -g pnpm && \ -npm update -g -# The installation of dependencies is required before running the app: -pnpm install -``` - -At this point the app is ready to run in `dev` mode. Do it by executing the following command in the app root folder: - -```sh -pnpm dev -# This will start a standalone http node server and the host and port to access it will be displayed -``` - -### App folders - -App folder structure under `src`: - -- `assets` - images and icons storage -- `common` - available mixins, http client, main menu, Vue with Vuetify and theme -- `directives` - custom directives -- `filters` - custom filters -- `fragments` - all app fragments used by pages -- `i18n` - internationalization resources -- `models` - models used to deal transport ors response data and deals with app state and transitions -- `pages` - app pages (currently only the `maps` page is available) -- `resources` - support files like the loader lib, definitions and options used to process requests and responses -- `router` - router component based on vue-router components -- `store` - app store definitions -- `support` - support utilities, like geo-utils, ors-api-runner, routes-resolver and app modes - -### App flow overview - -This is a Single Page Application (SPA). This means that the client app is loaded in the browser and defines which -components and pages are processed based on the browser URL. -The app watches every change in the browser URL and updates its state based on that. -These URL changes don't trigger a request to the back-end directly, but the components loaded/updated will decide which -requests must be run to load the required data. -Meaning, that the front-end (this app) is decoupled from the back-ends (ORS API and ORS website) - -The app load cycle follows these steps: - -1. Execute the `main.js` file and add global extensions, mixins components and external libs. The file `main.js` also includes the main files of the router, vuex-store and i18n-translations, which will internally load all `.router.js` ,`.store.js` and `.i18n.js` files from sub-folders. -2. `main.js` will run a request to get necessary data from a service and then create a VueJS app instance and load the `App.vue`. At this point `AppHooks` is set up and attached to the main VueJS instance and then the `appLoaded` hook is called. -3. `App.vue` includes all basic navigation components, like menu, sidebar, footer etc. -4. After loading all routes (including the ones in the `pages` sub folder) the page with the `/` route (`Maps.vue`) will - also be rendered in the `` slot in `App.vue` component. - -Data flow, state and requests to services, in a simplified view, happens as follows: - -- The app is loaded - 1. the API data are fetched from ORS website service and if `appConfig.appMenu.useORSMenu` is **true**, the menu items - are loaded in `src/main.js` using `src/app-loader.js`. - 2. the app `mode` is defined based on the matching URL in the `maps.route.js` - 3. the `maps` page, uses the app mode utility to define the app state using the current `mode`. - This utility will also populate the values of the `ors-map-filters` based on the URL and build the `AppRouteData` - (in src/models/app-route-data.js). - 4. based on the app mode/state certain components are activated/displayed - 5. Every component, once activated, may use the data in `src/config/ors-map-filters` to render its elements and may - run requests to the ORS api using the `src/support/ors-api-runner`. - Once the request succeed, the response data will be used to fill the `MapViewData` object. - 6. Once an input is changed the app goes to a new URL and this makes the flow restart at the step 2. - 7. If a component changes the `MapViewData` model, it emits an event to the `maps` page, that passes the current - `MapViewData` object to the `MapView` component. - 8. Interactions via `MapView` may result in events sent back to `maps` page, that may notify other child components, - that in their turn may change the URL and trigger the step 2 again. - 9. Several app hooks are called during the app flow, and it is possible to listen to these hooks and run custom code - to modify some app behavior. - The available hooks are listed in `src/config-examples/hooks-example.js` and must be coded in `src/config/hooks.js`. - -### Feature-by-folder design - -This app uses feature by folder components and predefined folders where the business code should be placed in. -Example of this design usage: - -Page: - -- my-page-name (folder) - - MyPageName.vue (main VueJS component file) - - my-page-name.css (styles for the page, included by the MyPageName.vue component) - - my-page-name`.store.js` (Vuex store module for the page, included by the store/store.js loader) - - my-page-name`.route.js` (route to reach this page, included by the router/index loader) - - i18n (folder) - - my-page-name`.i18n.en.js` (in this example containing the EN resources for the page) - -Component: - -- my-fragment-name (folder under `src/fragments/`) - - - MyFragmentName.vue (main VueJS component file) - - my-fragment-name.css (styles for the page, included by the MyFragmentName.vue component) - - my-fragment-name`.store.js` (Vuex store module for the fragment, included by the store/store.js loader) - - i18n (folder) - - my-fragment-name`.i18n.en.js` (in this example containing the EN resources for the component) - -The app will automatically load: - -- all the locale resources in i18n folder ending with `.i18n.*.js` where `*` is the locale -- the defined routes in files ending with `.routes.js` -- the store definitions in files ending with `.store.js` - -### Reserved methods and accessors - -All the VueJS components created (including the fragments) will have, by default, the following methods/accessors -defined in the main vue instance app: - -- `showMessage (msg, theme, options)` - shows a message using the toaster with specified theme and options - -- `showError (msg, options)` - shows an error message using the toaster with the specified options - -- `showWarning (msg, options)` - shows a warning message using the toaster with the specified options - -- `showInfo (msg, options)` - shows an info message using the toaster with the specified options - -- `showSuccess (msg, options)` - shows a success message using the toaster with the specified options - -- `confirmDialog (title, text, options)` - shows a confirm-dialog with the specified title, text and options and returns - a promise. If the user clicks `yes`, the promise will be resolved, if s/he clicks on `no`, the promise will be rejected. - -- `$store` - accessor to app vuex-store - -### Pages - -- `maps` - the page where the user can search places, routes and create isochrones. - -### Configuration, theming, customization and extension - -The map client app can be configured, customized and extended. Several aspects can be defined/changed in order to -disable features, customize visual identity and change/extend its features/behaviors. -It is also possible to add custom plug-ins to the app and subscribe to hooks, listen and emit events. -The items of the menu can also be customized via hooks. - -It is possible to define your custom settings and plug-ins and keep getting updates from the ORS repository because -the `src/plugins` and `src/config` folders are not versioned. -To keep the original ors-map-client as a secondary repository, do the following: - -```sh -# Rename the original remote -git remote rename origin ors-map-client-origin - -# Add your remote as the origin one -git remote add origin - -# Set your new origin as the default upstream -git branch --set-upstream-to=origin/master -``` - -After doing this we recommend you to remove from `.gitignore` the lines that tell git to ignore the folders -`/src/config`, `src/plugins` and eventually `/static`. -Then, run the initial push to the just defined new origin repository, with the following command: - -```sh -git push -u origin master -``` - -The ways to change/extend the app are: - -1. Define custom settings (see files in `src/config`) that will change the standard way that the app works. -1. Add hook listeners in `src/config/hooks.js` and run custom code inside those hooks -1. Create a plug-in that has its methods linked to hooks called during the app flow - (see `src/plugins/example-plugin/`) - -#### Configuration - -It is possible to configure/disable some app features and behaviors by changing the values -of the `src/config/app-config.js`. It is also possible to change the app theme/colors by changing the values of -`src/config/theme.js`. -The app logo can also be changed in the `src/config/app-config` file. -The available filters/options to be used in the services are defined in the `src/config/ors-map-filters.js`. -They can be adjusted according the needs. Other files can be used to adjust app configurations are the -`layer-zoom-mapping.js`, `settings-options.js` and the `default-map-settings.js`. - -#### Plug-ins - -It is possible to add plug-ins to the application in order to change its behavior or extend it. -Please check [docs/plugins.md](docs/plugins.md) for more details. - -### Add language - -#### - Generate a translation file - -If you just want to translate the application strings for a certain language, but you don't have the skills to `"code"` -it into the app, just download the [en-translation-source-merged.json](/docs/en-translation-source-merged.json), -translate it, and contact us. - -\*_Check the file [src/i18n/i18n-builder.js](src/i18n/i18n-builder.js) to see how to generate merged translation sources_ - -#### - Add a language to the app - -The app uses a feature-by-folder design, so each component might have its own translation strings. -That is why there is no single translation file. If you want to add a translation and `"implement"` it into the app, -follow the steps below. - -- Create a copy of the /src/i18n/translations/`en-us` folder giving it the identification of the target language. - For example: if you are adding the French from France, then the folder should be called `fr-fr`. - -- Edit the `builder.js` file inside the just created folder in order to replace the language pattern to the one you are - creating. - For example, similar to `/\.i18n\.en-us\.js$` add `/\.i18n\.fr-fr\.js$`. - -- Translate the language strings for each key in the `global.js` file - -- Search for each file inside the `/src` folder that ends with `i18n.en-us.js` and create a copy of it and each one so - that each new created file now ends with `i18n.fr-fr.js`. If you are using a linux/unix compatible terminal, you can do that by running: - - ```sh - find . -name "*i18n.en-us.js" -exec bash -c 'cp "$0" "${0/i18n.en-us.js/i18n.fr-fr.js}"' {} \; - # where the last occurrence of locale id (in this case `fr-fr`) is the one you are creating - ``` - -- Translate the language strings for each key in all the files created in the previous step. - -- Edit `/src/config/settings-options.js` and add the new locale object to the `appLocales` array (e.g. - `{ text: 'Français FR', value: 'fr-fr' }`). - -- Open the src/i18n/`i18n-builder.js` file and apply the following changes: - - - Import the object from the new language builder that you just created - (e.g. `import frFRTranslations from './translations/fr-fr/builder'`) - - - Inside the `build` method, add: - - - the new language placeholder object to the messages object (e.g. `, 'fr-fr': {}`). - - - the result of the new language building to the previously created message object - (e.g. `i18n.messages['fr-fr'] = frFRTranslations.build()`. - - - Save all the files changed and rebuild the application. - -### Menu - -The menu displayed in the header and in the sidebar (low resolution and mobile devices) is loaded from the ORS website -back-end and adjusted to be shown according the resolution. - -The menu items are fetched on the app load (`src/app-loader.js`). -It dispatches the store `fetchMainMenu` and `@/common/main-menu.js` retrieves the menu that uses -`@/support/menu-manager.js` and `@/support/model-service.js`. -Once the items from the back-end are loaded, `MenuManager` adds or removes custom items and defines icons for sidebar -items. -The items displayed on the menu can be changed by running custom code on the `loadMenuItems` and/or the -`modifyMenu` hooks. Check the `/src/config-example/hooks-example.js` to see more details. - -### Debug - -If you are using [WebStorm](https://www.jetbrains.com/webstorm/download) you should set the -_webpack config_ (settings -> Languages & Frameworks -> JavaScript -> Webpack) to -`{path to ors-map-client}/build/webpack.base.conf.js` to resolve file paths correctly. - -To debug the application you must run it in [`dev` mode](#set-up-and-run). -For better debugging in your browser install the [VueJS devtools](https://github.com/vuejs/vue-devtools#installation) -extension. -After doing that, open the application in the browser and press F12 and select the tab `Console`, `Vue` or `Sources` -(and then expand e.g.: `webpack://src`). - -### Build and deploy - -The app must be built before it is deployed. To do so, run: - -```sh -cd / -pnpm build -``` - -_Important:_ to run the built application you have to set up a web server and put this repository (after the build) -there. -The `index.html` at the root of this repository will load the app. - -For a detailed explanation on how webpack works, check out the [guide](http://vuejs-templates.github.io/webpack/) and -[docs for vue-loader](http://vuejs.github.io/vue-loader). - -### Tests - -Testing is done using the [cypress](https://docs.cypress.io) testing framework. - -All tests (End-to-end(e2e), component and unit) can be executed by running: - -```sh -pnpm test:ci -``` - -During development, you start the development server and use the following command which opens the cypress UI interface -to view the test output and hot reload after making changes: - -```shell -# and do 'pnpm dev' before -pnpm test -``` - -You can run tests in any standard browser that you have installed. -If you are new to cypress check out the "[Getting started](https://docs.cypress.io/guides/getting-started/opening-the-app)" -documentation, and keep it close. -An overview on the usable [assertions](https://docs.cypress.io/guides/references/assertions) will help with simple -test cases. - -#### Structure - -Component tests should be written in the component itself e.g. -`../fragments/MyComponent.cy.js` for `../fragments/MyComponent.vue` - -Unit tests for js source files should be created in a separate `./__tests__` folder next to the source file and for the sake of -clarity be named the same e.g. `../support/__tests__/utils.cy.js` for `../support/utils.js` - -End-to-end tests should be created in `./cypress/e2e/test-name.cy.js` - -### Contribute - -#### pre-commit git hooks - -We use `pre-commit` to make sure contributions have the same basic quality. -Before you commit make sure that your commit satisfies all `pre-commit` checks. -For details on individual checks see `.pre-commit-config.yaml`. - -```bash -# Install the pre-commit git hooks to be automatically executed before committing. -pre-commit install --hook-type commit-msg --hook-type pre-push --hook-type pre-commit -# Manually run all pre-commits. The first execution will setup the environment and can take some time. -pre-commit run --all -``` - -#### Commits and versioning - -- This app uses the `commitizen` plugin to generate standardized commit types/messages. After applying any change in a feature branch, use `git add .` and then `pnpm commit` (instead of `git commit ...`) -- The plugin `standard-version` is used to generate changelog entries, version tag and to bump the app version in package.json. - -Deployment flow: - -1. Apply the changes in a feature branch and test it locally - - _Important_: to run the tests, `src/config/app-config.js` must contain: - -- `orsApiKey`: 'a-valid-ors-api-key-here', -- `useUserKey`: true, - -By default, `src/config/app-config.js` is ignored by git. So, the changes are just local and used to run the tests. - -```sh -# Run automated tests -pnpm test:ci -``` - -_Important:_ Besides the automated tests, some manual/human tests are also recommended - -2. Once the feature is ready, merge it to `master`, and run the tests - - ```sh - git checkout master - git merge feature/ - # Run automated tests after merge - pnpm test - ``` - -3. If the tests pass, create a release - - ```sh - # Create a release. This will : - # - bump the app version, - # - generate a new release commit - # - create a new git tag with the app version - # - Create an entry in CHANGELOG.md - pnpm release - ``` - -4. Push the changes applied to master - - _Important_: the release command will output a command, but We `DON'T USE the whole outputted command`, since there is no npm package to be published. - - ```sh - # The command outputted is expected to be: - # `git push --follow-tags origin master && pnpm publish` - - # We must use/run only - git push --follow-tags origin master - - # Once you push it, the automated tests will be triggered on Github actions - # Check the automated tests results on https://github.com/GIScience/ors-map-client/actions - ``` - -_For more details about `commitizen` and `standard-version` see [this article](https://medium.com/tunaiku-tech/automate-javascript-project-versioning-with-commitizen-and-standard-version-6a967afae7)_ and [standard-version documentation](https://github.com/conventional-changelog/standard-version) - -#### Branch policy - -The `master` branch is used as the stable and most updated branch. Any new feature goes to feature branch, then it is tested, committed and finally merged into `master`. So, master has always the latest version and the production version. -Considering this, any merge request must be done targeting `master`. - -Like almost every team, we have limited workforce, and we have to define priorities. - -`Bugs`: -If you think you have identified any bug and that you can help to fix it, please create an issue first, instead of directly submitting a push request. So the people involved will have the opportunity to discuss it. - -`New features`: - -If you want to contribute by adding a new feature or improve an existing one, please also create an issue. -We do want contributions, and the community effort is very important to us, but features may add complexity and future -maintenance effort. -Because of this, we have also to analyze the trade-off of such contributions. -We just have to decide about them together before the hands on. -This approach is intended to create cohesion and keep the project sustainable. - -### Additional documentation - -There are additional documents that are part of the software documentation. they are in the folder `/docs` and are listed below: - -- [docs/dynamic-inputs.md](docs/dynamic-inputs.md) - describe how the inputs are rendered using a custom engine and not hard-coded -- [docs/search-results-criteria.md](docs/search-results-criteria.md) - explains what are the criteria for the search results -- [docs/plugins.md](docs/plugins.md) - explains how the plugins can be added to the maps client diff --git a/taxi/map-ui/build/build.js b/taxi/map-ui/build/build.js deleted file mode 100644 index e91249f..0000000 --- a/taxi/map-ui/build/build.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict' - -process.env.NODE_ENV = 'production' - -const ora = require('ora') -const rm = require('rimraf') -const path = require('path') -const chalk = require('chalk') -const webpack = require('webpack') -const config = require('../config') -const webpackConfig = require('./webpack.prod.conf') - -const spinner = ora('building for production...') -spinner.start() - -rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { - if (err) throw err - webpack(webpackConfig, (err, stats) => { - spinner.stop() - if (err) throw err - process.stdout.write(stats.toString({ - colors: true, - modules: false, - children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. - chunks: false, - chunkModules: false - }) + '\n\n') - - if (stats.hasErrors()) { - console.log(chalk.red(' Build failed with errors.\n')) - process.exit(1) - } - - console.log(chalk.cyan(' Build complete.\n')) - console.log(chalk.yellow( - ' Tip: built files are meant to be served over an HTTP server.\n' + - ' Opening index.html over file:// won\'t work.\n' - )) - }) -}) diff --git a/taxi/map-ui/build/logo.png b/taxi/map-ui/build/logo.png deleted file mode 100644 index f3d2503..0000000 Binary files a/taxi/map-ui/build/logo.png and /dev/null differ diff --git a/taxi/map-ui/build/utils.js b/taxi/map-ui/build/utils.js deleted file mode 100644 index f0b31f6..0000000 --- a/taxi/map-ui/build/utils.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict' -const path = require('path') -const config = require('../config') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const packageConfig = require('../package.json') - -exports.assetsPath = function (_path) { - const assetsSubDirectory = process.env.NODE_ENV === 'production' - ? config.build.assetsSubDirectory - : config.dev.assetsSubDirectory - - return path.posix.join(assetsSubDirectory, _path) -} - -exports.cssLoaders = function (options) { - options = options || {} - - const cssLoader = { - loader: 'css-loader', - options: { - sourceMap: options.sourceMap, - url: false - } - } - - const postcssLoader = { - loader: 'postcss-loader', - options: { - sourceMap: options.sourceMap - } - } - - // generate loader string to be used with extract text plugin - function generateLoaders (loader, loaderOptions) { - const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] - - if (loader) { - loaders.push({ - loader: loader + '-loader', - options: Object.assign({}, loaderOptions, { - sourceMap: options.sourceMap - }) - }) - } - - // Extract CSS when that option is specified - // (which is the case during production build) - if (options.extract) { - return [ - MiniCssExtractPlugin.loader - ].concat(loaders) - } else { - return ['vue-style-loader'].concat(loaders) - } - } - - // https://vue-loader.vuejs.org/en/configurations/extract-css.html - return { - css: generateLoaders(), - postcss: generateLoaders(), - less: generateLoaders('less'), - sass: generateLoaders('sass', { indentedSyntax: true }), - scss: generateLoaders('sass'), - stylus: generateLoaders('stylus'), - styl: generateLoaders('stylus') - } -} - -// Generate loaders for standalone style files (outside .vue files) -exports.styleLoaders = function (options) { - const output = [] - const loaders = exports.cssLoaders(options) - - for (const extension in loaders) { - const loader = loaders[extension] - output.push({ - test: new RegExp('\\.' + extension + '$'), - use: loader - }) - } - - return output -} - -exports.createNotifierCallback = () => { - const notifier = require('node-notifier') - - return (severity, errors) => { - if (severity !== 'error') return - - const error = errors[0] - const filename = error.file && error.file.split('!').pop() - - notifier.notify({ - title: packageConfig.name, - message: severity + ': ' + error.name, - subtitle: filename || '', - icon: resolve('logo.png') - }) - } -} - -/** - * Resolves paths relative from repository root - * @param {string} rootPath - */ -exports.resolveRoot = (rootPath= "") => { - return path.join(__dirname, '..', rootPath) -} diff --git a/taxi/map-ui/build/vue-loader.conf.js b/taxi/map-ui/build/vue-loader.conf.js deleted file mode 100644 index 6e3cedd..0000000 --- a/taxi/map-ui/build/vue-loader.conf.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' -const utils = require('./utils') -const config = require('../config') -const isProduction = process.env.NODE_ENV === 'production' -const sourceMapEnabled = isProduction - ? config.build.productionSourceMap - : config.dev.cssSourceMap - -module.exports = { - loaders: utils.cssLoaders({ - sourceMap: sourceMapEnabled, - extract: isProduction - }), - cssSourceMap: sourceMapEnabled, - productionSourceMap: false, - cacheBusting: config.dev.cacheBusting, - transformToRequire: { - video: ['src', 'poster'], - source: 'src', - img: 'src', - image: 'xlink:href' - } -} diff --git a/taxi/map-ui/build/webpack.base.conf.js b/taxi/map-ui/build/webpack.base.conf.js deleted file mode 100644 index 6f1e6dd..0000000 --- a/taxi/map-ui/build/webpack.base.conf.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict' -const { resolveRoot } = require('./utils') -const config = require('../config') -const vueLoaderConfig = require('./vue-loader.conf') -const webpack = require('webpack') - - -const createLintingRule = () => ({ - test: /\.(js|vue)$/, - loader: 'eslint-loader', - enforce: 'pre', - include: [resolveRoot('src'), resolveRoot('test')], - exclude: [resolveRoot('tests/integration/mockups')], - options: { - formatter: require('eslint-friendly-formatter'), - emitWarning: !config.dev.showEslintErrorsInOverlay - } -}) - -module.exports = { - plugins: [ - // fix "process is not defined" error: - new webpack.ProvidePlugin({ - process: 'process/browser', - }) - ], - context: resolveRoot(), - entry: { - app: './src/main.js' - }, - output: { - path: config.build.assetsRoot, - filename: '[name].js', - assetModuleFilename: '[base]', - publicPath: '/' - }, - resolve: { - alias: { - '@': resolveRoot('src'), - 'vue$': 'vue/dist/vue.esm.js', - 'fixtures': resolveRoot('cypress/fixtures') - }, - extensions: ['.vue', '.js', '.json'], - fallback: { - timers: require.resolve('timers-browserify'), - stream: require.resolve('stream-browserify'), - path: require.resolve('path-browserify') - } - }, - module: { - rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), - { - test: /\.vue$/, - loader: 'vue-loader', - options: vueLoaderConfig - }, - { - test: /\.js$/, - loader: 'babel-loader', - include: [ - resolveRoot('src/'), - resolveRoot('test/'), - resolveRoot('node_modules/webpack-dev-server/client/')], - options: { - plugins: [ '@babel/plugin-proposal-object-rest-spread' ] - } - },{ - test: /\.(woff|woff2|eot|ttf|otf|png|svg|jpg|jpeg|gif|ico)$/i, - type: 'asset', - exclude: resolveRoot('src/plugins') - },{ - test: /\.(woff|woff2|eot|ttf|otf|png|svg|jpg|jpeg|gif|ico)$/i, - type: 'asset', - include: resolveRoot('src/plugins'), - generator: { - filename: 'static/img/[name][ext]' - } - },{ - test: /\.(geojson|kml|gpx|txt)$/i, - type: 'asset/source', - } - ] - } -} diff --git a/taxi/map-ui/build/webpack.cypress.conf.js b/taxi/map-ui/build/webpack.cypress.conf.js deleted file mode 100644 index 61e95eb..0000000 --- a/taxi/map-ui/build/webpack.cypress.conf.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict' -const { resolveRoot, styleLoaders} = require('./utils') -const config = require('../config') -const vueLoaderConfig = require('./vue-loader.conf') -const webpack = require('webpack') -const packageJson = require("../package.json") - -let ORSKEY = process.env.ORSKEY -let BITLYLOGIN = process.env.BITLYLOGIN -let BITLYAPIKEY = process.env.BITLYAPIKEY - -let env = { - PACKAGE_JSON: JSON.stringify(packageJson) -} -if (ORSKEY) { - env.ORSKEY = `"${ORSKEY}"` -} -if (BITLYLOGIN) { - env.BITLYLOGIN = `"${BITLYLOGIN}"` -} -if (BITLYAPIKEY) { - env.BITLYAPIKEY = `"${BITLYAPIKEY}"` -} - -const createLintingRule = () => ({ - test: /\.(js|vue)$/, - loader: 'eslint-loader', - enforce: 'pre', - include: [resolveRoot('src'), resolveRoot('test')], - exclude: [resolveRoot('tests/integration/mockups')], - options: { - formatter: require('eslint-friendly-formatter'), - emitWarning: !config.dev.showEslintErrorsInOverlay - } -}) - -module.exports = { - plugins: [ - // fix "process is not defined" error: - new webpack.ProvidePlugin({ - process: 'process/browser', - }), - new webpack.DefinePlugin({ - 'process.env': env - }) - ], - context: resolveRoot(), - entry: { - app: './src/main.js' - }, - output: { - path: config.build.assetsRoot, - filename: '[name].js', - assetModuleFilename: '[base]', - publicPath: '/' - }, - resolve: { - alias: { - '@': resolveRoot('src'), - 'vue$': 'vue/dist/vue.esm.js', - 'fixtures': resolveRoot('cypress/fixtures') - }, - extensions: ['.vue', '.js', '.json'], - fallback: { - timers: require.resolve('timers-browserify'), - stream: require.resolve('stream-browserify') - } - }, - module: { - rules: [ - ...(config.dev.useEslint ? [createLintingRule()] : []), - { - test: /\.vue$/, - loader: 'vue-loader', - options: vueLoaderConfig - }, - { - test: /\.js$/, - loader: 'babel-loader', - include: [ - resolveRoot('src/'), - resolveRoot('test/'), - resolveRoot('node_modules/webpack-dev-server/client/') - ], - options: { - plugins: [ '@babel/plugin-proposal-object-rest-spread' ] - } - },{ - test: /\.(woff|woff2|eot|ttf|otf|png|svg|jpg|jpeg|gif|ico)$/i, - type: 'asset' - },{ - test: /\.(geojson|kml|gpx|txt)$/i, - type: 'asset/source', - }, - ...styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) - ] - } -} diff --git a/taxi/map-ui/build/webpack.dev.conf.js b/taxi/map-ui/build/webpack.dev.conf.js deleted file mode 100644 index 9f0611d..0000000 --- a/taxi/map-ui/build/webpack.dev.conf.js +++ /dev/null @@ -1,82 +0,0 @@ -'use strict' -const {resolveRoot, styleLoaders} = require('./utils') -const webpack = require('webpack') -const config = require('../config') -const merge = require('webpack-merge') -const path = require('path') -const baseWebpackConfig = require('./webpack.base.conf') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const portfinder = require('portfinder') -const CopyWebpackPlugin = require("copy-webpack-plugin") - -const HOST = process.env.HOST -const PORT = process.env.PORT && Number(process.env.PORT) - -const devWebpackConfig = merge(baseWebpackConfig, { - mode: 'development', - stats: "normal", - module: { - rules: styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) - }, - // cheap-module-eval-source-map is faster for development - devtool: config.dev.devtool, - - // these devServer options should be customized in /config/index.js - devServer: { - client: { - logging: 'verbose', - overlay: { warnings: false, errors: true }, - }, - historyApiFallback: { - rewrites: [ - { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'dev.html') } - ], - }, - hot: true, - compress: true, - host: HOST || config.dev.host, - port: PORT || config.dev.port, - open: false, - static: { - directory: 'src/assets', - publicPath: '/static', - }, - proxy: config.dev.proxyTable - }, - watchOptions: { - poll: 1000, - }, - plugins: [ - new webpack.DefinePlugin({ - 'process.env': require('../config/dev.env') - }), - new CopyWebpackPlugin({ - patterns: [{ - from: resolveRoot("node_modules/leaflet/dist/images"), - to: resolveRoot("images") - }] - }), - // https://github.com/ampedandwired/html-webpack-plugin - new HtmlWebpackPlugin({ - filename: 'dev.html', - template: 'dev.html', - inject: true - }), - ] -}) - -module.exports = new Promise((resolve, reject) => { - portfinder.basePort = process.env.PORT || config.dev.port - portfinder.getPort((err, port) => { - if (err) { - reject(err) - } else { - // publish the new Port, necessary for e2e tests - process.env.PORT = port - // add port to devServer config - devWebpackConfig.devServer.port = port - - resolve(devWebpackConfig) - } - }) -}) diff --git a/taxi/map-ui/build/webpack.prod.conf.js b/taxi/map-ui/build/webpack.prod.conf.js deleted file mode 100644 index 10ff426..0000000 --- a/taxi/map-ui/build/webpack.prod.conf.js +++ /dev/null @@ -1,158 +0,0 @@ -'use strict' -const {assetsPath, resolveRoot} = require('./utils') -const webpack = require('webpack') -const config = require('../config') -const merge = require('webpack-merge') -const baseWebpackConfig = require('./webpack.base.conf') -const CopyWebpackPlugin = require('copy-webpack-plugin') -const HtmlWebpackPlugin = require('html-webpack-plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') -const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); -// const TerserPlugin = require("terser-webpack-plugin"); - -const env = process.env.NODE_ENV === 'testing' - ? require('../config/dev.env') - : require('../config/prod.env') - -console.log(env) - -const webpackConfig = merge(baseWebpackConfig, { - mode: 'production', - stats: 'errors-warnings', - module: { - // rules: utils.styleLoaders({ - // sourceMap: config.build.productionSourceMap, - // extract: true, - // usePostCSS: true - // }) - rules: [{ - test: /\.(sa|sc|c)ss$/, - exclude: [ - resolveRoot("node_modules/leaflet/dist"), - resolveRoot("node_modules/leaflet-measure/dist"), - resolveRoot("node_modules/vue2-leaflet-height-graph"), - resolveRoot("node_modules/leaflet/dist"), - ], - use: [ - MiniCssExtractPlugin.loader, - "css-loader", - "postcss-loader", - "sass-loader", - ], - },{ - test: /\.(styl|stylus)$/, - use: [ - MiniCssExtractPlugin.loader, - "css-loader", - "postcss-loader", - "stylus-loader" - ] - },{ - test: /\.css$/, - include: [ - resolveRoot("node_modules/leaflet/dist"), - resolveRoot("node_modules/leaflet-measure/dist"), - resolveRoot("node_modules/vue2-leaflet-height-graph"), - resolveRoot("node_modules/leaflet/dist"), - ], - use: [ - MiniCssExtractPlugin.loader, - "css-loader", - "postcss-loader", - ], - generator: { - outputPath: 'static/img', - } - } - ] - }, - resolve: { - alias: { - "favicon.ico": "static/img/favicon.ico", - } - }, - devtool: config.build.productionSourceMap ? config.build.devtool : false, - output: { - path: resolveRoot(), - filename: 'static/js/[name].[contenthash].js', - }, - optimization: { - runtimeChunk: 'single', - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors', - chunks: 'all' - } - } - }, - minimizer: [ - // Compress extracted CSS. We are using this plugin so that possible - // duplicated CSS from different components can be deduped. - new CssMinimizerPlugin({}) - ] - }, - plugins: [ - // http://vuejs.github.io/vue-loader/en/workflow/production.html - new webpack.DefinePlugin({ - 'process.env': env - }), - // extract css into its own file - new MiniCssExtractPlugin({ - filename: assetsPath('css/[name].[fullhash].css'), - chunkFilename: "[id].[contenthash].css", - }), - // generate dist index.html with correct asset hash for caching. - // you can customize output by editing /index.html - // see https://github.com/ampedandwired/html-webpack-plugin - new HtmlWebpackPlugin({ - filename: process.env.NODE_ENV === 'testing' - ? 'index.html' - : config.build.index, - template: 'dev.html', - inject: true, - minify: { - removeComments: true, - collapseWhitespace: true, - removeAttributeQuotes: true - // more options: - // https://github.com/kangax/html-minifier#options-quick-reference - } - }), - // keep module.id stable when vendor modules does not change - new webpack.ids.HashedModuleIdsPlugin(), - // copy custom static assets - new CopyWebpackPlugin({ - patterns: [{ - from: resolveRoot("src/assets"), - to: resolveRoot("static") - }] - }), - ] -}) - -if (config.build.productionGzip) { - const CompressionWebpackPlugin = require('compression-webpack-plugin') - - webpackConfig.plugins.push( - new CompressionWebpackPlugin({ - filename: '[path].gz[query]', - algorithm: 'gzip', - test: new RegExp( - '\\.(' + - config.build.productionGzipExtensions.join('|') + - ')$' - ), - threshold: 10240, - minRatio: 0.8 - }) - ) -} - -if (config.build.bundleAnalyzerReport) { - const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin - webpackConfig.plugins.push(new BundleAnalyzerPlugin()) -} - -module.exports = webpackConfig diff --git a/taxi/map-ui/config/dev.env.js b/taxi/map-ui/config/dev.env.js deleted file mode 100644 index 1e22973..0000000 --- a/taxi/map-ui/config/dev.env.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict' -const merge = require('webpack-merge') -const prodEnv = require('./prod.env') - -module.exports = merge(prodEnv, { - NODE_ENV: '"development"' -}) diff --git a/taxi/map-ui/config/index.js b/taxi/map-ui/config/index.js deleted file mode 100644 index 5dc66bf..0000000 --- a/taxi/map-ui/config/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' -// Template version: 1.2.8 -// see http://vuejs-templates.github.io/webpack for documentation. - -const path = require('path') - -module.exports = { - dev: { - - // Paths - assetsSubDirectory: 'static', - assetsPublicPath: '/', - proxyTable: {}, - - // Various Dev Server settings - host: 'localhost', // can be overwritten by process.env.HOST - port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined - errorOverlay: true, - notifyOnErrors: true, - - // Use Eslint Loader? - // If true, your code will be linted during bundling and - // linting errors and warnings will be shown in the console. - useEslint: true, - // If true, eslint errors and warnings will also be shown in the error overlay - // in the browser. - showEslintErrorsInOverlay: false, - - /** - * Source Maps - */ - - // https://webpack.js.org/configuration/devtool/#development - devtool: 'eval-cheap-module-source-map', - - // If you have problems debugging vue-files in devtools, - // set this to false - it *may* help - // https://vue-loader.vuejs.org/en/options.html#cachebusting - cacheBusting: true, - - cssSourceMap: true, - }, - - build: { - // Template for index.html - index: path.resolve(__dirname, '../index.html'), - - // Paths - assetsRoot: path.resolve(__dirname, '../'), - assetsSubDirectory: 'static', // where to save the static css and js - assetsPublicPath: '/', - - /** - * Source Maps - */ - - productionSourceMap: true, - // https://webpack.js.org/configuration/devtool/#production - devtool: 'source-map', - - // Gzip off by default as many popular static hosts such as - // Surge or Netlify already gzip all static assets for you. - // Before setting to `true`, make sure to: - // npm install --save-dev compression-webpack-plugin - productionGzip: false, - productionGzipExtensions: ['js', 'css'], - - // Run the build command with an extra argument to - // View the bundle analyzer report after build finishes: - // `npm run build --report` - // Set to `true` or `false` to always turn it on or off - bundleAnalyzerReport: process.env.npm_config_report - } -} diff --git a/taxi/map-ui/config/prod.env.js b/taxi/map-ui/config/prod.env.js deleted file mode 100644 index 86f9a32..0000000 --- a/taxi/map-ui/config/prod.env.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' - -const packageJson = require('../package.json') - -let ORSKEY = process.env.ORSKEY -let BITLYLOGIN = process.env.BITLYLOGIN -let BITLYAPIKEY = process.env.BITLYAPIKEY - -let env = { - NODE_ENV: '"production"', - PACKAGE_JSON: JSON.stringify(packageJson) -} - -if (ORSKEY) { - env.ORSKEY = `"${ORSKEY}"` -} -if (BITLYLOGIN) { - env.BITLYLOGIN = `"${BITLYLOGIN}"` -} -if (BITLYAPIKEY) { - env.BITLYAPIKEY = `"${BITLYAPIKEY}"` -} - -module.exports = env diff --git a/taxi/map-ui/cypress.config.js b/taxi/map-ui/cypress.config.js deleted file mode 100644 index 4a7bf44..0000000 --- a/taxi/map-ui/cypress.config.js +++ /dev/null @@ -1,37 +0,0 @@ -const { defineConfig } = require("cypress"); -const config = require('./config'); -const webpackPreprocessor = require('@cypress/webpack-preprocessor') - -module.exports = defineConfig({ - projectId: '2npvgh', - video: false, - e2e: { - specPattern: [ - "cypress/e2e/*.{cy,spec}.{js,jsx,ts,tsx}", - "src/**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}" - ], - baseUrl: 'http://localhost:8080', - setupNodeEvents(on, config) { - // implement node event listeners here - const options = { - // send in the options from your webpack.config.js, so it works the same - // as your app's code - webpackOptions: require('./build/webpack.base.conf'), - watchOptions: {}, - } - - on('file:preprocessor', webpackPreprocessor(options)) - }, - }, - component: { - devServer: { - framework: 'vue', - bundler: 'webpack', - // optionally pass in webpack config - webpackConfig: require('./build/webpack.cypress.conf'), - }, - specPattern: 'src/**/*.cy.{js,jsx,ts,tsx}', - excludeSpecPattern: "src/**/__tests__/*.{cy,spec}.{js,ts,jsx,tsx}" - }, - -}); diff --git a/taxi/map-ui/cypress/e2e/1-getting-started/todo.cy.js b/taxi/map-ui/cypress/e2e/1-getting-started/todo.cy.js deleted file mode 100644 index 4768ff9..0000000 --- a/taxi/map-ui/cypress/e2e/1-getting-started/todo.cy.js +++ /dev/null @@ -1,143 +0,0 @@ -/// - -// Welcome to Cypress! -// -// This spec file contains a variety of sample tests -// for a todo list app that are designed to demonstrate -// the power of writing tests in Cypress. -// -// To learn more about how Cypress works and -// what makes it such an awesome testing tool, -// please read our getting started guide: -// https://on.cypress.io/introduction-to-cypress - -describe('example to-do app', () => { - beforeEach(() => { - // Cypress starts out with a blank slate for each test - // so we must tell it to visit our website with the `cy.visit()` command. - // Since we want to visit the same URL at the start of all our tests, - // we include it in our beforeEach function so that it runs before each test - cy.visit('https://example.cypress.io/todo') - }) - - it('displays two todo items by default', () => { - // We use the `cy.get()` command to get all elements that match the selector. - // Then, we use `should` to assert that there are two matched items, - // which are the two default items. - cy.get('.todo-list li').should('have.length', 2) - - // We can go even further and check that the default todos each contain - // the correct text. We use the `first` and `last` functions - // to get just the first and last matched elements individually, - // and then perform an assertion with `should`. - cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') - cy.get('.todo-list li').last().should('have.text', 'Walk the dog') - }) - - it('can add new todo items', () => { - // We'll store our item text in a variable so we can reuse it - const newItem = 'Feed the cat' - - // Let's get the input element and use the `type` command to - // input our new list item. After typing the content of our item, - // we need to type the enter key as well in order to submit the input. - // This input has a data-test attribute so we'll use that to select the - // element in accordance with best practices: - // https://on.cypress.io/selecting-elements - cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) - - // Now that we've typed our new item, let's check that it actually was added to the list. - // Since it's the newest item, it should exist as the last element in the list. - // In addition, with the two default items, we should have a total of 3 elements in the list. - // Since assertions yield the element that was asserted on, - // we can chain both of these assertions together into a single statement. - cy.get('.todo-list li') - .should('have.length', 3) - .last() - .should('have.text', newItem) - }) - - it('can check off an item as completed', () => { - // In addition to using the `get` command to get an element by selector, - // we can also use the `contains` command to get an element by its contents. - // However, this will yield the