Skip to content

Commit

Permalink
feat: Bump ts-proto-descriptors. (#489)
Browse files Browse the repository at this point in the history
* feat: Bump ts-proto-descriptors.

* fix: pass schema through fromPartial (#493)

Co-authored-by: Vilsol <[email protected]>
  • Loading branch information
stephenh and Vilsol authored Feb 12, 2022
1 parent 93437b5 commit d454448
Show file tree
Hide file tree
Showing 8 changed files with 1,177 additions and 168 deletions.
56 changes: 47 additions & 9 deletions integration/meta-typings/google/protobuf/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,39 @@ export interface ProtoMetadata {

export const protoMetadata: ProtoMetadata = {
fileDescriptor: FileDescriptorProto.fromPartial({
name: 'google/protobuf/timestamp.proto',
package: 'google.protobuf',
dependency: [],
publicDependency: [],
weakDependency: [],
messageType: [
{
name: 'Timestamp',
field: [
{ name: 'seconds', number: 1, label: 1, type: 3, jsonName: 'seconds' },
{ name: 'nanos', number: 2, label: 1, type: 5, jsonName: 'nanos' },
{
name: 'seconds',
number: 1,
label: 1,
type: 3,
typeName: '',
extendee: '',
defaultValue: '',
oneofIndex: 0,
jsonName: 'seconds',
proto3Optional: false,
},
{
name: 'nanos',
number: 2,
label: 1,
type: 5,
typeName: '',
extendee: '',
defaultValue: '',
oneofIndex: 0,
jsonName: 'nanos',
proto3Optional: false,
},
],
extension: [],
nestedType: [],
Expand All @@ -175,46 +200,59 @@ export const protoMetadata: ProtoMetadata = {
oneofDecl: [],
reservedRange: [],
reservedName: [],
name: 'Timestamp',
},
],
enumType: [],
service: [],
extension: [],
name: 'google/protobuf/timestamp.proto',
package: 'google.protobuf',
options: {
uninterpretedOption: [],
javaPackage: 'com.google.protobuf',
javaOuterClassname: 'TimestampProto',
javaMultipleFiles: true,
javaGenerateEqualsAndHash: false,
javaStringCheckUtf8: false,
optimizeFor: 1,
goPackage: 'google.golang.org/protobuf/types/known/timestamppb',
ccGenericServices: false,
javaGenericServices: false,
pyGenericServices: false,
phpGenericServices: false,
deprecated: false,
ccEnableArenas: true,
objcClassPrefix: 'GPB',
csharpNamespace: 'Google.Protobuf.WellKnownTypes',
swiftPrefix: '',
phpClassPrefix: '',
phpNamespace: '',
phpMetadataNamespace: '',
rubyPackage: '',
uninterpretedOption: [],
},
sourceCodeInfo: {
location: [
{
path: [4, 0],
span: [135, 0, 146, 1],
leadingDetachedComments: [],
leadingComments:
' A Timestamp represents a point in time independent of any time zone or local\n calendar, encoded as a count of seconds and fractions of seconds at\n nanosecond resolution. The count is relative to an epoch at UTC midnight on\n January 1, 1970, in the proleptic Gregorian calendar which extends the\n Gregorian calendar backwards to year one.\n\n All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap\n second table is needed for interpretation, using a [24-hour linear\n smear](https://developers.google.com/time/smear).\n\n The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n restricting to that range, we ensure that we can convert to and from [RFC\n 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n\n # Examples\n\n Example 1: Compute Timestamp from POSIX `time()`.\n\n Timestamp timestamp;\n timestamp.set_seconds(time(NULL));\n timestamp.set_nanos(0);\n\n Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n\n struct timeval tv;\n gettimeofday(&tv, NULL);\n\n Timestamp timestamp;\n timestamp.set_seconds(tv.tv_sec);\n timestamp.set_nanos(tv.tv_usec * 1000);\n\n Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n\n FILETIME ft;\n GetSystemTimeAsFileTime(&ft);\n UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n\n // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n Timestamp timestamp;\n timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n\n Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n\n long millis = System.currentTimeMillis();\n\n Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n .setNanos((int) ((millis % 1000) * 1000000)).build();\n\n\n Example 5: Compute Timestamp from Java `Instant.now()`.\n\n Instant now = Instant.now();\n\n Timestamp timestamp =\n Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n .setNanos(now.getNano()).build();\n\n\n Example 6: Compute Timestamp from current time in Python.\n\n timestamp = Timestamp()\n timestamp.GetCurrentTime()\n\n # JSON Mapping\n\n In JSON format, the Timestamp type is encoded as a string in the\n [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"\n where {year} is always expressed using four digits while {month}, {day},\n {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone\n is required. A proto3 JSON serializer should always use UTC (as indicated by\n "Z") when printing the Timestamp type and a proto3 JSON parser should be\n able to accept both UTC and other timezones (as indicated by an offset).\n\n For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past\n 01:30 UTC on January 15, 2017.\n\n In JavaScript, one can convert a Date object to this format using the\n standard\n [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n method. In Python, a standard `datetime.datetime` object can be converted\n to this format using\n [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n the time format spec \'%Y-%m-%dT%H:%M:%S.%fZ\'. Likewise, in Java, one can use\n the Joda Time\'s [`ISODateTimeFormat.dateTime()`](\n http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D\n ) to obtain a formatter capable of generating timestamps in this format.\n\n\n',
trailingComments: '',
leadingDetachedComments: [],
},
{
path: [4, 0, 2, 0],
span: [139, 2, 20],
leadingDetachedComments: [],
leadingComments:
' Represents seconds of UTC time since Unix epoch\n 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n 9999-12-31T23:59:59Z inclusive.\n',
trailingComments: '',
leadingDetachedComments: [],
},
{
path: [4, 0, 2, 1],
span: [145, 2, 18],
leadingDetachedComments: [],
leadingComments:
' Non-negative fractions of a second at nanosecond resolution. Negative\n second values with fractions must still have non-negative nanos values\n that count forward in time. Must be from 0 to 999,999,999\n inclusive.\n',
trailingComments: '',
leadingDetachedComments: [],
},
],
},
Expand Down
Loading

0 comments on commit d454448

Please sign in to comment.