@raystack/proton 0.1.0-ce225175aa066e6f296bc489293bb83ed0edcef6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/google/api/annotations_pb.ts +33 -0
- package/google/api/field_behavior.ts +95 -0
- package/google/api/field_behavior_pb.ts +139 -0
- package/google/api/http.ts +695 -0
- package/google/api/http_pb.ts +547 -0
- package/google/api/httpbody.ts +159 -0
- package/google/api/httpbody_pb.ts +122 -0
- package/google/protobuf/any.ts +322 -0
- package/google/protobuf/descriptor.ts +3475 -0
- package/google/protobuf/duration.ts +231 -0
- package/google/protobuf/struct.ts +484 -0
- package/google/protobuf/timestamp.ts +290 -0
- package/google/protobuf/wrappers.ts +752 -0
- package/package.json +47 -0
- package/protoc-gen-openapiv2/options/annotations_pb.ts +78 -0
- package/protoc-gen-openapiv2/options/openapiv2.ts +3110 -0
- package/protoc-gen-openapiv2/options/openapiv2_pb.ts +1995 -0
- package/raystack/assets/index.ts +29 -0
- package/raystack/assets/v1beta1/bucket.ts +362 -0
- package/raystack/assets/v1beta1/bucket_pb.ts +233 -0
- package/raystack/assets/v1beta1/dashboard.ts +426 -0
- package/raystack/assets/v1beta1/dashboard_pb.ts +275 -0
- package/raystack/assets/v1beta1/event.ts +105 -0
- package/raystack/assets/v1beta1/event_pb.ts +70 -0
- package/raystack/assets/v1beta1/group.ts +223 -0
- package/raystack/assets/v1beta1/group_pb.ts +149 -0
- package/raystack/assets/v1beta1/job.ts +147 -0
- package/raystack/assets/v1beta1/job_pb.ts +100 -0
- package/raystack/assets/v1beta1/lineage.ts +90 -0
- package/raystack/assets/v1beta1/lineage_pb.ts +61 -0
- package/raystack/assets/v1beta1/ownership.ts +179 -0
- package/raystack/assets/v1beta1/ownership_pb.ts +119 -0
- package/raystack/assets/v1beta1/preview.ts +87 -0
- package/raystack/assets/v1beta1/preview_pb.ts +58 -0
- package/raystack/assets/v1beta1/properties.ts +116 -0
- package/raystack/assets/v1beta1/properties_pb.ts +63 -0
- package/raystack/assets/v1beta1/resource.ts +149 -0
- package/raystack/assets/v1beta1/resource_pb.ts +96 -0
- package/raystack/assets/v1beta1/schema.ts +421 -0
- package/raystack/assets/v1beta1/schema_pb.ts +262 -0
- package/raystack/assets/v1beta1/table.ts +408 -0
- package/raystack/assets/v1beta1/table_pb.ts +266 -0
- package/raystack/assets/v1beta1/timestamp.ts +158 -0
- package/raystack/assets/v1beta1/timestamp_pb.ts +107 -0
- package/raystack/assets/v1beta1/topic.ts +253 -0
- package/raystack/assets/v1beta1/topic_pb.ts +171 -0
- package/raystack/assets/v1beta1/user.ts +451 -0
- package/raystack/assets/v1beta1/user_pb.ts +292 -0
- package/raystack/assets/v1beta2/application.ts +125 -0
- package/raystack/assets/v1beta2/application_pb.ts +79 -0
- package/raystack/assets/v1beta2/asset.ts +269 -0
- package/raystack/assets/v1beta2/asset_pb.ts +157 -0
- package/raystack/assets/v1beta2/bucket.ts +341 -0
- package/raystack/assets/v1beta2/bucket_pb.ts +215 -0
- package/raystack/assets/v1beta2/common.ts +392 -0
- package/raystack/assets/v1beta2/common_pb.ts +258 -0
- package/raystack/assets/v1beta2/dashboard.ts +393 -0
- package/raystack/assets/v1beta2/dashboard_pb.ts +247 -0
- package/raystack/assets/v1beta2/experiment.ts +274 -0
- package/raystack/assets/v1beta2/experiment_pb.ts +180 -0
- package/raystack/assets/v1beta2/feature_table.ts +387 -0
- package/raystack/assets/v1beta2/feature_table_pb.ts +237 -0
- package/raystack/assets/v1beta2/group.ts +178 -0
- package/raystack/assets/v1beta2/group_pb.ts +118 -0
- package/raystack/assets/v1beta2/job.ts +99 -0
- package/raystack/assets/v1beta2/job_pb.ts +65 -0
- package/raystack/assets/v1beta2/metric.ts +163 -0
- package/raystack/assets/v1beta2/metric_pb.ts +105 -0
- package/raystack/assets/v1beta2/model.ts +519 -0
- package/raystack/assets/v1beta2/model_pb.ts +322 -0
- package/raystack/assets/v1beta2/table.ts +663 -0
- package/raystack/assets/v1beta2/table_pb.ts +409 -0
- package/raystack/assets/v1beta2/topic.ts +275 -0
- package/raystack/assets/v1beta2/topic_pb.ts +181 -0
- package/raystack/assets/v1beta2/user.ts +433 -0
- package/raystack/assets/v1beta2/user_pb.ts +277 -0
- package/raystack/common/index.ts +3 -0
- package/raystack/common/v1/service-CommonService_connectquery.ts +21 -0
- package/raystack/common/v1/service.client.ts +37 -0
- package/raystack/common/v1/service.ts +245 -0
- package/raystack/common/v1/service_connect.ts +26 -0
- package/raystack/common/v1/service_pb.ts +149 -0
- package/raystack/compass/index.ts +3 -0
- package/raystack/compass/v1beta1/service-CompassService_connectquery.ts +605 -0
- package/raystack/compass/v1beta1/service.client.ts +594 -0
- package/raystack/compass/v1beta1/service.ts +8169 -0
- package/raystack/compass/v1beta1/service_connect.ts +407 -0
- package/raystack/compass/v1beta1/service_pb.ts +4975 -0
- package/raystack/entropy/index.ts +6 -0
- package/raystack/entropy/v1beta1/module-ModuleService_connectquery.ts +77 -0
- package/raystack/entropy/v1beta1/module.client.ts +89 -0
- package/raystack/entropy/v1beta1/module.ts +692 -0
- package/raystack/entropy/v1beta1/module_connect.ts +62 -0
- package/raystack/entropy/v1beta1/module_pb.ts +445 -0
- package/raystack/entropy/v1beta1/resource-ResourceService_connectquery.ts +105 -0
- package/raystack/entropy/v1beta1/resource.client.ts +129 -0
- package/raystack/entropy/v1beta1/resource.ts +1817 -0
- package/raystack/entropy/v1beta1/resource_connect.ts +89 -0
- package/raystack/entropy/v1beta1/resource_pb.ts +1092 -0
- package/raystack/frontier/index.ts +7 -0
- package/raystack/frontier/v1beta1/admin-AdminService_connectquery.ts +756 -0
- package/raystack/frontier/v1beta1/admin.client.ts +849 -0
- package/raystack/frontier/v1beta1/admin.ts +9007 -0
- package/raystack/frontier/v1beta1/admin_connect.ts +573 -0
- package/raystack/frontier/v1beta1/admin_pb.ts +5615 -0
- package/raystack/frontier/v1beta1/frontier-FrontierService_connectquery.ts +2399 -0
- package/raystack/frontier/v1beta1/frontier.client.ts +2307 -0
- package/raystack/frontier/v1beta1/frontier.ts +23706 -0
- package/raystack/frontier/v1beta1/frontier_connect.ts +1574 -0
- package/raystack/frontier/v1beta1/frontier_pb.ts +15258 -0
- package/raystack/frontier/v1beta1/models.ts +7433 -0
- package/raystack/frontier/v1beta1/models_pb.ts +4345 -0
- package/raystack/guardian/index.ts +3 -0
- package/raystack/guardian/v1beta1/guardian-GuardianService_connectquery.ts +569 -0
- package/raystack/guardian/v1beta1/guardian.client.ts +552 -0
- package/raystack/guardian/v1beta1/guardian.ts +9688 -0
- package/raystack/guardian/v1beta1/guardian_connect.ts +381 -0
- package/raystack/guardian/v1beta1/guardian_pb.ts +5858 -0
- package/raystack/optimus/core/v1beta1/backup-BackupService_connectquery.ts +49 -0
- package/raystack/optimus/core/v1beta1/backup.client.ts +63 -0
- package/raystack/optimus/core/v1beta1/backup.ts +708 -0
- package/raystack/optimus/core/v1beta1/backup_connect.ts +44 -0
- package/raystack/optimus/core/v1beta1/backup_pb.ts +406 -0
- package/raystack/optimus/core/v1beta1/job_run-JobRunService_connectquery.ts +71 -0
- package/raystack/optimus/core/v1beta1/job_run.client.ts +96 -0
- package/raystack/optimus/core/v1beta1/job_run.ts +1008 -0
- package/raystack/optimus/core/v1beta1/job_run_connect.ts +63 -0
- package/raystack/optimus/core/v1beta1/job_run_pb.ts +612 -0
- package/raystack/optimus/core/v1beta1/job_spec-JobSpecificationService_connectquery.ts +249 -0
- package/raystack/optimus/core/v1beta1/job_spec.client.ts +363 -0
- package/raystack/optimus/core/v1beta1/job_spec.ts +5134 -0
- package/raystack/optimus/core/v1beta1/job_spec_connect.ts +233 -0
- package/raystack/optimus/core/v1beta1/job_spec_pb.ts +3196 -0
- package/raystack/optimus/core/v1beta1/namespace-NamespaceService_connectquery.ts +55 -0
- package/raystack/optimus/core/v1beta1/namespace.client.ts +75 -0
- package/raystack/optimus/core/v1beta1/namespace.ts +477 -0
- package/raystack/optimus/core/v1beta1/namespace_connect.ts +50 -0
- package/raystack/optimus/core/v1beta1/namespace_pb.ts +291 -0
- package/raystack/optimus/core/v1beta1/project-ProjectService_connectquery.ts +55 -0
- package/raystack/optimus/core/v1beta1/project.client.ts +75 -0
- package/raystack/optimus/core/v1beta1/project.ts +520 -0
- package/raystack/optimus/core/v1beta1/project_connect.ts +50 -0
- package/raystack/optimus/core/v1beta1/project_pb.ts +322 -0
- package/raystack/optimus/core/v1beta1/replay-ReplayService_connectquery.ts +63 -0
- package/raystack/optimus/core/v1beta1/replay.client.ts +76 -0
- package/raystack/optimus/core/v1beta1/replay.ts +881 -0
- package/raystack/optimus/core/v1beta1/replay_connect.ts +53 -0
- package/raystack/optimus/core/v1beta1/replay_pb.ts +522 -0
- package/raystack/optimus/core/v1beta1/resource-ResourceService_connectquery.ts +104 -0
- package/raystack/optimus/core/v1beta1/resource.client.ts +148 -0
- package/raystack/optimus/core/v1beta1/resource.ts +1329 -0
- package/raystack/optimus/core/v1beta1/resource_connect.ts +96 -0
- package/raystack/optimus/core/v1beta1/resource_pb.ts +791 -0
- package/raystack/optimus/core/v1beta1/runtime-RuntimeService_connectquery.ts +23 -0
- package/raystack/optimus/core/v1beta1/runtime.client.ts +45 -0
- package/raystack/optimus/core/v1beta1/runtime.ts +131 -0
- package/raystack/optimus/core/v1beta1/runtime_connect.ts +30 -0
- package/raystack/optimus/core/v1beta1/runtime_pb.ts +82 -0
- package/raystack/optimus/core/v1beta1/secret-SecretService_connectquery.ts +71 -0
- package/raystack/optimus/core/v1beta1/secret.client.ts +92 -0
- package/raystack/optimus/core/v1beta1/secret.ts +619 -0
- package/raystack/optimus/core/v1beta1/secret_connect.ts +61 -0
- package/raystack/optimus/core/v1beta1/secret_pb.ts +393 -0
- package/raystack/optimus/core/v1beta1/status.ts +113 -0
- package/raystack/optimus/core/v1beta1/status_pb.ts +101 -0
- package/raystack/optimus/integration/v1beta1/event.ts +531 -0
- package/raystack/optimus/integration/v1beta1/event_pb.ts +362 -0
- package/raystack/optimus/plugins/v1beta1/dependency_resolver-DependencyResolverModService_connectquery.ts +72 -0
- package/raystack/optimus/plugins/v1beta1/dependency_resolver.client.ts +100 -0
- package/raystack/optimus/plugins/v1beta1/dependency_resolver.ts +950 -0
- package/raystack/optimus/plugins/v1beta1/dependency_resolver_connect.ts +65 -0
- package/raystack/optimus/plugins/v1beta1/dependency_resolver_pb.ts +604 -0
- package/raystack/predator/index.ts +2 -0
- package/raystack/predator/v1beta1/metrics_log.ts +457 -0
- package/raystack/predator/v1beta1/metrics_log_pb.ts +277 -0
- package/raystack/predator/v1beta1/result_log.ts +390 -0
- package/raystack/predator/v1beta1/result_log_pb.ts +235 -0
- package/raystack/raccoon/index.ts +3 -0
- package/raystack/raccoon/v1beta1/raccoon-EventService_connectquery.ts +21 -0
- package/raystack/raccoon/v1beta1/raccoon.client.ts +37 -0
- package/raystack/raccoon/v1beta1/raccoon.ts +442 -0
- package/raystack/raccoon/v1beta1/raccoon_connect.ts +26 -0
- package/raystack/raccoon/v1beta1/raccoon_pb.ts +324 -0
- package/raystack/siren/index.ts +3 -0
- package/raystack/siren/v1beta1/siren-SirenService_connectquery.ts +497 -0
- package/raystack/siren/v1beta1/siren.client.ts +479 -0
- package/raystack/siren/v1beta1/siren.ts +6507 -0
- package/raystack/siren/v1beta1/siren_connect.ts +332 -0
- package/raystack/siren/v1beta1/siren_pb.ts +3853 -0
- package/raystack/stencil/index.ts +3 -0
- package/raystack/stencil/v1beta1/stencil-StencilService_connectquery.ts +231 -0
- package/raystack/stencil/v1beta1/stencil.client.ts +232 -0
- package/raystack/stencil/v1beta1/stencil.ts +2716 -0
- package/raystack/stencil/v1beta1/stencil_connect.ts +161 -0
- package/raystack/stencil/v1beta1/stencil_pb.ts +1729 -0
- package/validate/validate.ts +4130 -0
- package/validate/validate_pb.ts +2621 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// @generated by protobuf-ts 2.11.1
|
|
2
|
+
// @generated from protobuf file "google/protobuf/duration.proto" (package "google.protobuf", syntax proto3)
|
|
3
|
+
// tslint:disable
|
|
4
|
+
//
|
|
5
|
+
// Protocol Buffers - Google's data interchange format
|
|
6
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
|
7
|
+
// https://developers.google.com/protocol-buffers/
|
|
8
|
+
//
|
|
9
|
+
// Redistribution and use in source and binary forms, with or without
|
|
10
|
+
// modification, are permitted provided that the following conditions are
|
|
11
|
+
// met:
|
|
12
|
+
//
|
|
13
|
+
// * Redistributions of source code must retain the above copyright
|
|
14
|
+
// notice, this list of conditions and the following disclaimer.
|
|
15
|
+
// * Redistributions in binary form must reproduce the above
|
|
16
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
17
|
+
// in the documentation and/or other materials provided with the
|
|
18
|
+
// distribution.
|
|
19
|
+
// * Neither the name of Google Inc. nor the names of its
|
|
20
|
+
// contributors may be used to endorse or promote products derived from
|
|
21
|
+
// this software without specific prior written permission.
|
|
22
|
+
//
|
|
23
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
//
|
|
35
|
+
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
|
36
|
+
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
|
37
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
38
|
+
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
|
39
|
+
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
|
40
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
41
|
+
import type { PartialMessage } from "@protobuf-ts/runtime";
|
|
42
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
43
|
+
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
44
|
+
import type { JsonValue } from "@protobuf-ts/runtime";
|
|
45
|
+
import type { JsonReadOptions } from "@protobuf-ts/runtime";
|
|
46
|
+
import type { JsonWriteOptions } from "@protobuf-ts/runtime";
|
|
47
|
+
import { PbLong } from "@protobuf-ts/runtime";
|
|
48
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
49
|
+
/**
|
|
50
|
+
* A Duration represents a signed, fixed-length span of time represented
|
|
51
|
+
* as a count of seconds and fractions of seconds at nanosecond
|
|
52
|
+
* resolution. It is independent of any calendar and concepts like "day"
|
|
53
|
+
* or "month". It is related to Timestamp in that the difference between
|
|
54
|
+
* two Timestamp values is a Duration and it can be added or subtracted
|
|
55
|
+
* from a Timestamp. Range is approximately +-10,000 years.
|
|
56
|
+
*
|
|
57
|
+
* # Examples
|
|
58
|
+
*
|
|
59
|
+
* Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
60
|
+
*
|
|
61
|
+
* Timestamp start = ...;
|
|
62
|
+
* Timestamp end = ...;
|
|
63
|
+
* Duration duration = ...;
|
|
64
|
+
*
|
|
65
|
+
* duration.seconds = end.seconds - start.seconds;
|
|
66
|
+
* duration.nanos = end.nanos - start.nanos;
|
|
67
|
+
*
|
|
68
|
+
* if (duration.seconds < 0 && duration.nanos > 0) {
|
|
69
|
+
* duration.seconds += 1;
|
|
70
|
+
* duration.nanos -= 1000000000;
|
|
71
|
+
* } else if (duration.seconds > 0 && duration.nanos < 0) {
|
|
72
|
+
* duration.seconds -= 1;
|
|
73
|
+
* duration.nanos += 1000000000;
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
77
|
+
*
|
|
78
|
+
* Timestamp start = ...;
|
|
79
|
+
* Duration duration = ...;
|
|
80
|
+
* Timestamp end = ...;
|
|
81
|
+
*
|
|
82
|
+
* end.seconds = start.seconds + duration.seconds;
|
|
83
|
+
* end.nanos = start.nanos + duration.nanos;
|
|
84
|
+
*
|
|
85
|
+
* if (end.nanos < 0) {
|
|
86
|
+
* end.seconds -= 1;
|
|
87
|
+
* end.nanos += 1000000000;
|
|
88
|
+
* } else if (end.nanos >= 1000000000) {
|
|
89
|
+
* end.seconds += 1;
|
|
90
|
+
* end.nanos -= 1000000000;
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* Example 3: Compute Duration from datetime.timedelta in Python.
|
|
94
|
+
*
|
|
95
|
+
* td = datetime.timedelta(days=3, minutes=10)
|
|
96
|
+
* duration = Duration()
|
|
97
|
+
* duration.FromTimedelta(td)
|
|
98
|
+
*
|
|
99
|
+
* # JSON Mapping
|
|
100
|
+
*
|
|
101
|
+
* In JSON format, the Duration type is encoded as a string rather than an
|
|
102
|
+
* object, where the string ends in the suffix "s" (indicating seconds) and
|
|
103
|
+
* is preceded by the number of seconds, with nanoseconds expressed as
|
|
104
|
+
* fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
|
105
|
+
* encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
|
106
|
+
* be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
|
107
|
+
* microsecond should be expressed in JSON format as "3.000001s".
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
*
|
|
111
|
+
* @generated from protobuf message google.protobuf.Duration
|
|
112
|
+
*/
|
|
113
|
+
export interface Duration {
|
|
114
|
+
/**
|
|
115
|
+
* Signed seconds of the span of time. Must be from -315,576,000,000
|
|
116
|
+
* to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
|
117
|
+
* 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
|
118
|
+
*
|
|
119
|
+
* @generated from protobuf field: int64 seconds = 1
|
|
120
|
+
*/
|
|
121
|
+
seconds: bigint;
|
|
122
|
+
/**
|
|
123
|
+
* Signed fractions of a second at nanosecond resolution of the span
|
|
124
|
+
* of time. Durations less than one second are represented with a 0
|
|
125
|
+
* `seconds` field and a positive or negative `nanos` field. For durations
|
|
126
|
+
* of one second or more, a non-zero value for the `nanos` field must be
|
|
127
|
+
* of the same sign as the `seconds` field. Must be from -999,999,999
|
|
128
|
+
* to +999,999,999 inclusive.
|
|
129
|
+
*
|
|
130
|
+
* @generated from protobuf field: int32 nanos = 2
|
|
131
|
+
*/
|
|
132
|
+
nanos: number;
|
|
133
|
+
}
|
|
134
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
135
|
+
class Duration$Type extends MessageType<Duration> {
|
|
136
|
+
constructor() {
|
|
137
|
+
super("google.protobuf.Duration", [
|
|
138
|
+
{ no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
139
|
+
{ no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Encode `Duration` to JSON string like "3.000001s".
|
|
144
|
+
*/
|
|
145
|
+
internalJsonWrite(message: Duration, options: JsonWriteOptions): JsonValue {
|
|
146
|
+
let s = PbLong.from(message.seconds).toNumber();
|
|
147
|
+
if (s > 315576000000 || s < -315576000000)
|
|
148
|
+
throw new Error("Duration value out of range.");
|
|
149
|
+
let text = message.seconds.toString();
|
|
150
|
+
if (s === 0 && message.nanos < 0)
|
|
151
|
+
text = "-" + text;
|
|
152
|
+
if (message.nanos !== 0) {
|
|
153
|
+
let nanosStr = Math.abs(message.nanos).toString();
|
|
154
|
+
nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
|
|
155
|
+
if (nanosStr.substring(3) === "000000")
|
|
156
|
+
nanosStr = nanosStr.substring(0, 3);
|
|
157
|
+
else if (nanosStr.substring(6) === "000")
|
|
158
|
+
nanosStr = nanosStr.substring(0, 6);
|
|
159
|
+
text += "." + nanosStr;
|
|
160
|
+
}
|
|
161
|
+
return text + "s";
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Decode `Duration` from JSON string like "3.000001s"
|
|
165
|
+
*/
|
|
166
|
+
internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Duration): Duration {
|
|
167
|
+
if (typeof json !== "string")
|
|
168
|
+
throw new Error("Unable to parse Duration from JSON " + typeofJsonValue(json) + ". Expected string.");
|
|
169
|
+
let match = json.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
|
|
170
|
+
if (match === null)
|
|
171
|
+
throw new Error("Unable to parse Duration from JSON string. Invalid format.");
|
|
172
|
+
if (!target)
|
|
173
|
+
target = this.create();
|
|
174
|
+
let [, sign, secs, nanos] = match;
|
|
175
|
+
let longSeconds = PbLong.from(sign + secs);
|
|
176
|
+
if (longSeconds.toNumber() > 315576000000 || longSeconds.toNumber() < -315576000000)
|
|
177
|
+
throw new Error("Unable to parse Duration from JSON string. Value out of range.");
|
|
178
|
+
target.seconds = longSeconds.toBigInt();
|
|
179
|
+
if (typeof nanos == "string") {
|
|
180
|
+
let nanosStr = sign + nanos + "0".repeat(9 - nanos.length);
|
|
181
|
+
target.nanos = parseInt(nanosStr);
|
|
182
|
+
}
|
|
183
|
+
return target;
|
|
184
|
+
}
|
|
185
|
+
create(value?: PartialMessage<Duration>): Duration {
|
|
186
|
+
const message = globalThis.Object.create((this.messagePrototype!));
|
|
187
|
+
message.seconds = 0n;
|
|
188
|
+
message.nanos = 0;
|
|
189
|
+
if (value !== undefined)
|
|
190
|
+
reflectionMergePartial<Duration>(this, message, value);
|
|
191
|
+
return message;
|
|
192
|
+
}
|
|
193
|
+
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Duration): Duration {
|
|
194
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
195
|
+
while (reader.pos < end) {
|
|
196
|
+
let [fieldNo, wireType] = reader.tag();
|
|
197
|
+
switch (fieldNo) {
|
|
198
|
+
case /* int64 seconds */ 1:
|
|
199
|
+
message.seconds = reader.int64().toBigInt();
|
|
200
|
+
break;
|
|
201
|
+
case /* int32 nanos */ 2:
|
|
202
|
+
message.nanos = reader.int32();
|
|
203
|
+
break;
|
|
204
|
+
default:
|
|
205
|
+
let u = options.readUnknownField;
|
|
206
|
+
if (u === "throw")
|
|
207
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
208
|
+
let d = reader.skip(wireType);
|
|
209
|
+
if (u !== false)
|
|
210
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return message;
|
|
214
|
+
}
|
|
215
|
+
internalBinaryWrite(message: Duration, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
|
216
|
+
/* int64 seconds = 1; */
|
|
217
|
+
if (message.seconds !== 0n)
|
|
218
|
+
writer.tag(1, WireType.Varint).int64(message.seconds);
|
|
219
|
+
/* int32 nanos = 2; */
|
|
220
|
+
if (message.nanos !== 0)
|
|
221
|
+
writer.tag(2, WireType.Varint).int32(message.nanos);
|
|
222
|
+
let u = options.writeUnknownFields;
|
|
223
|
+
if (u !== false)
|
|
224
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
225
|
+
return writer;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @generated MessageType for protobuf message google.protobuf.Duration
|
|
230
|
+
*/
|
|
231
|
+
export const Duration = new Duration$Type();
|