@otonoma/paranet-client 2.11.0-rc.18

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.
Files changed (75) hide show
  1. package/README.md +2 -0
  2. package/dist/client.d.ts +168 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +497 -0
  5. package/dist/graphql.d.ts +8 -0
  6. package/dist/graphql.d.ts.map +1 -0
  7. package/dist/graphql.js +113 -0
  8. package/dist/index.d.ts +12 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +11 -0
  11. package/dist/pncp.d.ts +129 -0
  12. package/dist/pncp.d.ts.map +1 -0
  13. package/dist/pncp.js +100 -0
  14. package/dist/proto/broker.grpc.client.d.ts +154 -0
  15. package/dist/proto/broker.grpc.client.d.ts.map +1 -0
  16. package/dist/proto/broker.grpc.client.js +102 -0
  17. package/dist/proto/broker.grpc.d.ts +6 -0
  18. package/dist/proto/broker.grpc.d.ts.map +1 -0
  19. package/dist/proto/broker.grpc.js +32 -0
  20. package/dist/proto/broker_api.d.ts +324 -0
  21. package/dist/proto/broker_api.d.ts.map +1 -0
  22. package/dist/proto/broker_api.js +566 -0
  23. package/dist/proto/google/protobuf/descriptor.d.ts +2492 -0
  24. package/dist/proto/google/protobuf/descriptor.d.ts.map +1 -0
  25. package/dist/proto/google/protobuf/descriptor.js +3250 -0
  26. package/dist/proto/google/protobuf/timestamp.d.ts +157 -0
  27. package/dist/proto/google/protobuf/timestamp.d.ts.map +1 -0
  28. package/dist/proto/google/protobuf/timestamp.js +132 -0
  29. package/dist/proto/grpc/health/v1/health.client.d.ts +79 -0
  30. package/dist/proto/grpc/health/v1/health.client.d.ts.map +1 -0
  31. package/dist/proto/grpc/health/v1/health.client.js +46 -0
  32. package/dist/proto/grpc/health/v1/health.d.ts +74 -0
  33. package/dist/proto/grpc/health/v1/health.d.ts.map +1 -0
  34. package/dist/proto/grpc/health/v1/health.js +152 -0
  35. package/dist/proto/identifiers.d.ts +82 -0
  36. package/dist/proto/identifiers.d.ts.map +1 -0
  37. package/dist/proto/identifiers.js +132 -0
  38. package/dist/proto/mediums.d.ts +71 -0
  39. package/dist/proto/mediums.d.ts.map +1 -0
  40. package/dist/proto/mediums.js +120 -0
  41. package/dist/proto/observation.d.ts +287 -0
  42. package/dist/proto/observation.d.ts.map +1 -0
  43. package/dist/proto/observation.js +443 -0
  44. package/dist/proto/otonoma/common/value.d.ts +127 -0
  45. package/dist/proto/otonoma/common/value.d.ts.map +1 -0
  46. package/dist/proto/otonoma/common/value.js +248 -0
  47. package/dist/proto/pncp.d.ts +607 -0
  48. package/dist/proto/pncp.d.ts.map +1 -0
  49. package/dist/proto/pncp.js +936 -0
  50. package/dist/schema/paranet.d.ts +245 -0
  51. package/dist/schema/paranet.d.ts.map +1 -0
  52. package/dist/schema/paranet.js +7 -0
  53. package/dist/util.d.ts +5 -0
  54. package/dist/util.d.ts.map +1 -0
  55. package/dist/util.js +120 -0
  56. package/package.json +39 -0
  57. package/src/client.ts +677 -0
  58. package/src/graphql.ts +103 -0
  59. package/src/index.ts +14 -0
  60. package/src/pncp.ts +236 -0
  61. package/src/proto/broker.grpc.client.ts +193 -0
  62. package/src/proto/broker.grpc.ts +32 -0
  63. package/src/proto/broker_api.ts +778 -0
  64. package/src/proto/google/protobuf/descriptor.ts +4860 -0
  65. package/src/proto/google/protobuf/timestamp.ts +288 -0
  66. package/src/proto/grpc/health/v1/health.client.ts +106 -0
  67. package/src/proto/grpc/health/v1/health.ts +174 -0
  68. package/src/proto/identifiers.ts +176 -0
  69. package/src/proto/mediums.ts +168 -0
  70. package/src/proto/observation.ts +636 -0
  71. package/src/proto/otonoma/common/value.ts +334 -0
  72. package/src/proto/pncp.ts +1333 -0
  73. package/src/schema/paranet.ts +257 -0
  74. package/src/util.ts +129 -0
  75. package/tsconfig.json +27 -0
