proto-lens-protobuf-types 0.3.0.3 → 0.4.0.0
raw patch · 8 files changed
+159/−31 lines, 8 filesdep +proto-lens-runtimedep −proto-lens-protocdep ~basedep ~lens-labelsdep ~proto-lens
Dependencies added: proto-lens-runtime
Dependencies removed: proto-lens-protoc
Dependency ranges changed: base, lens-labels, proto-lens
Files
- Changelog.md +5/−3
- proto-lens-protobuf-types.cabal +13/−8
- proto-src/google/protobuf/any.proto +35/−9
- proto-src/google/protobuf/duration.proto +21/−2
- proto-src/google/protobuf/empty.proto +52/−0
- proto-src/google/protobuf/timestamp.proto +30/−6
- proto-src/google/protobuf/wrappers.proto +0/−1
- src/Data/ProtoLens/Any.hs +3/−2
Changelog.md view
@@ -1,12 +1,14 @@ # Changelog for `proto-lens-protobuf-types` -## v0.3.0.3-- Add support for ghc-8.6.+## v0.4.0.0+- Switch to `proto-lens-{setup/runtime}` v0.4.+- Bump the lens-labels dependency to `0.3.*` for consistency with other+ packages. ## v0.3.0.2 - Bump the lower bound on `base` to indicate we require `ghc>=8.0`. - Use autogen-modules. (#196)-- Use OverloadedLabels internally, ratehr than the `_Fields` modules. (#198)+- Use OverloadedLabels internally, rather than the `_Fields` modules. (#198) ## v0.3.0.1 - Bump the dependency on `base` for `ghc-8.4.2`.
proto-lens-protobuf-types.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: d340f8c6a6e81e221100f47fef4aa2af92e4ff8981c76f7753f6e3c2a6d5e15f+-- hash: 421eb4f7d03eb52d16756452ce958b3abd20b3efbe80968d73e77b6943052841 name: proto-lens-protobuf-types-version: 0.3.0.3+version: 0.4.0.0 synopsis: Basic protocol buffer message types. description: This package provides bindings standard protocol message types, for use with the proto-lens library. category: Data@@ -22,6 +22,7 @@ Changelog.md proto-src/google/protobuf/any.proto proto-src/google/protobuf/duration.proto+ proto-src/google/protobuf/empty.proto proto-src/google/protobuf/timestamp.proto proto-src/google/protobuf/wrappers.proto @@ -33,8 +34,8 @@ custom-setup setup-depends: Cabal- , base >=4.9 && <4.13- , proto-lens-protoc ==0.3.*+ , base >=4.9 && <4.12+ , proto-lens-setup ==0.4.* library exposed-modules:@@ -43,6 +44,8 @@ Proto.Google.Protobuf.Any_Fields Proto.Google.Protobuf.Duration Proto.Google.Protobuf.Duration_Fields+ Proto.Google.Protobuf.Empty+ Proto.Google.Protobuf.Empty_Fields Proto.Google.Protobuf.Wrappers Proto.Google.Protobuf.Wrappers_Fields Proto.Google.Protobuf.Timestamp@@ -52,10 +55,10 @@ hs-source-dirs: src build-depends:- base >=4.9 && <4.13- , lens-labels ==0.2.*- , proto-lens ==0.3.*- , proto-lens-protoc ==0.3.*+ base >=4.9 && <4.12+ , lens-labels ==0.3.*+ , proto-lens ==0.4.*+ , proto-lens-runtime ==0.4.* , text ==1.2.* default-language: Haskell2010 autogen-modules:@@ -63,6 +66,8 @@ Proto.Google.Protobuf.Any_Fields Proto.Google.Protobuf.Duration Proto.Google.Protobuf.Duration_Fields+ Proto.Google.Protobuf.Empty+ Proto.Google.Protobuf.Empty_Fields Proto.Google.Protobuf.Wrappers Proto.Google.Protobuf.Wrappers_Fields Proto.Google.Protobuf.Timestamp
proto-src/google/protobuf/any.proto view
@@ -37,7 +37,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "AnyProto"; option java_multiple_files = true;-option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // `Any` contains an arbitrary serialized protocol buffer message along with a@@ -65,6 +64,26 @@ // foo = any.unpack(Foo.class); // } //+// Example 3: Pack and unpack a message in Python.+//+// foo = Foo(...)+// any = Any()+// any.Pack(foo)+// ...+// if any.Is(Foo.DESCRIPTOR):+// any.Unpack(foo)+// ...+//+// Example 4: Pack and unpack a message in Go+//+// foo := &pb.Foo{...}+// any, err := ptypes.MarshalAny(foo)+// ...+// foo := &pb.Foo{}+// if err := ptypes.UnmarshalAny(any, foo); err != nil {+// ...+// }+// // The pack methods provided by protobuf library will by default use // 'type.googleapis.com/full.type.name' as the type URL and the unpack // methods only use the fully qualified type name after the last '/'@@ -101,15 +120,18 @@ // } // message Any {- // A URL/resource name whose content describes the type of the- // serialized protocol buffer message.+ // A URL/resource name that uniquely identifies the type of the serialized+ // protocol buffer message. The last segment of the URL's path must represent+ // the fully qualified name of the type (as in+ // `path/google.protobuf.Duration`). The name should be in a canonical form+ // (e.g., leading "." is not accepted). //- // For URLs which use the schema `http`, `https`, or no schema, the- // following restrictions and interpretations apply:+ // In practice, teams usually precompile into the binary all types that they+ // expect it to use in the context of Any. However, for URLs which use the+ // scheme `http`, `https`, or no scheme, one can optionally set up a type+ // server that maps type URLs to message definitions as follows: //- // * If no schema is provided, `https` is assumed.- // * The last segment of the URL's path must represent the fully- // qualified name of the type (as in `path/google.protobuf.Duration`).+ // * If no scheme is provided, `https` is assumed. // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the@@ -118,7 +140,11 @@ // on changes to types. (Use versioned type names to manage // breaking changes.) //- // Schemas other than `http`, `https` (or the empty schema) might be+ // Note: this functionality is not currently available in the official+ // protobuf release, and it is not used for type URLs beginning with+ // type.googleapis.com.+ //+ // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // string type_url = 1;
proto-src/google/protobuf/duration.proto view
@@ -33,11 +33,11 @@ package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes";+option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/duration"; option java_package = "com.google.protobuf"; option java_outer_classname = "DurationProto"; option java_multiple_files = true;-option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Duration represents a signed, fixed-length span of time represented@@ -47,6 +47,8 @@ // two Timestamp values is a Duration and it can be added or subtracted // from a Timestamp. Range is approximately +-10,000 years. //+// # Examples+// // Example 1: Compute Duration from two Timestamps in pseudo code. // // Timestamp start = ...;@@ -81,11 +83,28 @@ // end.nanos -= 1000000000; // } //+// Example 3: Compute Duration from datetime.timedelta in Python. //+// td = datetime.timedelta(days=3, minutes=10)+// duration = Duration()+// duration.FromTimedelta(td)+//+// # JSON Mapping+//+// In JSON format, the Duration type is encoded as a string rather than an+// object, where the string ends in the suffix "s" (indicating seconds) and+// is preceded by the number of seconds, with nanoseconds expressed as+// fractional seconds. For example, 3 seconds with 0 nanoseconds should be+// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should+// be expressed in JSON format as "3.000000001s", and 3 seconds and 1+// microsecond should be expressed in JSON format as "3.000001s".+//+// message Duration { // Signed seconds of the span of time. Must be from -315,576,000,000- // to +315,576,000,000 inclusive.+ // to +315,576,000,000 inclusive. Note: these bounds are computed from:+ // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years int64 seconds = 1; // Signed fractions of a second at nanosecond resolution of the span
+ proto-src/google/protobuf/empty.proto view
@@ -0,0 +1,52 @@+// Protocol Buffers - Google's data interchange format+// Copyright 2008 Google Inc. All rights reserved.+// https://developers.google.com/protocol-buffers/+//+// Redistribution and use in source and binary forms, with or without+// modification, are permitted provided that the following conditions are+// met:+//+// * Redistributions of source code must retain the above copyright+// notice, this list of conditions and the following disclaimer.+// * Redistributions in binary form must reproduce the above+// copyright notice, this list of conditions and the following disclaimer+// in the documentation and/or other materials provided with the+// distribution.+// * Neither the name of Google Inc. nor the names of its+// contributors may be used to endorse or promote products derived from+// this software without specific prior written permission.+//+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.++syntax = "proto3";++package google.protobuf;++option csharp_namespace = "Google.Protobuf.WellKnownTypes";+option go_package = "github.com/golang/protobuf/ptypes/empty";+option java_package = "com.google.protobuf";+option java_outer_classname = "EmptyProto";+option java_multiple_files = true;+option objc_class_prefix = "GPB";+option cc_enable_arenas = true;++// A generic empty message that you can re-use to avoid defining duplicated+// empty messages in your APIs. A typical example is to use it as the request+// or the response type of an API method. For instance:+//+// service Foo {+// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);+// }+//+// The JSON representation for `Empty` is empty JSON object `{}`.+message Empty {}
proto-src/google/protobuf/timestamp.proto view
@@ -38,7 +38,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true;-option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Timestamp represents a point in time independent of any time zone@@ -53,6 +52,8 @@ // and from RFC 3339 date strings. // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). //+// # Examples+// // Example 1: Compute Timestamp from POSIX `time()`. // // Timestamp timestamp;@@ -90,16 +91,39 @@ // // Example 5: Compute Timestamp from current time in Python. //-// now = time.time()-// seconds = int(now)-// nanos = int((now - seconds) * 10**9)-// timestamp = Timestamp(seconds=seconds, nanos=nanos)+// timestamp = Timestamp()+// timestamp.GetCurrentTime() //+// # JSON Mapping //+// In JSON format, the Timestamp type is encoded as a string in the+// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the+// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"+// where {year} is always expressed using four digits while {month}, {day},+// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional+// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),+// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone+// is required. A proto3 JSON serializer should always use UTC (as indicated by+// "Z") when printing the Timestamp type and a proto3 JSON parser should be+// able to accept both UTC and other timezones (as indicated by an offset).+//+// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past+// 01:30 UTC on January 15, 2017.+//+// In JavaScript, one can convert a Date object to this format using the+// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]+// method. In Python, a standard `datetime.datetime` object can be converted+// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)+// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one+// can use the Joda Time's [`ISODateTimeFormat.dateTime()`](+// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--+// ) to obtain a formatter capable of generating timestamps in this format.+//+// message Timestamp { // Represents seconds of UTC time since Unix epoch- // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to+ // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. int64 seconds = 1;
proto-src/google/protobuf/wrappers.proto view
@@ -43,7 +43,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true;-option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // Wrapper message for `double`.
src/Data/ProtoLens/Any.hs view
@@ -17,7 +17,7 @@ import Data.Typeable (Typeable) import Data.ProtoLens ( decodeMessage- , def+ , defMessage , encodeMessage , Message(..) )@@ -36,7 +36,8 @@ -- | Packs the given message into an 'Any' using the given type URL prefix. packWithPrefix :: forall a . Message a => Text -> a -> Any packWithPrefix prefix x =- def & #typeUrl .~ (prefix <> "/" <> name)+ defMessage+ & #typeUrl .~ (prefix <> "/" <> name) & #value .~ encodeMessage x where name = messageName (Proxy @a)