@@ -0,0 +1,288 @@
1
+ // @generated by protobuf-ts 2.9.4
2
+ // @generated from protobuf file "google/protobuf/timestamp.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 Timestamp represents a point in time independent of any time zone or local
51
+ * calendar, encoded as a count of seconds and fractions of seconds at
52
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
53
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
54
+ * Gregorian calendar backwards to year one.
55
+ *
56
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
57
+ * second table is needed for interpretation, using a [24-hour linear
58
+ * smear](https://developers.google.com/time/smear).
59
+ *
60
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
61
+ * restricting to that range, we ensure that we can convert to and from [RFC
62
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
63
+ *
64
+ * # Examples
65
+ *
66
+ * Example 1: Compute Timestamp from POSIX `time()`.
67
+ *
68
+ * Timestamp timestamp;
69
+ * timestamp.set_seconds(time(NULL));
70
+ * timestamp.set_nanos(0);
71
+ *
72
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
73
+ *
74
+ * struct timeval tv;
75
+ * gettimeofday(&tv, NULL);
76
+ *
77
+ * Timestamp timestamp;
78
+ * timestamp.set_seconds(tv.tv_sec);
79
+ * timestamp.set_nanos(tv.tv_usec * 1000);
80
+ *
81
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
82
+ *
83
+ * FILETIME ft;
84
+ * GetSystemTimeAsFileTime(&ft);
85
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
86
+ *
87
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
88
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
89
+ * Timestamp timestamp;
90
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
91
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
92
+ *
93
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
94
+ *
95
+ * long millis = System.currentTimeMillis();
96
+ *
97
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
98
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
99
+ *
100
+ * Example 5: Compute Timestamp from Java `Instant.now()`.
101
+ *
102
+ * Instant now = Instant.now();
103
+ *
104
+ * Timestamp timestamp =
105
+ * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
106
+ * .setNanos(now.getNano()).build();
107
+ *
108
+ * Example 6: Compute Timestamp from current time in Python.
109
+ *
110
+ * timestamp = Timestamp()
111
+ * timestamp.GetCurrentTime()
112
+ *
113
+ * # JSON Mapping
114
+ *
115
+ * In JSON format, the Timestamp type is encoded as a string in the
116
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
117
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
118
+ * where {year} is always expressed using four digits while {month}, {day},
119
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
120
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
121
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
122
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
123
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
124
+ * able to accept both UTC and other timezones (as indicated by an offset).
125
+ *
126
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
127
+ * 01:30 UTC on January 15, 2017.
128
+ *
129
+ * In JavaScript, one can convert a Date object to this format using the
130
+ * standard
131
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
132
+ * method. In Python, a standard `datetime.datetime` object can be converted
133
+ * to this format using
134
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
135
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
136
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
137
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
138
+ * ) to obtain a formatter capable of generating timestamps in this format.
139
+ *
140
+ *
141
+ * @generated from protobuf message google.protobuf.Timestamp
142
+ */
143
+ export interface Timestamp {
144
+ /**
145
+ * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
146
+ * be between -315576000000 and 315576000000 inclusive (which corresponds to
147
+ * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
148
+ *
149
+ * @generated from protobuf field: int64 seconds = 1;
150
+ */
151
+ seconds: bigint;
152
+ /**
153
+ * Non-negative fractions of a second at nanosecond resolution. This field is
154
+ * the nanosecond portion of the duration, not an alternative to seconds.
155
+ * Negative second values with fractions must still have non-negative nanos
156
+ * values that count forward in time. Must be between 0 and 999,999,999
157
+ * inclusive.
158
+ *
159
+ * @generated from protobuf field: int32 nanos = 2;
160
+ */
161
+ nanos: number;
162
+ }
163
+ // @generated message type with reflection information, may provide speed optimized methods
164
+ class Timestamp$Type extends MessageType<Timestamp> {
165
+ constructor() {
166
+ super("google.protobuf.Timestamp", [
167
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
168
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
169
+ ]);
170
+ }
171
+ /**
172
+ * Creates a new `Timestamp` for the current time.
173
+ */
174
+ now(): Timestamp {
175
+ const msg = this.create();
176
+ const ms = Date.now();
177
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
178
+ msg.nanos = (ms % 1000) * 1000000;
179
+ return msg;
180
+ }
181
+ /**
182
+ * Converts a `Timestamp` to a JavaScript Date.
183
+ */
184
+ toDate(message: Timestamp): Date {
185
+ return new Date(PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
186
+ }
187
+ /**
188
+ * Converts a JavaScript Date to a `Timestamp`.
189
+ */
190
+ fromDate(date: Date): Timestamp {
191
+ const msg = this.create();
192
+ const ms = date.getTime();
193
+ msg.seconds = PbLong.from(Math.floor(ms / 1000)).toBigInt();
194
+ msg.nanos = (ms % 1000) * 1000000;
195
+ return msg;
196
+ }
197
+ /**
198
+ * In JSON format, the `Timestamp` type is encoded as a string
199
+ * in the RFC 3339 format.
200
+ */
201
+ internalJsonWrite(message: Timestamp, options: JsonWriteOptions): JsonValue {
202
+ let ms = PbLong.from(message.seconds).toNumber() * 1000;
203
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
204
+ throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
205
+ if (message.nanos < 0)
206
+ throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
207
+ let z = "Z";
208
+ if (message.nanos > 0) {
209
+ let nanosStr = (message.nanos + 1000000000).toString().substring(1);
210
+ if (nanosStr.substring(3) === "000000")
211
+ z = "." + nanosStr.substring(0, 3) + "Z";
212
+ else if (nanosStr.substring(6) === "000")
213
+ z = "." + nanosStr.substring(0, 6) + "Z";
214
+ else
215
+ z = "." + nanosStr + "Z";
216
+ }
217
+ return new Date(ms).toISOString().replace(".000Z", z);
218
+ }
219
+ /**
220
+ * In JSON format, the `Timestamp` type is encoded as a string
221
+ * in the RFC 3339 format.
222
+ */
223
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Timestamp): Timestamp {
224
+ if (typeof json !== "string")
225
+ throw new Error("Unable to parse Timestamp from JSON " + typeofJsonValue(json) + ".");
226
+ let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
227
+ if (!matches)
228
+ throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
229
+ let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
230
+ if (Number.isNaN(ms))
231
+ throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
232
+ if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
233
+ throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
234
+ if (!target)
235
+ target = this.create();
236
+ target.seconds = PbLong.from(ms / 1000).toBigInt();
237
+ target.nanos = 0;
238
+ if (matches[7])
239
+ target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
240
+ return target;
241
+ }
242
+ create(value?: PartialMessage<Timestamp>): Timestamp {
243
+ const message = globalThis.Object.create((this.messagePrototype!));
244
+ message.seconds = 0n;
245
+ message.nanos = 0;
246
+ if (value !== undefined)
247
+ reflectionMergePartial<Timestamp>(this, message, value);
248
+ return message;
249
+ }
250
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Timestamp): Timestamp {
251
+ let message = target ?? this.create(), end = reader.pos + length;
252
+ while (reader.pos < end) {
253
+ let [fieldNo, wireType] = reader.tag();
254
+ switch (fieldNo) {
255
+ case /* int64 seconds */ 1:
256
+ message.seconds = reader.int64().toBigInt();
257
+ break;
258
+ case /* int32 nanos */ 2:
259
+ message.nanos = reader.int32();
260
+ break;
261
+ default:
262
+ let u = options.readUnknownField;
263
+ if (u === "throw")
264
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
265
+ let d = reader.skip(wireType);
266
+ if (u !== false)
267
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
268
+ }
269
+ }
270
+ return message;
271
+ }
272
+ internalBinaryWrite(message: Timestamp, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
273
+ /* int64 seconds = 1; */
274
+ if (message.seconds !== 0n)
275
+ writer.tag(1, WireType.Varint).int64(message.seconds);
276
+ /* int32 nanos = 2; */
277
+ if (message.nanos !== 0)
278
+ writer.tag(2, WireType.Varint).int32(message.nanos);
279
+ let u = options.writeUnknownFields;
280
+ if (u !== false)
281
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
282
+ return writer;
283
+ }
284
+ }
285
+ /**
286
+ * @generated MessageType for protobuf message google.protobuf.Timestamp
287
+ */
288
+ export const Timestamp = new Timestamp$Type();
@@ -0,0 +1,106 @@
1
+ // @generated by protobuf-ts 2.9.4
2
+ // @generated from protobuf file "grpc/health/v1/health.proto" (package "grpc.health.v1", syntax proto3)
3
+ // tslint:disable
4
+ //
5
+ // Copyright 2015 The gRPC Authors
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //
20
+ // The canonical version of this proto can be found at
21
+ // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
22
+ //
23
+ import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
24
+ import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
25
+ import { Health } from "./health";
26
+ import type { ServerStreamingCall } from "@protobuf-ts/runtime-rpc";
27
+ import { stackIntercept } from "@protobuf-ts/runtime-rpc";
28
+ import type { HealthCheckResponse } from "./health";
29
+ import type { HealthCheckRequest } from "./health";
30
+ import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
31
+ import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
32
+ /**
33
+ * @generated from protobuf service grpc.health.v1.Health
34
+ */
35
+ export interface IHealthClient {
36
+ /**
37
+ * If the requested service is unknown, the call will fail with status
38
+ * NOT_FOUND.
39
+ *
40
+ * @generated from protobuf rpc: Check(grpc.health.v1.HealthCheckRequest) returns (grpc.health.v1.HealthCheckResponse);
41
+ */
42
+ check(input: HealthCheckRequest, options?: RpcOptions): UnaryCall<HealthCheckRequest, HealthCheckResponse>;
43
+ /**
44
+ * Performs a watch for the serving status of the requested service.
45
+ * The server will immediately send back a message indicating the current
46
+ * serving status. It will then subsequently send a new message whenever
47
+ * the service's serving status changes.
48
+ *
49
+ * If the requested service is unknown when the call is received, the
50
+ * server will send a message setting the serving status to
51
+ * SERVICE_UNKNOWN but will *not* terminate the call. If at some
52
+ * future point, the serving status of the service becomes known, the
53
+ * server will send a new message with the service's serving status.
54
+ *
55
+ * If the call terminates with status UNIMPLEMENTED, then clients
56
+ * should assume this method is not supported and should not retry the
57
+ * call. If the call terminates with any other status (including OK),
58
+ * clients should retry the call with appropriate exponential backoff.
59
+ *
60
+ * @generated from protobuf rpc: Watch(grpc.health.v1.HealthCheckRequest) returns (stream grpc.health.v1.HealthCheckResponse);
61
+ */
62
+ watch(input: HealthCheckRequest, options?: RpcOptions): ServerStreamingCall<HealthCheckRequest, HealthCheckResponse>;
63
+ }
64
+ /**
65
+ * @generated from protobuf service grpc.health.v1.Health
66
+ */
67
+ export class HealthClient implements IHealthClient, ServiceInfo {
68
+ typeName = Health.typeName;
69
+ methods = Health.methods;
70
+ options = Health.options;
71
+ constructor(private readonly _transport: RpcTransport) {
72
+ }
73
+ /**
74
+ * If the requested service is unknown, the call will fail with status
75
+ * NOT_FOUND.
76
+ *
77
+ * @generated from protobuf rpc: Check(grpc.health.v1.HealthCheckRequest) returns (grpc.health.v1.HealthCheckResponse);
78
+ */
79
+ check(input: HealthCheckRequest, options?: RpcOptions): UnaryCall<HealthCheckRequest, HealthCheckResponse> {
80
+ const method = this.methods[0], opt = this._transport.mergeOptions(options);
81
+ return stackIntercept<HealthCheckRequest, HealthCheckResponse>("unary", this._transport, method, opt, input);
82
+ }
83
+ /**
84
+ * Performs a watch for the serving status of the requested service.
85
+ * The server will immediately send back a message indicating the current
86
+ * serving status. It will then subsequently send a new message whenever
87
+ * the service's serving status changes.
88
+ *
89
+ * If the requested service is unknown when the call is received, the
90
+ * server will send a message setting the serving status to
91
+ * SERVICE_UNKNOWN but will *not* terminate the call. If at some
92
+ * future point, the serving status of the service becomes known, the
93
+ * server will send a new message with the service's serving status.
94
+ *
95
+ * If the call terminates with status UNIMPLEMENTED, then clients
96
+ * should assume this method is not supported and should not retry the
97
+ * call. If the call terminates with any other status (including OK),
98
+ * clients should retry the call with appropriate exponential backoff.
99
+ *
100
+ * @generated from protobuf rpc: Watch(grpc.health.v1.HealthCheckRequest) returns (stream grpc.health.v1.HealthCheckResponse);
101
+ */
102
+ watch(input: HealthCheckRequest, options?: RpcOptions): ServerStreamingCall<HealthCheckRequest, HealthCheckResponse> {
103
+ const method = this.methods[1], opt = this._transport.mergeOptions(options);
104
+ return stackIntercept<HealthCheckRequest, HealthCheckResponse>("serverStreaming", this._transport, method, opt, input);
105
+ }
106
+ }
@@ -0,0 +1,174 @@
1
+ // @generated by protobuf-ts 2.9.4
2
+ // @generated from protobuf file "grpc/health/v1/health.proto" (package "grpc.health.v1", syntax proto3)
3
+ // tslint:disable
4
+ //
5
+ // Copyright 2015 The gRPC Authors
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ //
20
+ // The canonical version of this proto can be found at
21
+ // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
22
+ //
23
+ import { ServiceType } from "@protobuf-ts/runtime-rpc";
24
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
25
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
26
+ import { WireType } from "@protobuf-ts/runtime";
27
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
28
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
29
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
30
+ import type { PartialMessage } from "@protobuf-ts/runtime";
31
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
32
+ import { MessageType } from "@protobuf-ts/runtime";
33
+ /**
34
+ * @generated from protobuf message grpc.health.v1.HealthCheckRequest
35
+ */
36
+ export interface HealthCheckRequest {
37
+ /**
38
+ * @generated from protobuf field: string service = 1;
39
+ */
40
+ service: string;
41
+ }
42
+ /**
43
+ * @generated from protobuf message grpc.health.v1.HealthCheckResponse
44
+ */
45
+ export interface HealthCheckResponse {
46
+ /**
47
+ * @generated from protobuf field: grpc.health.v1.HealthCheckResponse.ServingStatus status = 1;
48
+ */
49
+ status: HealthCheckResponse_ServingStatus;
50
+ }
51
+ /**
52
+ * @generated from protobuf enum grpc.health.v1.HealthCheckResponse.ServingStatus
53
+ */
54
+ export enum HealthCheckResponse_ServingStatus {
55
+ /**
56
+ * @generated from protobuf enum value: UNKNOWN = 0;
57
+ */
58
+ UNKNOWN = 0,
59
+ /**
60
+ * @generated from protobuf enum value: SERVING = 1;
61
+ */
62
+ SERVING = 1,
63
+ /**
64
+ * @generated from protobuf enum value: NOT_SERVING = 2;
65
+ */
66
+ NOT_SERVING = 2,
67
+ /**
68
+ * Used only by the Watch method.
69
+ *
70
+ * @generated from protobuf enum value: SERVICE_UNKNOWN = 3;
71
+ */
72
+ SERVICE_UNKNOWN = 3
73
+ }
74
+ // @generated message type with reflection information, may provide speed optimized methods
75
+ class HealthCheckRequest$Type extends MessageType<HealthCheckRequest> {
76
+ constructor() {
77
+ super("grpc.health.v1.HealthCheckRequest", [
78
+ { no: 1, name: "service", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
79
+ ]);
80
+ }
81
+ create(value?: PartialMessage<HealthCheckRequest>): HealthCheckRequest {
82
+ const message = globalThis.Object.create((this.messagePrototype!));
83
+ message.service = "";
84
+ if (value !== undefined)
85
+ reflectionMergePartial<HealthCheckRequest>(this, message, value);
86
+ return message;
87
+ }
88
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HealthCheckRequest): HealthCheckRequest {
89
+ let message = target ?? this.create(), end = reader.pos + length;
90
+ while (reader.pos < end) {
91
+ let [fieldNo, wireType] = reader.tag();
92
+ switch (fieldNo) {
93
+ case /* string service */ 1:
94
+ message.service = reader.string();
95
+ break;
96
+ default:
97
+ let u = options.readUnknownField;
98
+ if (u === "throw")
99
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
100
+ let d = reader.skip(wireType);
101
+ if (u !== false)
102
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
103
+ }
104
+ }
105
+ return message;
106
+ }
107
+ internalBinaryWrite(message: HealthCheckRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
108
+ /* string service = 1; */
109
+ if (message.service !== "")
110
+ writer.tag(1, WireType.LengthDelimited).string(message.service);
111
+ let u = options.writeUnknownFields;
112
+ if (u !== false)
113
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
114
+ return writer;
115
+ }
116
+ }
117
+ /**
118
+ * @generated MessageType for protobuf message grpc.health.v1.HealthCheckRequest
119
+ */
120
+ export const HealthCheckRequest = new HealthCheckRequest$Type();
121
+ // @generated message type with reflection information, may provide speed optimized methods
122
+ class HealthCheckResponse$Type extends MessageType<HealthCheckResponse> {
123
+ constructor() {
124
+ super("grpc.health.v1.HealthCheckResponse", [
125
+ { no: 1, name: "status", kind: "enum", T: () => ["grpc.health.v1.HealthCheckResponse.ServingStatus", HealthCheckResponse_ServingStatus] }
126
+ ]);
127
+ }
128
+ create(value?: PartialMessage<HealthCheckResponse>): HealthCheckResponse {
129
+ const message = globalThis.Object.create((this.messagePrototype!));
130
+ message.status = 0;
131
+ if (value !== undefined)
132
+ reflectionMergePartial<HealthCheckResponse>(this, message, value);
133
+ return message;
134
+ }
135
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: HealthCheckResponse): HealthCheckResponse {
136
+ let message = target ?? this.create(), end = reader.pos + length;
137
+ while (reader.pos < end) {
138
+ let [fieldNo, wireType] = reader.tag();
139
+ switch (fieldNo) {
140
+ case /* grpc.health.v1.HealthCheckResponse.ServingStatus status */ 1:
141
+ message.status = reader.int32();
142
+ break;
143
+ default:
144
+ let u = options.readUnknownField;
145
+ if (u === "throw")
146
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
147
+ let d = reader.skip(wireType);
148
+ if (u !== false)
149
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
150
+ }
151
+ }
152
+ return message;
153
+ }
154
+ internalBinaryWrite(message: HealthCheckResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
155
+ /* grpc.health.v1.HealthCheckResponse.ServingStatus status = 1; */
156
+ if (message.status !== 0)
157
+ writer.tag(1, WireType.Varint).int32(message.status);
158
+ let u = options.writeUnknownFields;
159
+ if (u !== false)
160
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
161
+ return writer;
162
+ }
163
+ }
164
+ /**
165
+ * @generated MessageType for protobuf message grpc.health.v1.HealthCheckResponse
166
+ */
167
+ export const HealthCheckResponse = new HealthCheckResponse$Type();
168
+ /**
169
+ * @generated ServiceType for protobuf service grpc.health.v1.Health
170
+ */
171
+ export const Health = new ServiceType("grpc.health.v1.Health", [
172
+ { name: "Check", options: {}, I: HealthCheckRequest, O: HealthCheckResponse },
173
+ { name: "Watch", serverStreaming: true, options: {}, I: HealthCheckRequest, O: HealthCheckResponse }
174
+ ]);