@miradorlabs/web-grpc 1.2.0 → 1.3.0
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/protobuf/timestamp.ts +1 -1
- package/package.json +1 -1
- package/proto/gateway/common/v1/status.ts +1 -1
- package/proto/gateway/common/v1/types.ts +1 -1
- package/proto/gateway/web/v1/account_gateway.ts +1 -1
- package/proto/gateway/web/v1/automation_gateway.ts +1 -1
- package/proto/gateway/web/v1/chain_gateway.ts +1 -1
- package/proto/gateway/web/v1/market_gateway.ts +1 -1
- package/proto/gateway/web/v1/oauth_gateway.ts +1 -1
- package/proto/gateway/web/v1/plan_gateway.ts +1 -1
- package/proto/gateway/web/v1/stream_gateway.ts +1 -1
- package/proto/gateway/web/v1/telemetry_gateway.ts +2257 -0
- package/proto/gateway/web/v1/telemetry_gateway_grpc_pb.js +148 -0
- package/proto/gateway/web/v1/telemetry_gateway_pb.js +3833 -0
- package/proto/gateway/web/v1/trace_gateway.ts +1 -1
|
@@ -0,0 +1,2257 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.10
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: proto/gateway/web/v1/telemetry_gateway.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import type { Metadata } from "@grpc/grpc-js";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
import { map } from "rxjs/operators";
|
|
12
|
+
import { Timestamp } from "../../../../google/protobuf/timestamp";
|
|
13
|
+
import { ResponseStatus } from "../../common/v1/status";
|
|
14
|
+
import {
|
|
15
|
+
AnalyticsTimeInterval,
|
|
16
|
+
analyticsTimeIntervalFromJSON,
|
|
17
|
+
analyticsTimeIntervalToJSON,
|
|
18
|
+
AnalyticsTimeWindow,
|
|
19
|
+
analyticsTimeWindowFromJSON,
|
|
20
|
+
analyticsTimeWindowToJSON,
|
|
21
|
+
} from "./trace_gateway";
|
|
22
|
+
|
|
23
|
+
export const protobufPackage = "gateway.web.v1";
|
|
24
|
+
|
|
25
|
+
export enum MetricKind {
|
|
26
|
+
METRIC_KIND_UNSPECIFIED = 0,
|
|
27
|
+
METRIC_KIND_GAUGE = 1,
|
|
28
|
+
METRIC_KIND_SUM = 2,
|
|
29
|
+
METRIC_KIND_HISTOGRAM = 3,
|
|
30
|
+
UNRECOGNIZED = -1,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function metricKindFromJSON(object: any): MetricKind {
|
|
34
|
+
switch (object) {
|
|
35
|
+
case 0:
|
|
36
|
+
case "METRIC_KIND_UNSPECIFIED":
|
|
37
|
+
return MetricKind.METRIC_KIND_UNSPECIFIED;
|
|
38
|
+
case 1:
|
|
39
|
+
case "METRIC_KIND_GAUGE":
|
|
40
|
+
return MetricKind.METRIC_KIND_GAUGE;
|
|
41
|
+
case 2:
|
|
42
|
+
case "METRIC_KIND_SUM":
|
|
43
|
+
return MetricKind.METRIC_KIND_SUM;
|
|
44
|
+
case 3:
|
|
45
|
+
case "METRIC_KIND_HISTOGRAM":
|
|
46
|
+
return MetricKind.METRIC_KIND_HISTOGRAM;
|
|
47
|
+
case -1:
|
|
48
|
+
case "UNRECOGNIZED":
|
|
49
|
+
default:
|
|
50
|
+
return MetricKind.UNRECOGNIZED;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function metricKindToJSON(object: MetricKind): string {
|
|
55
|
+
switch (object) {
|
|
56
|
+
case MetricKind.METRIC_KIND_UNSPECIFIED:
|
|
57
|
+
return "METRIC_KIND_UNSPECIFIED";
|
|
58
|
+
case MetricKind.METRIC_KIND_GAUGE:
|
|
59
|
+
return "METRIC_KIND_GAUGE";
|
|
60
|
+
case MetricKind.METRIC_KIND_SUM:
|
|
61
|
+
return "METRIC_KIND_SUM";
|
|
62
|
+
case MetricKind.METRIC_KIND_HISTOGRAM:
|
|
63
|
+
return "METRIC_KIND_HISTOGRAM";
|
|
64
|
+
case MetricKind.UNRECOGNIZED:
|
|
65
|
+
default:
|
|
66
|
+
return "UNRECOGNIZED";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export enum MetricAggregation {
|
|
71
|
+
METRIC_AGGREGATION_UNSPECIFIED = 0,
|
|
72
|
+
METRIC_AGGREGATION_SUM = 1,
|
|
73
|
+
METRIC_AGGREGATION_AVG = 2,
|
|
74
|
+
METRIC_AGGREGATION_MIN = 3,
|
|
75
|
+
METRIC_AGGREGATION_MAX = 4,
|
|
76
|
+
METRIC_AGGREGATION_COUNT = 5,
|
|
77
|
+
METRIC_AGGREGATION_LAST = 6,
|
|
78
|
+
METRIC_AGGREGATION_RATE = 7,
|
|
79
|
+
METRIC_AGGREGATION_P50 = 8,
|
|
80
|
+
METRIC_AGGREGATION_P90 = 9,
|
|
81
|
+
METRIC_AGGREGATION_P95 = 10,
|
|
82
|
+
METRIC_AGGREGATION_P99 = 11,
|
|
83
|
+
UNRECOGNIZED = -1,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function metricAggregationFromJSON(object: any): MetricAggregation {
|
|
87
|
+
switch (object) {
|
|
88
|
+
case 0:
|
|
89
|
+
case "METRIC_AGGREGATION_UNSPECIFIED":
|
|
90
|
+
return MetricAggregation.METRIC_AGGREGATION_UNSPECIFIED;
|
|
91
|
+
case 1:
|
|
92
|
+
case "METRIC_AGGREGATION_SUM":
|
|
93
|
+
return MetricAggregation.METRIC_AGGREGATION_SUM;
|
|
94
|
+
case 2:
|
|
95
|
+
case "METRIC_AGGREGATION_AVG":
|
|
96
|
+
return MetricAggregation.METRIC_AGGREGATION_AVG;
|
|
97
|
+
case 3:
|
|
98
|
+
case "METRIC_AGGREGATION_MIN":
|
|
99
|
+
return MetricAggregation.METRIC_AGGREGATION_MIN;
|
|
100
|
+
case 4:
|
|
101
|
+
case "METRIC_AGGREGATION_MAX":
|
|
102
|
+
return MetricAggregation.METRIC_AGGREGATION_MAX;
|
|
103
|
+
case 5:
|
|
104
|
+
case "METRIC_AGGREGATION_COUNT":
|
|
105
|
+
return MetricAggregation.METRIC_AGGREGATION_COUNT;
|
|
106
|
+
case 6:
|
|
107
|
+
case "METRIC_AGGREGATION_LAST":
|
|
108
|
+
return MetricAggregation.METRIC_AGGREGATION_LAST;
|
|
109
|
+
case 7:
|
|
110
|
+
case "METRIC_AGGREGATION_RATE":
|
|
111
|
+
return MetricAggregation.METRIC_AGGREGATION_RATE;
|
|
112
|
+
case 8:
|
|
113
|
+
case "METRIC_AGGREGATION_P50":
|
|
114
|
+
return MetricAggregation.METRIC_AGGREGATION_P50;
|
|
115
|
+
case 9:
|
|
116
|
+
case "METRIC_AGGREGATION_P90":
|
|
117
|
+
return MetricAggregation.METRIC_AGGREGATION_P90;
|
|
118
|
+
case 10:
|
|
119
|
+
case "METRIC_AGGREGATION_P95":
|
|
120
|
+
return MetricAggregation.METRIC_AGGREGATION_P95;
|
|
121
|
+
case 11:
|
|
122
|
+
case "METRIC_AGGREGATION_P99":
|
|
123
|
+
return MetricAggregation.METRIC_AGGREGATION_P99;
|
|
124
|
+
case -1:
|
|
125
|
+
case "UNRECOGNIZED":
|
|
126
|
+
default:
|
|
127
|
+
return MetricAggregation.UNRECOGNIZED;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function metricAggregationToJSON(object: MetricAggregation): string {
|
|
132
|
+
switch (object) {
|
|
133
|
+
case MetricAggregation.METRIC_AGGREGATION_UNSPECIFIED:
|
|
134
|
+
return "METRIC_AGGREGATION_UNSPECIFIED";
|
|
135
|
+
case MetricAggregation.METRIC_AGGREGATION_SUM:
|
|
136
|
+
return "METRIC_AGGREGATION_SUM";
|
|
137
|
+
case MetricAggregation.METRIC_AGGREGATION_AVG:
|
|
138
|
+
return "METRIC_AGGREGATION_AVG";
|
|
139
|
+
case MetricAggregation.METRIC_AGGREGATION_MIN:
|
|
140
|
+
return "METRIC_AGGREGATION_MIN";
|
|
141
|
+
case MetricAggregation.METRIC_AGGREGATION_MAX:
|
|
142
|
+
return "METRIC_AGGREGATION_MAX";
|
|
143
|
+
case MetricAggregation.METRIC_AGGREGATION_COUNT:
|
|
144
|
+
return "METRIC_AGGREGATION_COUNT";
|
|
145
|
+
case MetricAggregation.METRIC_AGGREGATION_LAST:
|
|
146
|
+
return "METRIC_AGGREGATION_LAST";
|
|
147
|
+
case MetricAggregation.METRIC_AGGREGATION_RATE:
|
|
148
|
+
return "METRIC_AGGREGATION_RATE";
|
|
149
|
+
case MetricAggregation.METRIC_AGGREGATION_P50:
|
|
150
|
+
return "METRIC_AGGREGATION_P50";
|
|
151
|
+
case MetricAggregation.METRIC_AGGREGATION_P90:
|
|
152
|
+
return "METRIC_AGGREGATION_P90";
|
|
153
|
+
case MetricAggregation.METRIC_AGGREGATION_P95:
|
|
154
|
+
return "METRIC_AGGREGATION_P95";
|
|
155
|
+
case MetricAggregation.METRIC_AGGREGATION_P99:
|
|
156
|
+
return "METRIC_AGGREGATION_P99";
|
|
157
|
+
case MetricAggregation.UNRECOGNIZED:
|
|
158
|
+
default:
|
|
159
|
+
return "UNRECOGNIZED";
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface ListMetricsRequest {
|
|
164
|
+
projectId: string;
|
|
165
|
+
/** Stamped by the gateway from the verified identity — never client-supplied. */
|
|
166
|
+
organizationId: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ListMetricsResponse {
|
|
170
|
+
status: ResponseStatus | undefined;
|
|
171
|
+
metrics: MetricInfo[];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface MetricInfo {
|
|
175
|
+
name: string;
|
|
176
|
+
unit: string;
|
|
177
|
+
kind: MetricKind;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface ListMetricAttributesRequest {
|
|
181
|
+
projectId: string;
|
|
182
|
+
metricName: string;
|
|
183
|
+
/** Stamped by the gateway from the verified identity — never client-supplied. */
|
|
184
|
+
organizationId: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface ListMetricAttributesResponse {
|
|
188
|
+
status: ResponseStatus | undefined;
|
|
189
|
+
attributes: MetricAttribute[];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface MetricAttribute {
|
|
193
|
+
key: string;
|
|
194
|
+
values: string[];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface MetricQuery {
|
|
198
|
+
projectId: string;
|
|
199
|
+
metricName: string;
|
|
200
|
+
filter:
|
|
201
|
+
| MetricFilter
|
|
202
|
+
| undefined;
|
|
203
|
+
/** Group keys: "service.name" or datapoint attribute keys; at most 2. */
|
|
204
|
+
groupBy: string[];
|
|
205
|
+
aggregation: MetricAggregation;
|
|
206
|
+
/** Must satisfy: 10 <= (time_window / time_interval) <= 600 */
|
|
207
|
+
timeWindow: AnalyticsTimeWindow;
|
|
208
|
+
timeInterval: AnalyticsTimeInterval;
|
|
209
|
+
/** Stamped by the gateway from the verified identity — never client-supplied. */
|
|
210
|
+
organizationId: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface MetricFilter {
|
|
214
|
+
serviceNames: string[];
|
|
215
|
+
attributeEquals: { [key: string]: string };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface MetricFilter_AttributeEqualsEntry {
|
|
219
|
+
key: string;
|
|
220
|
+
value: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface QueryMetricsRequest {
|
|
224
|
+
query: MetricQuery | undefined;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface QueryMetricsResponse {
|
|
228
|
+
status: ResponseStatus | undefined;
|
|
229
|
+
snapshot: MetricAnalyticsSnapshot | undefined;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface StreamMetricAnalyticsRequest {
|
|
233
|
+
query: MetricQuery | undefined;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface MetricAnalyticsEnvelope {
|
|
237
|
+
snapshot?: MetricAnalyticsSnapshot | undefined;
|
|
238
|
+
bucketUpdate?: MetricSeriesBucketUpdate | undefined;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface MetricAnalyticsSnapshot {
|
|
242
|
+
series: MetricSeries[];
|
|
243
|
+
windowStart: Date | undefined;
|
|
244
|
+
windowEnd: Date | undefined;
|
|
245
|
+
bucketSizeMs: number;
|
|
246
|
+
expectedBucketCount: number;
|
|
247
|
+
unit: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface MetricSeries {
|
|
251
|
+
groupKey: { [key: string]: string };
|
|
252
|
+
buckets: MetricBucket[];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface MetricSeries_GroupKeyEntry {
|
|
256
|
+
key: string;
|
|
257
|
+
value: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface MetricBucket {
|
|
261
|
+
bucketStart: Date | undefined;
|
|
262
|
+
value: number;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface MetricSeriesBucketUpdate {
|
|
266
|
+
groupKey: { [key: string]: string };
|
|
267
|
+
bucket: MetricBucket | undefined;
|
|
268
|
+
generatedAt: Date | undefined;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
272
|
+
key: string;
|
|
273
|
+
value: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function createBaseListMetricsRequest(): ListMetricsRequest {
|
|
277
|
+
return { projectId: "", organizationId: "" };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export const ListMetricsRequest: MessageFns<ListMetricsRequest> = {
|
|
281
|
+
encode(message: ListMetricsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
282
|
+
if (message.projectId !== "") {
|
|
283
|
+
writer.uint32(10).string(message.projectId);
|
|
284
|
+
}
|
|
285
|
+
if (message.organizationId !== "") {
|
|
286
|
+
writer.uint32(18).string(message.organizationId);
|
|
287
|
+
}
|
|
288
|
+
return writer;
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMetricsRequest {
|
|
292
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
293
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
294
|
+
const message = createBaseListMetricsRequest();
|
|
295
|
+
while (reader.pos < end) {
|
|
296
|
+
const tag = reader.uint32();
|
|
297
|
+
switch (tag >>> 3) {
|
|
298
|
+
case 1: {
|
|
299
|
+
if (tag !== 10) {
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
message.projectId = reader.string();
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
case 2: {
|
|
307
|
+
if (tag !== 18) {
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
message.organizationId = reader.string();
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
reader.skip(tag & 7);
|
|
319
|
+
}
|
|
320
|
+
return message;
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
fromJSON(object: any): ListMetricsRequest {
|
|
324
|
+
return {
|
|
325
|
+
projectId: isSet(object.projectId)
|
|
326
|
+
? globalThis.String(object.projectId)
|
|
327
|
+
: isSet(object.project_id)
|
|
328
|
+
? globalThis.String(object.project_id)
|
|
329
|
+
: "",
|
|
330
|
+
organizationId: isSet(object.organizationId)
|
|
331
|
+
? globalThis.String(object.organizationId)
|
|
332
|
+
: isSet(object.organization_id)
|
|
333
|
+
? globalThis.String(object.organization_id)
|
|
334
|
+
: "",
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
toJSON(message: ListMetricsRequest): unknown {
|
|
339
|
+
const obj: any = {};
|
|
340
|
+
if (message.projectId !== "") {
|
|
341
|
+
obj.projectId = message.projectId;
|
|
342
|
+
}
|
|
343
|
+
if (message.organizationId !== "") {
|
|
344
|
+
obj.organizationId = message.organizationId;
|
|
345
|
+
}
|
|
346
|
+
return obj;
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
create<I extends Exact<DeepPartial<ListMetricsRequest>, I>>(base?: I): ListMetricsRequest {
|
|
350
|
+
return ListMetricsRequest.fromPartial(base ?? ({} as any));
|
|
351
|
+
},
|
|
352
|
+
fromPartial<I extends Exact<DeepPartial<ListMetricsRequest>, I>>(object: I): ListMetricsRequest {
|
|
353
|
+
const message = createBaseListMetricsRequest();
|
|
354
|
+
message.projectId = object.projectId ?? "";
|
|
355
|
+
message.organizationId = object.organizationId ?? "";
|
|
356
|
+
return message;
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
function createBaseListMetricsResponse(): ListMetricsResponse {
|
|
361
|
+
return { status: undefined, metrics: [] };
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export const ListMetricsResponse: MessageFns<ListMetricsResponse> = {
|
|
365
|
+
encode(message: ListMetricsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
366
|
+
if (message.status !== undefined) {
|
|
367
|
+
ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
|
|
368
|
+
}
|
|
369
|
+
for (const v of message.metrics) {
|
|
370
|
+
MetricInfo.encode(v!, writer.uint32(18).fork()).join();
|
|
371
|
+
}
|
|
372
|
+
return writer;
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMetricsResponse {
|
|
376
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
377
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
378
|
+
const message = createBaseListMetricsResponse();
|
|
379
|
+
while (reader.pos < end) {
|
|
380
|
+
const tag = reader.uint32();
|
|
381
|
+
switch (tag >>> 3) {
|
|
382
|
+
case 1: {
|
|
383
|
+
if (tag !== 10) {
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
message.status = ResponseStatus.decode(reader, reader.uint32());
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
case 2: {
|
|
391
|
+
if (tag !== 18) {
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
message.metrics.push(MetricInfo.decode(reader, reader.uint32()));
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
reader.skip(tag & 7);
|
|
403
|
+
}
|
|
404
|
+
return message;
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
fromJSON(object: any): ListMetricsResponse {
|
|
408
|
+
return {
|
|
409
|
+
status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
|
|
410
|
+
metrics: globalThis.Array.isArray(object?.metrics) ? object.metrics.map((e: any) => MetricInfo.fromJSON(e)) : [],
|
|
411
|
+
};
|
|
412
|
+
},
|
|
413
|
+
|
|
414
|
+
toJSON(message: ListMetricsResponse): unknown {
|
|
415
|
+
const obj: any = {};
|
|
416
|
+
if (message.status !== undefined) {
|
|
417
|
+
obj.status = ResponseStatus.toJSON(message.status);
|
|
418
|
+
}
|
|
419
|
+
if (message.metrics?.length) {
|
|
420
|
+
obj.metrics = message.metrics.map((e) => MetricInfo.toJSON(e));
|
|
421
|
+
}
|
|
422
|
+
return obj;
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
create<I extends Exact<DeepPartial<ListMetricsResponse>, I>>(base?: I): ListMetricsResponse {
|
|
426
|
+
return ListMetricsResponse.fromPartial(base ?? ({} as any));
|
|
427
|
+
},
|
|
428
|
+
fromPartial<I extends Exact<DeepPartial<ListMetricsResponse>, I>>(object: I): ListMetricsResponse {
|
|
429
|
+
const message = createBaseListMetricsResponse();
|
|
430
|
+
message.status = (object.status !== undefined && object.status !== null)
|
|
431
|
+
? ResponseStatus.fromPartial(object.status)
|
|
432
|
+
: undefined;
|
|
433
|
+
message.metrics = object.metrics?.map((e) => MetricInfo.fromPartial(e)) || [];
|
|
434
|
+
return message;
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
function createBaseMetricInfo(): MetricInfo {
|
|
439
|
+
return { name: "", unit: "", kind: 0 };
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export const MetricInfo: MessageFns<MetricInfo> = {
|
|
443
|
+
encode(message: MetricInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
444
|
+
if (message.name !== "") {
|
|
445
|
+
writer.uint32(10).string(message.name);
|
|
446
|
+
}
|
|
447
|
+
if (message.unit !== "") {
|
|
448
|
+
writer.uint32(18).string(message.unit);
|
|
449
|
+
}
|
|
450
|
+
if (message.kind !== 0) {
|
|
451
|
+
writer.uint32(24).int32(message.kind);
|
|
452
|
+
}
|
|
453
|
+
return writer;
|
|
454
|
+
},
|
|
455
|
+
|
|
456
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricInfo {
|
|
457
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
458
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
459
|
+
const message = createBaseMetricInfo();
|
|
460
|
+
while (reader.pos < end) {
|
|
461
|
+
const tag = reader.uint32();
|
|
462
|
+
switch (tag >>> 3) {
|
|
463
|
+
case 1: {
|
|
464
|
+
if (tag !== 10) {
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
message.name = reader.string();
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
case 2: {
|
|
472
|
+
if (tag !== 18) {
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
message.unit = reader.string();
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
case 3: {
|
|
480
|
+
if (tag !== 24) {
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
message.kind = reader.int32() as any;
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
reader.skip(tag & 7);
|
|
492
|
+
}
|
|
493
|
+
return message;
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
fromJSON(object: any): MetricInfo {
|
|
497
|
+
return {
|
|
498
|
+
name: isSet(object.name) ? globalThis.String(object.name) : "",
|
|
499
|
+
unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
|
|
500
|
+
kind: isSet(object.kind) ? metricKindFromJSON(object.kind) : 0,
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
|
|
504
|
+
toJSON(message: MetricInfo): unknown {
|
|
505
|
+
const obj: any = {};
|
|
506
|
+
if (message.name !== "") {
|
|
507
|
+
obj.name = message.name;
|
|
508
|
+
}
|
|
509
|
+
if (message.unit !== "") {
|
|
510
|
+
obj.unit = message.unit;
|
|
511
|
+
}
|
|
512
|
+
if (message.kind !== 0) {
|
|
513
|
+
obj.kind = metricKindToJSON(message.kind);
|
|
514
|
+
}
|
|
515
|
+
return obj;
|
|
516
|
+
},
|
|
517
|
+
|
|
518
|
+
create<I extends Exact<DeepPartial<MetricInfo>, I>>(base?: I): MetricInfo {
|
|
519
|
+
return MetricInfo.fromPartial(base ?? ({} as any));
|
|
520
|
+
},
|
|
521
|
+
fromPartial<I extends Exact<DeepPartial<MetricInfo>, I>>(object: I): MetricInfo {
|
|
522
|
+
const message = createBaseMetricInfo();
|
|
523
|
+
message.name = object.name ?? "";
|
|
524
|
+
message.unit = object.unit ?? "";
|
|
525
|
+
message.kind = object.kind ?? 0;
|
|
526
|
+
return message;
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
function createBaseListMetricAttributesRequest(): ListMetricAttributesRequest {
|
|
531
|
+
return { projectId: "", metricName: "", organizationId: "" };
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export const ListMetricAttributesRequest: MessageFns<ListMetricAttributesRequest> = {
|
|
535
|
+
encode(message: ListMetricAttributesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
536
|
+
if (message.projectId !== "") {
|
|
537
|
+
writer.uint32(10).string(message.projectId);
|
|
538
|
+
}
|
|
539
|
+
if (message.metricName !== "") {
|
|
540
|
+
writer.uint32(18).string(message.metricName);
|
|
541
|
+
}
|
|
542
|
+
if (message.organizationId !== "") {
|
|
543
|
+
writer.uint32(26).string(message.organizationId);
|
|
544
|
+
}
|
|
545
|
+
return writer;
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMetricAttributesRequest {
|
|
549
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
550
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
551
|
+
const message = createBaseListMetricAttributesRequest();
|
|
552
|
+
while (reader.pos < end) {
|
|
553
|
+
const tag = reader.uint32();
|
|
554
|
+
switch (tag >>> 3) {
|
|
555
|
+
case 1: {
|
|
556
|
+
if (tag !== 10) {
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
message.projectId = reader.string();
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
case 2: {
|
|
564
|
+
if (tag !== 18) {
|
|
565
|
+
break;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
message.metricName = reader.string();
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
case 3: {
|
|
572
|
+
if (tag !== 26) {
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
message.organizationId = reader.string();
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
reader.skip(tag & 7);
|
|
584
|
+
}
|
|
585
|
+
return message;
|
|
586
|
+
},
|
|
587
|
+
|
|
588
|
+
fromJSON(object: any): ListMetricAttributesRequest {
|
|
589
|
+
return {
|
|
590
|
+
projectId: isSet(object.projectId)
|
|
591
|
+
? globalThis.String(object.projectId)
|
|
592
|
+
: isSet(object.project_id)
|
|
593
|
+
? globalThis.String(object.project_id)
|
|
594
|
+
: "",
|
|
595
|
+
metricName: isSet(object.metricName)
|
|
596
|
+
? globalThis.String(object.metricName)
|
|
597
|
+
: isSet(object.metric_name)
|
|
598
|
+
? globalThis.String(object.metric_name)
|
|
599
|
+
: "",
|
|
600
|
+
organizationId: isSet(object.organizationId)
|
|
601
|
+
? globalThis.String(object.organizationId)
|
|
602
|
+
: isSet(object.organization_id)
|
|
603
|
+
? globalThis.String(object.organization_id)
|
|
604
|
+
: "",
|
|
605
|
+
};
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
toJSON(message: ListMetricAttributesRequest): unknown {
|
|
609
|
+
const obj: any = {};
|
|
610
|
+
if (message.projectId !== "") {
|
|
611
|
+
obj.projectId = message.projectId;
|
|
612
|
+
}
|
|
613
|
+
if (message.metricName !== "") {
|
|
614
|
+
obj.metricName = message.metricName;
|
|
615
|
+
}
|
|
616
|
+
if (message.organizationId !== "") {
|
|
617
|
+
obj.organizationId = message.organizationId;
|
|
618
|
+
}
|
|
619
|
+
return obj;
|
|
620
|
+
},
|
|
621
|
+
|
|
622
|
+
create<I extends Exact<DeepPartial<ListMetricAttributesRequest>, I>>(base?: I): ListMetricAttributesRequest {
|
|
623
|
+
return ListMetricAttributesRequest.fromPartial(base ?? ({} as any));
|
|
624
|
+
},
|
|
625
|
+
fromPartial<I extends Exact<DeepPartial<ListMetricAttributesRequest>, I>>(object: I): ListMetricAttributesRequest {
|
|
626
|
+
const message = createBaseListMetricAttributesRequest();
|
|
627
|
+
message.projectId = object.projectId ?? "";
|
|
628
|
+
message.metricName = object.metricName ?? "";
|
|
629
|
+
message.organizationId = object.organizationId ?? "";
|
|
630
|
+
return message;
|
|
631
|
+
},
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
function createBaseListMetricAttributesResponse(): ListMetricAttributesResponse {
|
|
635
|
+
return { status: undefined, attributes: [] };
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export const ListMetricAttributesResponse: MessageFns<ListMetricAttributesResponse> = {
|
|
639
|
+
encode(message: ListMetricAttributesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
640
|
+
if (message.status !== undefined) {
|
|
641
|
+
ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
|
|
642
|
+
}
|
|
643
|
+
for (const v of message.attributes) {
|
|
644
|
+
MetricAttribute.encode(v!, writer.uint32(18).fork()).join();
|
|
645
|
+
}
|
|
646
|
+
return writer;
|
|
647
|
+
},
|
|
648
|
+
|
|
649
|
+
decode(input: BinaryReader | Uint8Array, length?: number): ListMetricAttributesResponse {
|
|
650
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
651
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
652
|
+
const message = createBaseListMetricAttributesResponse();
|
|
653
|
+
while (reader.pos < end) {
|
|
654
|
+
const tag = reader.uint32();
|
|
655
|
+
switch (tag >>> 3) {
|
|
656
|
+
case 1: {
|
|
657
|
+
if (tag !== 10) {
|
|
658
|
+
break;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
message.status = ResponseStatus.decode(reader, reader.uint32());
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
case 2: {
|
|
665
|
+
if (tag !== 18) {
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
message.attributes.push(MetricAttribute.decode(reader, reader.uint32()));
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
reader.skip(tag & 7);
|
|
677
|
+
}
|
|
678
|
+
return message;
|
|
679
|
+
},
|
|
680
|
+
|
|
681
|
+
fromJSON(object: any): ListMetricAttributesResponse {
|
|
682
|
+
return {
|
|
683
|
+
status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
|
|
684
|
+
attributes: globalThis.Array.isArray(object?.attributes)
|
|
685
|
+
? object.attributes.map((e: any) => MetricAttribute.fromJSON(e))
|
|
686
|
+
: [],
|
|
687
|
+
};
|
|
688
|
+
},
|
|
689
|
+
|
|
690
|
+
toJSON(message: ListMetricAttributesResponse): unknown {
|
|
691
|
+
const obj: any = {};
|
|
692
|
+
if (message.status !== undefined) {
|
|
693
|
+
obj.status = ResponseStatus.toJSON(message.status);
|
|
694
|
+
}
|
|
695
|
+
if (message.attributes?.length) {
|
|
696
|
+
obj.attributes = message.attributes.map((e) => MetricAttribute.toJSON(e));
|
|
697
|
+
}
|
|
698
|
+
return obj;
|
|
699
|
+
},
|
|
700
|
+
|
|
701
|
+
create<I extends Exact<DeepPartial<ListMetricAttributesResponse>, I>>(base?: I): ListMetricAttributesResponse {
|
|
702
|
+
return ListMetricAttributesResponse.fromPartial(base ?? ({} as any));
|
|
703
|
+
},
|
|
704
|
+
fromPartial<I extends Exact<DeepPartial<ListMetricAttributesResponse>, I>>(object: I): ListMetricAttributesResponse {
|
|
705
|
+
const message = createBaseListMetricAttributesResponse();
|
|
706
|
+
message.status = (object.status !== undefined && object.status !== null)
|
|
707
|
+
? ResponseStatus.fromPartial(object.status)
|
|
708
|
+
: undefined;
|
|
709
|
+
message.attributes = object.attributes?.map((e) => MetricAttribute.fromPartial(e)) || [];
|
|
710
|
+
return message;
|
|
711
|
+
},
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
function createBaseMetricAttribute(): MetricAttribute {
|
|
715
|
+
return { key: "", values: [] };
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export const MetricAttribute: MessageFns<MetricAttribute> = {
|
|
719
|
+
encode(message: MetricAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
720
|
+
if (message.key !== "") {
|
|
721
|
+
writer.uint32(10).string(message.key);
|
|
722
|
+
}
|
|
723
|
+
for (const v of message.values) {
|
|
724
|
+
writer.uint32(18).string(v!);
|
|
725
|
+
}
|
|
726
|
+
return writer;
|
|
727
|
+
},
|
|
728
|
+
|
|
729
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricAttribute {
|
|
730
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
731
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
732
|
+
const message = createBaseMetricAttribute();
|
|
733
|
+
while (reader.pos < end) {
|
|
734
|
+
const tag = reader.uint32();
|
|
735
|
+
switch (tag >>> 3) {
|
|
736
|
+
case 1: {
|
|
737
|
+
if (tag !== 10) {
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
message.key = reader.string();
|
|
742
|
+
continue;
|
|
743
|
+
}
|
|
744
|
+
case 2: {
|
|
745
|
+
if (tag !== 18) {
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
message.values.push(reader.string());
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
reader.skip(tag & 7);
|
|
757
|
+
}
|
|
758
|
+
return message;
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
fromJSON(object: any): MetricAttribute {
|
|
762
|
+
return {
|
|
763
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
764
|
+
values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.String(e)) : [],
|
|
765
|
+
};
|
|
766
|
+
},
|
|
767
|
+
|
|
768
|
+
toJSON(message: MetricAttribute): unknown {
|
|
769
|
+
const obj: any = {};
|
|
770
|
+
if (message.key !== "") {
|
|
771
|
+
obj.key = message.key;
|
|
772
|
+
}
|
|
773
|
+
if (message.values?.length) {
|
|
774
|
+
obj.values = message.values;
|
|
775
|
+
}
|
|
776
|
+
return obj;
|
|
777
|
+
},
|
|
778
|
+
|
|
779
|
+
create<I extends Exact<DeepPartial<MetricAttribute>, I>>(base?: I): MetricAttribute {
|
|
780
|
+
return MetricAttribute.fromPartial(base ?? ({} as any));
|
|
781
|
+
},
|
|
782
|
+
fromPartial<I extends Exact<DeepPartial<MetricAttribute>, I>>(object: I): MetricAttribute {
|
|
783
|
+
const message = createBaseMetricAttribute();
|
|
784
|
+
message.key = object.key ?? "";
|
|
785
|
+
message.values = object.values?.map((e) => e) || [];
|
|
786
|
+
return message;
|
|
787
|
+
},
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
function createBaseMetricQuery(): MetricQuery {
|
|
791
|
+
return {
|
|
792
|
+
projectId: "",
|
|
793
|
+
metricName: "",
|
|
794
|
+
filter: undefined,
|
|
795
|
+
groupBy: [],
|
|
796
|
+
aggregation: 0,
|
|
797
|
+
timeWindow: 0,
|
|
798
|
+
timeInterval: 0,
|
|
799
|
+
organizationId: "",
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export const MetricQuery: MessageFns<MetricQuery> = {
|
|
804
|
+
encode(message: MetricQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
805
|
+
if (message.projectId !== "") {
|
|
806
|
+
writer.uint32(10).string(message.projectId);
|
|
807
|
+
}
|
|
808
|
+
if (message.metricName !== "") {
|
|
809
|
+
writer.uint32(18).string(message.metricName);
|
|
810
|
+
}
|
|
811
|
+
if (message.filter !== undefined) {
|
|
812
|
+
MetricFilter.encode(message.filter, writer.uint32(26).fork()).join();
|
|
813
|
+
}
|
|
814
|
+
for (const v of message.groupBy) {
|
|
815
|
+
writer.uint32(34).string(v!);
|
|
816
|
+
}
|
|
817
|
+
if (message.aggregation !== 0) {
|
|
818
|
+
writer.uint32(40).int32(message.aggregation);
|
|
819
|
+
}
|
|
820
|
+
if (message.timeWindow !== 0) {
|
|
821
|
+
writer.uint32(48).int32(message.timeWindow);
|
|
822
|
+
}
|
|
823
|
+
if (message.timeInterval !== 0) {
|
|
824
|
+
writer.uint32(56).int32(message.timeInterval);
|
|
825
|
+
}
|
|
826
|
+
if (message.organizationId !== "") {
|
|
827
|
+
writer.uint32(66).string(message.organizationId);
|
|
828
|
+
}
|
|
829
|
+
return writer;
|
|
830
|
+
},
|
|
831
|
+
|
|
832
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricQuery {
|
|
833
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
834
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
835
|
+
const message = createBaseMetricQuery();
|
|
836
|
+
while (reader.pos < end) {
|
|
837
|
+
const tag = reader.uint32();
|
|
838
|
+
switch (tag >>> 3) {
|
|
839
|
+
case 1: {
|
|
840
|
+
if (tag !== 10) {
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
message.projectId = reader.string();
|
|
845
|
+
continue;
|
|
846
|
+
}
|
|
847
|
+
case 2: {
|
|
848
|
+
if (tag !== 18) {
|
|
849
|
+
break;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
message.metricName = reader.string();
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
case 3: {
|
|
856
|
+
if (tag !== 26) {
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
message.filter = MetricFilter.decode(reader, reader.uint32());
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
863
|
+
case 4: {
|
|
864
|
+
if (tag !== 34) {
|
|
865
|
+
break;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
message.groupBy.push(reader.string());
|
|
869
|
+
continue;
|
|
870
|
+
}
|
|
871
|
+
case 5: {
|
|
872
|
+
if (tag !== 40) {
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
message.aggregation = reader.int32() as any;
|
|
877
|
+
continue;
|
|
878
|
+
}
|
|
879
|
+
case 6: {
|
|
880
|
+
if (tag !== 48) {
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
message.timeWindow = reader.int32() as any;
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
case 7: {
|
|
888
|
+
if (tag !== 56) {
|
|
889
|
+
break;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
message.timeInterval = reader.int32() as any;
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
case 8: {
|
|
896
|
+
if (tag !== 66) {
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
message.organizationId = reader.string();
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
reader.skip(tag & 7);
|
|
908
|
+
}
|
|
909
|
+
return message;
|
|
910
|
+
},
|
|
911
|
+
|
|
912
|
+
fromJSON(object: any): MetricQuery {
|
|
913
|
+
return {
|
|
914
|
+
projectId: isSet(object.projectId)
|
|
915
|
+
? globalThis.String(object.projectId)
|
|
916
|
+
: isSet(object.project_id)
|
|
917
|
+
? globalThis.String(object.project_id)
|
|
918
|
+
: "",
|
|
919
|
+
metricName: isSet(object.metricName)
|
|
920
|
+
? globalThis.String(object.metricName)
|
|
921
|
+
: isSet(object.metric_name)
|
|
922
|
+
? globalThis.String(object.metric_name)
|
|
923
|
+
: "",
|
|
924
|
+
filter: isSet(object.filter) ? MetricFilter.fromJSON(object.filter) : undefined,
|
|
925
|
+
groupBy: globalThis.Array.isArray(object?.groupBy)
|
|
926
|
+
? object.groupBy.map((e: any) => globalThis.String(e))
|
|
927
|
+
: globalThis.Array.isArray(object?.group_by)
|
|
928
|
+
? object.group_by.map((e: any) => globalThis.String(e))
|
|
929
|
+
: [],
|
|
930
|
+
aggregation: isSet(object.aggregation) ? metricAggregationFromJSON(object.aggregation) : 0,
|
|
931
|
+
timeWindow: isSet(object.timeWindow)
|
|
932
|
+
? analyticsTimeWindowFromJSON(object.timeWindow)
|
|
933
|
+
: isSet(object.time_window)
|
|
934
|
+
? analyticsTimeWindowFromJSON(object.time_window)
|
|
935
|
+
: 0,
|
|
936
|
+
timeInterval: isSet(object.timeInterval)
|
|
937
|
+
? analyticsTimeIntervalFromJSON(object.timeInterval)
|
|
938
|
+
: isSet(object.time_interval)
|
|
939
|
+
? analyticsTimeIntervalFromJSON(object.time_interval)
|
|
940
|
+
: 0,
|
|
941
|
+
organizationId: isSet(object.organizationId)
|
|
942
|
+
? globalThis.String(object.organizationId)
|
|
943
|
+
: isSet(object.organization_id)
|
|
944
|
+
? globalThis.String(object.organization_id)
|
|
945
|
+
: "",
|
|
946
|
+
};
|
|
947
|
+
},
|
|
948
|
+
|
|
949
|
+
toJSON(message: MetricQuery): unknown {
|
|
950
|
+
const obj: any = {};
|
|
951
|
+
if (message.projectId !== "") {
|
|
952
|
+
obj.projectId = message.projectId;
|
|
953
|
+
}
|
|
954
|
+
if (message.metricName !== "") {
|
|
955
|
+
obj.metricName = message.metricName;
|
|
956
|
+
}
|
|
957
|
+
if (message.filter !== undefined) {
|
|
958
|
+
obj.filter = MetricFilter.toJSON(message.filter);
|
|
959
|
+
}
|
|
960
|
+
if (message.groupBy?.length) {
|
|
961
|
+
obj.groupBy = message.groupBy;
|
|
962
|
+
}
|
|
963
|
+
if (message.aggregation !== 0) {
|
|
964
|
+
obj.aggregation = metricAggregationToJSON(message.aggregation);
|
|
965
|
+
}
|
|
966
|
+
if (message.timeWindow !== 0) {
|
|
967
|
+
obj.timeWindow = analyticsTimeWindowToJSON(message.timeWindow);
|
|
968
|
+
}
|
|
969
|
+
if (message.timeInterval !== 0) {
|
|
970
|
+
obj.timeInterval = analyticsTimeIntervalToJSON(message.timeInterval);
|
|
971
|
+
}
|
|
972
|
+
if (message.organizationId !== "") {
|
|
973
|
+
obj.organizationId = message.organizationId;
|
|
974
|
+
}
|
|
975
|
+
return obj;
|
|
976
|
+
},
|
|
977
|
+
|
|
978
|
+
create<I extends Exact<DeepPartial<MetricQuery>, I>>(base?: I): MetricQuery {
|
|
979
|
+
return MetricQuery.fromPartial(base ?? ({} as any));
|
|
980
|
+
},
|
|
981
|
+
fromPartial<I extends Exact<DeepPartial<MetricQuery>, I>>(object: I): MetricQuery {
|
|
982
|
+
const message = createBaseMetricQuery();
|
|
983
|
+
message.projectId = object.projectId ?? "";
|
|
984
|
+
message.metricName = object.metricName ?? "";
|
|
985
|
+
message.filter = (object.filter !== undefined && object.filter !== null)
|
|
986
|
+
? MetricFilter.fromPartial(object.filter)
|
|
987
|
+
: undefined;
|
|
988
|
+
message.groupBy = object.groupBy?.map((e) => e) || [];
|
|
989
|
+
message.aggregation = object.aggregation ?? 0;
|
|
990
|
+
message.timeWindow = object.timeWindow ?? 0;
|
|
991
|
+
message.timeInterval = object.timeInterval ?? 0;
|
|
992
|
+
message.organizationId = object.organizationId ?? "";
|
|
993
|
+
return message;
|
|
994
|
+
},
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
function createBaseMetricFilter(): MetricFilter {
|
|
998
|
+
return { serviceNames: [], attributeEquals: {} };
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export const MetricFilter: MessageFns<MetricFilter> = {
|
|
1002
|
+
encode(message: MetricFilter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1003
|
+
for (const v of message.serviceNames) {
|
|
1004
|
+
writer.uint32(10).string(v!);
|
|
1005
|
+
}
|
|
1006
|
+
globalThis.Object.entries(message.attributeEquals).forEach(([key, value]: [string, string]) => {
|
|
1007
|
+
MetricFilter_AttributeEqualsEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).join();
|
|
1008
|
+
});
|
|
1009
|
+
return writer;
|
|
1010
|
+
},
|
|
1011
|
+
|
|
1012
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricFilter {
|
|
1013
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1014
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1015
|
+
const message = createBaseMetricFilter();
|
|
1016
|
+
while (reader.pos < end) {
|
|
1017
|
+
const tag = reader.uint32();
|
|
1018
|
+
switch (tag >>> 3) {
|
|
1019
|
+
case 1: {
|
|
1020
|
+
if (tag !== 10) {
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
message.serviceNames.push(reader.string());
|
|
1025
|
+
continue;
|
|
1026
|
+
}
|
|
1027
|
+
case 2: {
|
|
1028
|
+
if (tag !== 18) {
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
const entry2 = MetricFilter_AttributeEqualsEntry.decode(reader, reader.uint32());
|
|
1033
|
+
if (entry2.value !== undefined) {
|
|
1034
|
+
message.attributeEquals[entry2.key] = entry2.value;
|
|
1035
|
+
}
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
reader.skip(tag & 7);
|
|
1043
|
+
}
|
|
1044
|
+
return message;
|
|
1045
|
+
},
|
|
1046
|
+
|
|
1047
|
+
fromJSON(object: any): MetricFilter {
|
|
1048
|
+
return {
|
|
1049
|
+
serviceNames: globalThis.Array.isArray(object?.serviceNames)
|
|
1050
|
+
? object.serviceNames.map((e: any) => globalThis.String(e))
|
|
1051
|
+
: globalThis.Array.isArray(object?.service_names)
|
|
1052
|
+
? object.service_names.map((e: any) => globalThis.String(e))
|
|
1053
|
+
: [],
|
|
1054
|
+
attributeEquals: isObject(object.attributeEquals)
|
|
1055
|
+
? (globalThis.Object.entries(object.attributeEquals) as [string, any][]).reduce(
|
|
1056
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1057
|
+
acc[key] = globalThis.String(value);
|
|
1058
|
+
return acc;
|
|
1059
|
+
},
|
|
1060
|
+
{},
|
|
1061
|
+
)
|
|
1062
|
+
: isObject(object.attribute_equals)
|
|
1063
|
+
? (globalThis.Object.entries(object.attribute_equals) as [string, any][]).reduce(
|
|
1064
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1065
|
+
acc[key] = globalThis.String(value);
|
|
1066
|
+
return acc;
|
|
1067
|
+
},
|
|
1068
|
+
{},
|
|
1069
|
+
)
|
|
1070
|
+
: {},
|
|
1071
|
+
};
|
|
1072
|
+
},
|
|
1073
|
+
|
|
1074
|
+
toJSON(message: MetricFilter): unknown {
|
|
1075
|
+
const obj: any = {};
|
|
1076
|
+
if (message.serviceNames?.length) {
|
|
1077
|
+
obj.serviceNames = message.serviceNames;
|
|
1078
|
+
}
|
|
1079
|
+
if (message.attributeEquals) {
|
|
1080
|
+
const entries = globalThis.Object.entries(message.attributeEquals) as [string, string][];
|
|
1081
|
+
if (entries.length > 0) {
|
|
1082
|
+
obj.attributeEquals = {};
|
|
1083
|
+
entries.forEach(([k, v]) => {
|
|
1084
|
+
obj.attributeEquals[k] = v;
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
return obj;
|
|
1089
|
+
},
|
|
1090
|
+
|
|
1091
|
+
create<I extends Exact<DeepPartial<MetricFilter>, I>>(base?: I): MetricFilter {
|
|
1092
|
+
return MetricFilter.fromPartial(base ?? ({} as any));
|
|
1093
|
+
},
|
|
1094
|
+
fromPartial<I extends Exact<DeepPartial<MetricFilter>, I>>(object: I): MetricFilter {
|
|
1095
|
+
const message = createBaseMetricFilter();
|
|
1096
|
+
message.serviceNames = object.serviceNames?.map((e) => e) || [];
|
|
1097
|
+
message.attributeEquals = (globalThis.Object.entries(object.attributeEquals ?? {}) as [string, string][]).reduce(
|
|
1098
|
+
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
|
1099
|
+
if (value !== undefined) {
|
|
1100
|
+
acc[key] = globalThis.String(value);
|
|
1101
|
+
}
|
|
1102
|
+
return acc;
|
|
1103
|
+
},
|
|
1104
|
+
{},
|
|
1105
|
+
);
|
|
1106
|
+
return message;
|
|
1107
|
+
},
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1110
|
+
function createBaseMetricFilter_AttributeEqualsEntry(): MetricFilter_AttributeEqualsEntry {
|
|
1111
|
+
return { key: "", value: "" };
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
export const MetricFilter_AttributeEqualsEntry: MessageFns<MetricFilter_AttributeEqualsEntry> = {
|
|
1115
|
+
encode(message: MetricFilter_AttributeEqualsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1116
|
+
if (message.key !== "") {
|
|
1117
|
+
writer.uint32(10).string(message.key);
|
|
1118
|
+
}
|
|
1119
|
+
if (message.value !== "") {
|
|
1120
|
+
writer.uint32(18).string(message.value);
|
|
1121
|
+
}
|
|
1122
|
+
return writer;
|
|
1123
|
+
},
|
|
1124
|
+
|
|
1125
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricFilter_AttributeEqualsEntry {
|
|
1126
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1127
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1128
|
+
const message = createBaseMetricFilter_AttributeEqualsEntry();
|
|
1129
|
+
while (reader.pos < end) {
|
|
1130
|
+
const tag = reader.uint32();
|
|
1131
|
+
switch (tag >>> 3) {
|
|
1132
|
+
case 1: {
|
|
1133
|
+
if (tag !== 10) {
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
message.key = reader.string();
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
case 2: {
|
|
1141
|
+
if (tag !== 18) {
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
message.value = reader.string();
|
|
1146
|
+
continue;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1152
|
+
reader.skip(tag & 7);
|
|
1153
|
+
}
|
|
1154
|
+
return message;
|
|
1155
|
+
},
|
|
1156
|
+
|
|
1157
|
+
fromJSON(object: any): MetricFilter_AttributeEqualsEntry {
|
|
1158
|
+
return {
|
|
1159
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
1160
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
1161
|
+
};
|
|
1162
|
+
},
|
|
1163
|
+
|
|
1164
|
+
toJSON(message: MetricFilter_AttributeEqualsEntry): unknown {
|
|
1165
|
+
const obj: any = {};
|
|
1166
|
+
if (message.key !== "") {
|
|
1167
|
+
obj.key = message.key;
|
|
1168
|
+
}
|
|
1169
|
+
if (message.value !== "") {
|
|
1170
|
+
obj.value = message.value;
|
|
1171
|
+
}
|
|
1172
|
+
return obj;
|
|
1173
|
+
},
|
|
1174
|
+
|
|
1175
|
+
create<I extends Exact<DeepPartial<MetricFilter_AttributeEqualsEntry>, I>>(
|
|
1176
|
+
base?: I,
|
|
1177
|
+
): MetricFilter_AttributeEqualsEntry {
|
|
1178
|
+
return MetricFilter_AttributeEqualsEntry.fromPartial(base ?? ({} as any));
|
|
1179
|
+
},
|
|
1180
|
+
fromPartial<I extends Exact<DeepPartial<MetricFilter_AttributeEqualsEntry>, I>>(
|
|
1181
|
+
object: I,
|
|
1182
|
+
): MetricFilter_AttributeEqualsEntry {
|
|
1183
|
+
const message = createBaseMetricFilter_AttributeEqualsEntry();
|
|
1184
|
+
message.key = object.key ?? "";
|
|
1185
|
+
message.value = object.value ?? "";
|
|
1186
|
+
return message;
|
|
1187
|
+
},
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
function createBaseQueryMetricsRequest(): QueryMetricsRequest {
|
|
1191
|
+
return { query: undefined };
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
export const QueryMetricsRequest: MessageFns<QueryMetricsRequest> = {
|
|
1195
|
+
encode(message: QueryMetricsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1196
|
+
if (message.query !== undefined) {
|
|
1197
|
+
MetricQuery.encode(message.query, writer.uint32(10).fork()).join();
|
|
1198
|
+
}
|
|
1199
|
+
return writer;
|
|
1200
|
+
},
|
|
1201
|
+
|
|
1202
|
+
decode(input: BinaryReader | Uint8Array, length?: number): QueryMetricsRequest {
|
|
1203
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1204
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1205
|
+
const message = createBaseQueryMetricsRequest();
|
|
1206
|
+
while (reader.pos < end) {
|
|
1207
|
+
const tag = reader.uint32();
|
|
1208
|
+
switch (tag >>> 3) {
|
|
1209
|
+
case 1: {
|
|
1210
|
+
if (tag !== 10) {
|
|
1211
|
+
break;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
message.query = MetricQuery.decode(reader, reader.uint32());
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
reader.skip(tag & 7);
|
|
1222
|
+
}
|
|
1223
|
+
return message;
|
|
1224
|
+
},
|
|
1225
|
+
|
|
1226
|
+
fromJSON(object: any): QueryMetricsRequest {
|
|
1227
|
+
return { query: isSet(object.query) ? MetricQuery.fromJSON(object.query) : undefined };
|
|
1228
|
+
},
|
|
1229
|
+
|
|
1230
|
+
toJSON(message: QueryMetricsRequest): unknown {
|
|
1231
|
+
const obj: any = {};
|
|
1232
|
+
if (message.query !== undefined) {
|
|
1233
|
+
obj.query = MetricQuery.toJSON(message.query);
|
|
1234
|
+
}
|
|
1235
|
+
return obj;
|
|
1236
|
+
},
|
|
1237
|
+
|
|
1238
|
+
create<I extends Exact<DeepPartial<QueryMetricsRequest>, I>>(base?: I): QueryMetricsRequest {
|
|
1239
|
+
return QueryMetricsRequest.fromPartial(base ?? ({} as any));
|
|
1240
|
+
},
|
|
1241
|
+
fromPartial<I extends Exact<DeepPartial<QueryMetricsRequest>, I>>(object: I): QueryMetricsRequest {
|
|
1242
|
+
const message = createBaseQueryMetricsRequest();
|
|
1243
|
+
message.query = (object.query !== undefined && object.query !== null)
|
|
1244
|
+
? MetricQuery.fromPartial(object.query)
|
|
1245
|
+
: undefined;
|
|
1246
|
+
return message;
|
|
1247
|
+
},
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
function createBaseQueryMetricsResponse(): QueryMetricsResponse {
|
|
1251
|
+
return { status: undefined, snapshot: undefined };
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
export const QueryMetricsResponse: MessageFns<QueryMetricsResponse> = {
|
|
1255
|
+
encode(message: QueryMetricsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1256
|
+
if (message.status !== undefined) {
|
|
1257
|
+
ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
|
|
1258
|
+
}
|
|
1259
|
+
if (message.snapshot !== undefined) {
|
|
1260
|
+
MetricAnalyticsSnapshot.encode(message.snapshot, writer.uint32(18).fork()).join();
|
|
1261
|
+
}
|
|
1262
|
+
return writer;
|
|
1263
|
+
},
|
|
1264
|
+
|
|
1265
|
+
decode(input: BinaryReader | Uint8Array, length?: number): QueryMetricsResponse {
|
|
1266
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1267
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1268
|
+
const message = createBaseQueryMetricsResponse();
|
|
1269
|
+
while (reader.pos < end) {
|
|
1270
|
+
const tag = reader.uint32();
|
|
1271
|
+
switch (tag >>> 3) {
|
|
1272
|
+
case 1: {
|
|
1273
|
+
if (tag !== 10) {
|
|
1274
|
+
break;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
message.status = ResponseStatus.decode(reader, reader.uint32());
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
case 2: {
|
|
1281
|
+
if (tag !== 18) {
|
|
1282
|
+
break;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
message.snapshot = MetricAnalyticsSnapshot.decode(reader, reader.uint32());
|
|
1286
|
+
continue;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1292
|
+
reader.skip(tag & 7);
|
|
1293
|
+
}
|
|
1294
|
+
return message;
|
|
1295
|
+
},
|
|
1296
|
+
|
|
1297
|
+
fromJSON(object: any): QueryMetricsResponse {
|
|
1298
|
+
return {
|
|
1299
|
+
status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
|
|
1300
|
+
snapshot: isSet(object.snapshot) ? MetricAnalyticsSnapshot.fromJSON(object.snapshot) : undefined,
|
|
1301
|
+
};
|
|
1302
|
+
},
|
|
1303
|
+
|
|
1304
|
+
toJSON(message: QueryMetricsResponse): unknown {
|
|
1305
|
+
const obj: any = {};
|
|
1306
|
+
if (message.status !== undefined) {
|
|
1307
|
+
obj.status = ResponseStatus.toJSON(message.status);
|
|
1308
|
+
}
|
|
1309
|
+
if (message.snapshot !== undefined) {
|
|
1310
|
+
obj.snapshot = MetricAnalyticsSnapshot.toJSON(message.snapshot);
|
|
1311
|
+
}
|
|
1312
|
+
return obj;
|
|
1313
|
+
},
|
|
1314
|
+
|
|
1315
|
+
create<I extends Exact<DeepPartial<QueryMetricsResponse>, I>>(base?: I): QueryMetricsResponse {
|
|
1316
|
+
return QueryMetricsResponse.fromPartial(base ?? ({} as any));
|
|
1317
|
+
},
|
|
1318
|
+
fromPartial<I extends Exact<DeepPartial<QueryMetricsResponse>, I>>(object: I): QueryMetricsResponse {
|
|
1319
|
+
const message = createBaseQueryMetricsResponse();
|
|
1320
|
+
message.status = (object.status !== undefined && object.status !== null)
|
|
1321
|
+
? ResponseStatus.fromPartial(object.status)
|
|
1322
|
+
: undefined;
|
|
1323
|
+
message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
|
|
1324
|
+
? MetricAnalyticsSnapshot.fromPartial(object.snapshot)
|
|
1325
|
+
: undefined;
|
|
1326
|
+
return message;
|
|
1327
|
+
},
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
function createBaseStreamMetricAnalyticsRequest(): StreamMetricAnalyticsRequest {
|
|
1331
|
+
return { query: undefined };
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
export const StreamMetricAnalyticsRequest: MessageFns<StreamMetricAnalyticsRequest> = {
|
|
1335
|
+
encode(message: StreamMetricAnalyticsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1336
|
+
if (message.query !== undefined) {
|
|
1337
|
+
MetricQuery.encode(message.query, writer.uint32(10).fork()).join();
|
|
1338
|
+
}
|
|
1339
|
+
return writer;
|
|
1340
|
+
},
|
|
1341
|
+
|
|
1342
|
+
decode(input: BinaryReader | Uint8Array, length?: number): StreamMetricAnalyticsRequest {
|
|
1343
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1344
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1345
|
+
const message = createBaseStreamMetricAnalyticsRequest();
|
|
1346
|
+
while (reader.pos < end) {
|
|
1347
|
+
const tag = reader.uint32();
|
|
1348
|
+
switch (tag >>> 3) {
|
|
1349
|
+
case 1: {
|
|
1350
|
+
if (tag !== 10) {
|
|
1351
|
+
break;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
message.query = MetricQuery.decode(reader, reader.uint32());
|
|
1355
|
+
continue;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1359
|
+
break;
|
|
1360
|
+
}
|
|
1361
|
+
reader.skip(tag & 7);
|
|
1362
|
+
}
|
|
1363
|
+
return message;
|
|
1364
|
+
},
|
|
1365
|
+
|
|
1366
|
+
fromJSON(object: any): StreamMetricAnalyticsRequest {
|
|
1367
|
+
return { query: isSet(object.query) ? MetricQuery.fromJSON(object.query) : undefined };
|
|
1368
|
+
},
|
|
1369
|
+
|
|
1370
|
+
toJSON(message: StreamMetricAnalyticsRequest): unknown {
|
|
1371
|
+
const obj: any = {};
|
|
1372
|
+
if (message.query !== undefined) {
|
|
1373
|
+
obj.query = MetricQuery.toJSON(message.query);
|
|
1374
|
+
}
|
|
1375
|
+
return obj;
|
|
1376
|
+
},
|
|
1377
|
+
|
|
1378
|
+
create<I extends Exact<DeepPartial<StreamMetricAnalyticsRequest>, I>>(base?: I): StreamMetricAnalyticsRequest {
|
|
1379
|
+
return StreamMetricAnalyticsRequest.fromPartial(base ?? ({} as any));
|
|
1380
|
+
},
|
|
1381
|
+
fromPartial<I extends Exact<DeepPartial<StreamMetricAnalyticsRequest>, I>>(object: I): StreamMetricAnalyticsRequest {
|
|
1382
|
+
const message = createBaseStreamMetricAnalyticsRequest();
|
|
1383
|
+
message.query = (object.query !== undefined && object.query !== null)
|
|
1384
|
+
? MetricQuery.fromPartial(object.query)
|
|
1385
|
+
: undefined;
|
|
1386
|
+
return message;
|
|
1387
|
+
},
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
function createBaseMetricAnalyticsEnvelope(): MetricAnalyticsEnvelope {
|
|
1391
|
+
return { snapshot: undefined, bucketUpdate: undefined };
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
export const MetricAnalyticsEnvelope: MessageFns<MetricAnalyticsEnvelope> = {
|
|
1395
|
+
encode(message: MetricAnalyticsEnvelope, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1396
|
+
if (message.snapshot !== undefined) {
|
|
1397
|
+
MetricAnalyticsSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
|
|
1398
|
+
}
|
|
1399
|
+
if (message.bucketUpdate !== undefined) {
|
|
1400
|
+
MetricSeriesBucketUpdate.encode(message.bucketUpdate, writer.uint32(18).fork()).join();
|
|
1401
|
+
}
|
|
1402
|
+
return writer;
|
|
1403
|
+
},
|
|
1404
|
+
|
|
1405
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricAnalyticsEnvelope {
|
|
1406
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1407
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1408
|
+
const message = createBaseMetricAnalyticsEnvelope();
|
|
1409
|
+
while (reader.pos < end) {
|
|
1410
|
+
const tag = reader.uint32();
|
|
1411
|
+
switch (tag >>> 3) {
|
|
1412
|
+
case 1: {
|
|
1413
|
+
if (tag !== 10) {
|
|
1414
|
+
break;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
message.snapshot = MetricAnalyticsSnapshot.decode(reader, reader.uint32());
|
|
1418
|
+
continue;
|
|
1419
|
+
}
|
|
1420
|
+
case 2: {
|
|
1421
|
+
if (tag !== 18) {
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
message.bucketUpdate = MetricSeriesBucketUpdate.decode(reader, reader.uint32());
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
reader.skip(tag & 7);
|
|
1433
|
+
}
|
|
1434
|
+
return message;
|
|
1435
|
+
},
|
|
1436
|
+
|
|
1437
|
+
fromJSON(object: any): MetricAnalyticsEnvelope {
|
|
1438
|
+
return {
|
|
1439
|
+
snapshot: isSet(object.snapshot) ? MetricAnalyticsSnapshot.fromJSON(object.snapshot) : undefined,
|
|
1440
|
+
bucketUpdate: isSet(object.bucketUpdate)
|
|
1441
|
+
? MetricSeriesBucketUpdate.fromJSON(object.bucketUpdate)
|
|
1442
|
+
: isSet(object.bucket_update)
|
|
1443
|
+
? MetricSeriesBucketUpdate.fromJSON(object.bucket_update)
|
|
1444
|
+
: undefined,
|
|
1445
|
+
};
|
|
1446
|
+
},
|
|
1447
|
+
|
|
1448
|
+
toJSON(message: MetricAnalyticsEnvelope): unknown {
|
|
1449
|
+
const obj: any = {};
|
|
1450
|
+
if (message.snapshot !== undefined) {
|
|
1451
|
+
obj.snapshot = MetricAnalyticsSnapshot.toJSON(message.snapshot);
|
|
1452
|
+
}
|
|
1453
|
+
if (message.bucketUpdate !== undefined) {
|
|
1454
|
+
obj.bucketUpdate = MetricSeriesBucketUpdate.toJSON(message.bucketUpdate);
|
|
1455
|
+
}
|
|
1456
|
+
return obj;
|
|
1457
|
+
},
|
|
1458
|
+
|
|
1459
|
+
create<I extends Exact<DeepPartial<MetricAnalyticsEnvelope>, I>>(base?: I): MetricAnalyticsEnvelope {
|
|
1460
|
+
return MetricAnalyticsEnvelope.fromPartial(base ?? ({} as any));
|
|
1461
|
+
},
|
|
1462
|
+
fromPartial<I extends Exact<DeepPartial<MetricAnalyticsEnvelope>, I>>(object: I): MetricAnalyticsEnvelope {
|
|
1463
|
+
const message = createBaseMetricAnalyticsEnvelope();
|
|
1464
|
+
message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
|
|
1465
|
+
? MetricAnalyticsSnapshot.fromPartial(object.snapshot)
|
|
1466
|
+
: undefined;
|
|
1467
|
+
message.bucketUpdate = (object.bucketUpdate !== undefined && object.bucketUpdate !== null)
|
|
1468
|
+
? MetricSeriesBucketUpdate.fromPartial(object.bucketUpdate)
|
|
1469
|
+
: undefined;
|
|
1470
|
+
return message;
|
|
1471
|
+
},
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
function createBaseMetricAnalyticsSnapshot(): MetricAnalyticsSnapshot {
|
|
1475
|
+
return {
|
|
1476
|
+
series: [],
|
|
1477
|
+
windowStart: undefined,
|
|
1478
|
+
windowEnd: undefined,
|
|
1479
|
+
bucketSizeMs: 0,
|
|
1480
|
+
expectedBucketCount: 0,
|
|
1481
|
+
unit: "",
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
export const MetricAnalyticsSnapshot: MessageFns<MetricAnalyticsSnapshot> = {
|
|
1486
|
+
encode(message: MetricAnalyticsSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1487
|
+
for (const v of message.series) {
|
|
1488
|
+
MetricSeries.encode(v!, writer.uint32(10).fork()).join();
|
|
1489
|
+
}
|
|
1490
|
+
if (message.windowStart !== undefined) {
|
|
1491
|
+
Timestamp.encode(toTimestamp(message.windowStart), writer.uint32(18).fork()).join();
|
|
1492
|
+
}
|
|
1493
|
+
if (message.windowEnd !== undefined) {
|
|
1494
|
+
Timestamp.encode(toTimestamp(message.windowEnd), writer.uint32(26).fork()).join();
|
|
1495
|
+
}
|
|
1496
|
+
if (message.bucketSizeMs !== 0) {
|
|
1497
|
+
writer.uint32(32).int64(message.bucketSizeMs);
|
|
1498
|
+
}
|
|
1499
|
+
if (message.expectedBucketCount !== 0) {
|
|
1500
|
+
writer.uint32(40).int32(message.expectedBucketCount);
|
|
1501
|
+
}
|
|
1502
|
+
if (message.unit !== "") {
|
|
1503
|
+
writer.uint32(50).string(message.unit);
|
|
1504
|
+
}
|
|
1505
|
+
return writer;
|
|
1506
|
+
},
|
|
1507
|
+
|
|
1508
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricAnalyticsSnapshot {
|
|
1509
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1510
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1511
|
+
const message = createBaseMetricAnalyticsSnapshot();
|
|
1512
|
+
while (reader.pos < end) {
|
|
1513
|
+
const tag = reader.uint32();
|
|
1514
|
+
switch (tag >>> 3) {
|
|
1515
|
+
case 1: {
|
|
1516
|
+
if (tag !== 10) {
|
|
1517
|
+
break;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
message.series.push(MetricSeries.decode(reader, reader.uint32()));
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
case 2: {
|
|
1524
|
+
if (tag !== 18) {
|
|
1525
|
+
break;
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
message.windowStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
1529
|
+
continue;
|
|
1530
|
+
}
|
|
1531
|
+
case 3: {
|
|
1532
|
+
if (tag !== 26) {
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
message.windowEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
1537
|
+
continue;
|
|
1538
|
+
}
|
|
1539
|
+
case 4: {
|
|
1540
|
+
if (tag !== 32) {
|
|
1541
|
+
break;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
message.bucketSizeMs = longToNumber(reader.int64());
|
|
1545
|
+
continue;
|
|
1546
|
+
}
|
|
1547
|
+
case 5: {
|
|
1548
|
+
if (tag !== 40) {
|
|
1549
|
+
break;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
message.expectedBucketCount = reader.int32();
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
case 6: {
|
|
1556
|
+
if (tag !== 50) {
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
message.unit = reader.string();
|
|
1561
|
+
continue;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
reader.skip(tag & 7);
|
|
1568
|
+
}
|
|
1569
|
+
return message;
|
|
1570
|
+
},
|
|
1571
|
+
|
|
1572
|
+
fromJSON(object: any): MetricAnalyticsSnapshot {
|
|
1573
|
+
return {
|
|
1574
|
+
series: globalThis.Array.isArray(object?.series) ? object.series.map((e: any) => MetricSeries.fromJSON(e)) : [],
|
|
1575
|
+
windowStart: isSet(object.windowStart)
|
|
1576
|
+
? fromJsonTimestamp(object.windowStart)
|
|
1577
|
+
: isSet(object.window_start)
|
|
1578
|
+
? fromJsonTimestamp(object.window_start)
|
|
1579
|
+
: undefined,
|
|
1580
|
+
windowEnd: isSet(object.windowEnd)
|
|
1581
|
+
? fromJsonTimestamp(object.windowEnd)
|
|
1582
|
+
: isSet(object.window_end)
|
|
1583
|
+
? fromJsonTimestamp(object.window_end)
|
|
1584
|
+
: undefined,
|
|
1585
|
+
bucketSizeMs: isSet(object.bucketSizeMs)
|
|
1586
|
+
? globalThis.Number(object.bucketSizeMs)
|
|
1587
|
+
: isSet(object.bucket_size_ms)
|
|
1588
|
+
? globalThis.Number(object.bucket_size_ms)
|
|
1589
|
+
: 0,
|
|
1590
|
+
expectedBucketCount: isSet(object.expectedBucketCount)
|
|
1591
|
+
? globalThis.Number(object.expectedBucketCount)
|
|
1592
|
+
: isSet(object.expected_bucket_count)
|
|
1593
|
+
? globalThis.Number(object.expected_bucket_count)
|
|
1594
|
+
: 0,
|
|
1595
|
+
unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
|
|
1596
|
+
};
|
|
1597
|
+
},
|
|
1598
|
+
|
|
1599
|
+
toJSON(message: MetricAnalyticsSnapshot): unknown {
|
|
1600
|
+
const obj: any = {};
|
|
1601
|
+
if (message.series?.length) {
|
|
1602
|
+
obj.series = message.series.map((e) => MetricSeries.toJSON(e));
|
|
1603
|
+
}
|
|
1604
|
+
if (message.windowStart !== undefined) {
|
|
1605
|
+
obj.windowStart = message.windowStart.toISOString();
|
|
1606
|
+
}
|
|
1607
|
+
if (message.windowEnd !== undefined) {
|
|
1608
|
+
obj.windowEnd = message.windowEnd.toISOString();
|
|
1609
|
+
}
|
|
1610
|
+
if (message.bucketSizeMs !== 0) {
|
|
1611
|
+
obj.bucketSizeMs = Math.round(message.bucketSizeMs);
|
|
1612
|
+
}
|
|
1613
|
+
if (message.expectedBucketCount !== 0) {
|
|
1614
|
+
obj.expectedBucketCount = Math.round(message.expectedBucketCount);
|
|
1615
|
+
}
|
|
1616
|
+
if (message.unit !== "") {
|
|
1617
|
+
obj.unit = message.unit;
|
|
1618
|
+
}
|
|
1619
|
+
return obj;
|
|
1620
|
+
},
|
|
1621
|
+
|
|
1622
|
+
create<I extends Exact<DeepPartial<MetricAnalyticsSnapshot>, I>>(base?: I): MetricAnalyticsSnapshot {
|
|
1623
|
+
return MetricAnalyticsSnapshot.fromPartial(base ?? ({} as any));
|
|
1624
|
+
},
|
|
1625
|
+
fromPartial<I extends Exact<DeepPartial<MetricAnalyticsSnapshot>, I>>(object: I): MetricAnalyticsSnapshot {
|
|
1626
|
+
const message = createBaseMetricAnalyticsSnapshot();
|
|
1627
|
+
message.series = object.series?.map((e) => MetricSeries.fromPartial(e)) || [];
|
|
1628
|
+
message.windowStart = object.windowStart ?? undefined;
|
|
1629
|
+
message.windowEnd = object.windowEnd ?? undefined;
|
|
1630
|
+
message.bucketSizeMs = object.bucketSizeMs ?? 0;
|
|
1631
|
+
message.expectedBucketCount = object.expectedBucketCount ?? 0;
|
|
1632
|
+
message.unit = object.unit ?? "";
|
|
1633
|
+
return message;
|
|
1634
|
+
},
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
function createBaseMetricSeries(): MetricSeries {
|
|
1638
|
+
return { groupKey: {}, buckets: [] };
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
export const MetricSeries: MessageFns<MetricSeries> = {
|
|
1642
|
+
encode(message: MetricSeries, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1643
|
+
globalThis.Object.entries(message.groupKey).forEach(([key, value]: [string, string]) => {
|
|
1644
|
+
MetricSeries_GroupKeyEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
|
1645
|
+
});
|
|
1646
|
+
for (const v of message.buckets) {
|
|
1647
|
+
MetricBucket.encode(v!, writer.uint32(18).fork()).join();
|
|
1648
|
+
}
|
|
1649
|
+
return writer;
|
|
1650
|
+
},
|
|
1651
|
+
|
|
1652
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricSeries {
|
|
1653
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1654
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1655
|
+
const message = createBaseMetricSeries();
|
|
1656
|
+
while (reader.pos < end) {
|
|
1657
|
+
const tag = reader.uint32();
|
|
1658
|
+
switch (tag >>> 3) {
|
|
1659
|
+
case 1: {
|
|
1660
|
+
if (tag !== 10) {
|
|
1661
|
+
break;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
const entry1 = MetricSeries_GroupKeyEntry.decode(reader, reader.uint32());
|
|
1665
|
+
if (entry1.value !== undefined) {
|
|
1666
|
+
message.groupKey[entry1.key] = entry1.value;
|
|
1667
|
+
}
|
|
1668
|
+
continue;
|
|
1669
|
+
}
|
|
1670
|
+
case 2: {
|
|
1671
|
+
if (tag !== 18) {
|
|
1672
|
+
break;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
message.buckets.push(MetricBucket.decode(reader, reader.uint32()));
|
|
1676
|
+
continue;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1680
|
+
break;
|
|
1681
|
+
}
|
|
1682
|
+
reader.skip(tag & 7);
|
|
1683
|
+
}
|
|
1684
|
+
return message;
|
|
1685
|
+
},
|
|
1686
|
+
|
|
1687
|
+
fromJSON(object: any): MetricSeries {
|
|
1688
|
+
return {
|
|
1689
|
+
groupKey: isObject(object.groupKey)
|
|
1690
|
+
? (globalThis.Object.entries(object.groupKey) as [string, any][]).reduce(
|
|
1691
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1692
|
+
acc[key] = globalThis.String(value);
|
|
1693
|
+
return acc;
|
|
1694
|
+
},
|
|
1695
|
+
{},
|
|
1696
|
+
)
|
|
1697
|
+
: isObject(object.group_key)
|
|
1698
|
+
? (globalThis.Object.entries(object.group_key) as [string, any][]).reduce(
|
|
1699
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1700
|
+
acc[key] = globalThis.String(value);
|
|
1701
|
+
return acc;
|
|
1702
|
+
},
|
|
1703
|
+
{},
|
|
1704
|
+
)
|
|
1705
|
+
: {},
|
|
1706
|
+
buckets: globalThis.Array.isArray(object?.buckets)
|
|
1707
|
+
? object.buckets.map((e: any) => MetricBucket.fromJSON(e))
|
|
1708
|
+
: [],
|
|
1709
|
+
};
|
|
1710
|
+
},
|
|
1711
|
+
|
|
1712
|
+
toJSON(message: MetricSeries): unknown {
|
|
1713
|
+
const obj: any = {};
|
|
1714
|
+
if (message.groupKey) {
|
|
1715
|
+
const entries = globalThis.Object.entries(message.groupKey) as [string, string][];
|
|
1716
|
+
if (entries.length > 0) {
|
|
1717
|
+
obj.groupKey = {};
|
|
1718
|
+
entries.forEach(([k, v]) => {
|
|
1719
|
+
obj.groupKey[k] = v;
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
if (message.buckets?.length) {
|
|
1724
|
+
obj.buckets = message.buckets.map((e) => MetricBucket.toJSON(e));
|
|
1725
|
+
}
|
|
1726
|
+
return obj;
|
|
1727
|
+
},
|
|
1728
|
+
|
|
1729
|
+
create<I extends Exact<DeepPartial<MetricSeries>, I>>(base?: I): MetricSeries {
|
|
1730
|
+
return MetricSeries.fromPartial(base ?? ({} as any));
|
|
1731
|
+
},
|
|
1732
|
+
fromPartial<I extends Exact<DeepPartial<MetricSeries>, I>>(object: I): MetricSeries {
|
|
1733
|
+
const message = createBaseMetricSeries();
|
|
1734
|
+
message.groupKey = (globalThis.Object.entries(object.groupKey ?? {}) as [string, string][]).reduce(
|
|
1735
|
+
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
|
1736
|
+
if (value !== undefined) {
|
|
1737
|
+
acc[key] = globalThis.String(value);
|
|
1738
|
+
}
|
|
1739
|
+
return acc;
|
|
1740
|
+
},
|
|
1741
|
+
{},
|
|
1742
|
+
);
|
|
1743
|
+
message.buckets = object.buckets?.map((e) => MetricBucket.fromPartial(e)) || [];
|
|
1744
|
+
return message;
|
|
1745
|
+
},
|
|
1746
|
+
};
|
|
1747
|
+
|
|
1748
|
+
function createBaseMetricSeries_GroupKeyEntry(): MetricSeries_GroupKeyEntry {
|
|
1749
|
+
return { key: "", value: "" };
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
export const MetricSeries_GroupKeyEntry: MessageFns<MetricSeries_GroupKeyEntry> = {
|
|
1753
|
+
encode(message: MetricSeries_GroupKeyEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1754
|
+
if (message.key !== "") {
|
|
1755
|
+
writer.uint32(10).string(message.key);
|
|
1756
|
+
}
|
|
1757
|
+
if (message.value !== "") {
|
|
1758
|
+
writer.uint32(18).string(message.value);
|
|
1759
|
+
}
|
|
1760
|
+
return writer;
|
|
1761
|
+
},
|
|
1762
|
+
|
|
1763
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricSeries_GroupKeyEntry {
|
|
1764
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1765
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1766
|
+
const message = createBaseMetricSeries_GroupKeyEntry();
|
|
1767
|
+
while (reader.pos < end) {
|
|
1768
|
+
const tag = reader.uint32();
|
|
1769
|
+
switch (tag >>> 3) {
|
|
1770
|
+
case 1: {
|
|
1771
|
+
if (tag !== 10) {
|
|
1772
|
+
break;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
message.key = reader.string();
|
|
1776
|
+
continue;
|
|
1777
|
+
}
|
|
1778
|
+
case 2: {
|
|
1779
|
+
if (tag !== 18) {
|
|
1780
|
+
break;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
message.value = reader.string();
|
|
1784
|
+
continue;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
reader.skip(tag & 7);
|
|
1791
|
+
}
|
|
1792
|
+
return message;
|
|
1793
|
+
},
|
|
1794
|
+
|
|
1795
|
+
fromJSON(object: any): MetricSeries_GroupKeyEntry {
|
|
1796
|
+
return {
|
|
1797
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
1798
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
1799
|
+
};
|
|
1800
|
+
},
|
|
1801
|
+
|
|
1802
|
+
toJSON(message: MetricSeries_GroupKeyEntry): unknown {
|
|
1803
|
+
const obj: any = {};
|
|
1804
|
+
if (message.key !== "") {
|
|
1805
|
+
obj.key = message.key;
|
|
1806
|
+
}
|
|
1807
|
+
if (message.value !== "") {
|
|
1808
|
+
obj.value = message.value;
|
|
1809
|
+
}
|
|
1810
|
+
return obj;
|
|
1811
|
+
},
|
|
1812
|
+
|
|
1813
|
+
create<I extends Exact<DeepPartial<MetricSeries_GroupKeyEntry>, I>>(base?: I): MetricSeries_GroupKeyEntry {
|
|
1814
|
+
return MetricSeries_GroupKeyEntry.fromPartial(base ?? ({} as any));
|
|
1815
|
+
},
|
|
1816
|
+
fromPartial<I extends Exact<DeepPartial<MetricSeries_GroupKeyEntry>, I>>(object: I): MetricSeries_GroupKeyEntry {
|
|
1817
|
+
const message = createBaseMetricSeries_GroupKeyEntry();
|
|
1818
|
+
message.key = object.key ?? "";
|
|
1819
|
+
message.value = object.value ?? "";
|
|
1820
|
+
return message;
|
|
1821
|
+
},
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
function createBaseMetricBucket(): MetricBucket {
|
|
1825
|
+
return { bucketStart: undefined, value: 0 };
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
export const MetricBucket: MessageFns<MetricBucket> = {
|
|
1829
|
+
encode(message: MetricBucket, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1830
|
+
if (message.bucketStart !== undefined) {
|
|
1831
|
+
Timestamp.encode(toTimestamp(message.bucketStart), writer.uint32(10).fork()).join();
|
|
1832
|
+
}
|
|
1833
|
+
if (message.value !== 0) {
|
|
1834
|
+
writer.uint32(17).double(message.value);
|
|
1835
|
+
}
|
|
1836
|
+
return writer;
|
|
1837
|
+
},
|
|
1838
|
+
|
|
1839
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricBucket {
|
|
1840
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1841
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1842
|
+
const message = createBaseMetricBucket();
|
|
1843
|
+
while (reader.pos < end) {
|
|
1844
|
+
const tag = reader.uint32();
|
|
1845
|
+
switch (tag >>> 3) {
|
|
1846
|
+
case 1: {
|
|
1847
|
+
if (tag !== 10) {
|
|
1848
|
+
break;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
message.bucketStart = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
1852
|
+
continue;
|
|
1853
|
+
}
|
|
1854
|
+
case 2: {
|
|
1855
|
+
if (tag !== 17) {
|
|
1856
|
+
break;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
message.value = reader.double();
|
|
1860
|
+
continue;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1864
|
+
break;
|
|
1865
|
+
}
|
|
1866
|
+
reader.skip(tag & 7);
|
|
1867
|
+
}
|
|
1868
|
+
return message;
|
|
1869
|
+
},
|
|
1870
|
+
|
|
1871
|
+
fromJSON(object: any): MetricBucket {
|
|
1872
|
+
return {
|
|
1873
|
+
bucketStart: isSet(object.bucketStart)
|
|
1874
|
+
? fromJsonTimestamp(object.bucketStart)
|
|
1875
|
+
: isSet(object.bucket_start)
|
|
1876
|
+
? fromJsonTimestamp(object.bucket_start)
|
|
1877
|
+
: undefined,
|
|
1878
|
+
value: isSet(object.value) ? globalThis.Number(object.value) : 0,
|
|
1879
|
+
};
|
|
1880
|
+
},
|
|
1881
|
+
|
|
1882
|
+
toJSON(message: MetricBucket): unknown {
|
|
1883
|
+
const obj: any = {};
|
|
1884
|
+
if (message.bucketStart !== undefined) {
|
|
1885
|
+
obj.bucketStart = message.bucketStart.toISOString();
|
|
1886
|
+
}
|
|
1887
|
+
if (message.value !== 0) {
|
|
1888
|
+
obj.value = message.value;
|
|
1889
|
+
}
|
|
1890
|
+
return obj;
|
|
1891
|
+
},
|
|
1892
|
+
|
|
1893
|
+
create<I extends Exact<DeepPartial<MetricBucket>, I>>(base?: I): MetricBucket {
|
|
1894
|
+
return MetricBucket.fromPartial(base ?? ({} as any));
|
|
1895
|
+
},
|
|
1896
|
+
fromPartial<I extends Exact<DeepPartial<MetricBucket>, I>>(object: I): MetricBucket {
|
|
1897
|
+
const message = createBaseMetricBucket();
|
|
1898
|
+
message.bucketStart = object.bucketStart ?? undefined;
|
|
1899
|
+
message.value = object.value ?? 0;
|
|
1900
|
+
return message;
|
|
1901
|
+
},
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
function createBaseMetricSeriesBucketUpdate(): MetricSeriesBucketUpdate {
|
|
1905
|
+
return { groupKey: {}, bucket: undefined, generatedAt: undefined };
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
export const MetricSeriesBucketUpdate: MessageFns<MetricSeriesBucketUpdate> = {
|
|
1909
|
+
encode(message: MetricSeriesBucketUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
1910
|
+
globalThis.Object.entries(message.groupKey).forEach(([key, value]: [string, string]) => {
|
|
1911
|
+
MetricSeriesBucketUpdate_GroupKeyEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).join();
|
|
1912
|
+
});
|
|
1913
|
+
if (message.bucket !== undefined) {
|
|
1914
|
+
MetricBucket.encode(message.bucket, writer.uint32(18).fork()).join();
|
|
1915
|
+
}
|
|
1916
|
+
if (message.generatedAt !== undefined) {
|
|
1917
|
+
Timestamp.encode(toTimestamp(message.generatedAt), writer.uint32(26).fork()).join();
|
|
1918
|
+
}
|
|
1919
|
+
return writer;
|
|
1920
|
+
},
|
|
1921
|
+
|
|
1922
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricSeriesBucketUpdate {
|
|
1923
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1924
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1925
|
+
const message = createBaseMetricSeriesBucketUpdate();
|
|
1926
|
+
while (reader.pos < end) {
|
|
1927
|
+
const tag = reader.uint32();
|
|
1928
|
+
switch (tag >>> 3) {
|
|
1929
|
+
case 1: {
|
|
1930
|
+
if (tag !== 10) {
|
|
1931
|
+
break;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
const entry1 = MetricSeriesBucketUpdate_GroupKeyEntry.decode(reader, reader.uint32());
|
|
1935
|
+
if (entry1.value !== undefined) {
|
|
1936
|
+
message.groupKey[entry1.key] = entry1.value;
|
|
1937
|
+
}
|
|
1938
|
+
continue;
|
|
1939
|
+
}
|
|
1940
|
+
case 2: {
|
|
1941
|
+
if (tag !== 18) {
|
|
1942
|
+
break;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
message.bucket = MetricBucket.decode(reader, reader.uint32());
|
|
1946
|
+
continue;
|
|
1947
|
+
}
|
|
1948
|
+
case 3: {
|
|
1949
|
+
if (tag !== 26) {
|
|
1950
|
+
break;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
message.generatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
1954
|
+
continue;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1958
|
+
break;
|
|
1959
|
+
}
|
|
1960
|
+
reader.skip(tag & 7);
|
|
1961
|
+
}
|
|
1962
|
+
return message;
|
|
1963
|
+
},
|
|
1964
|
+
|
|
1965
|
+
fromJSON(object: any): MetricSeriesBucketUpdate {
|
|
1966
|
+
return {
|
|
1967
|
+
groupKey: isObject(object.groupKey)
|
|
1968
|
+
? (globalThis.Object.entries(object.groupKey) as [string, any][]).reduce(
|
|
1969
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1970
|
+
acc[key] = globalThis.String(value);
|
|
1971
|
+
return acc;
|
|
1972
|
+
},
|
|
1973
|
+
{},
|
|
1974
|
+
)
|
|
1975
|
+
: isObject(object.group_key)
|
|
1976
|
+
? (globalThis.Object.entries(object.group_key) as [string, any][]).reduce(
|
|
1977
|
+
(acc: { [key: string]: string }, [key, value]: [string, any]) => {
|
|
1978
|
+
acc[key] = globalThis.String(value);
|
|
1979
|
+
return acc;
|
|
1980
|
+
},
|
|
1981
|
+
{},
|
|
1982
|
+
)
|
|
1983
|
+
: {},
|
|
1984
|
+
bucket: isSet(object.bucket) ? MetricBucket.fromJSON(object.bucket) : undefined,
|
|
1985
|
+
generatedAt: isSet(object.generatedAt)
|
|
1986
|
+
? fromJsonTimestamp(object.generatedAt)
|
|
1987
|
+
: isSet(object.generated_at)
|
|
1988
|
+
? fromJsonTimestamp(object.generated_at)
|
|
1989
|
+
: undefined,
|
|
1990
|
+
};
|
|
1991
|
+
},
|
|
1992
|
+
|
|
1993
|
+
toJSON(message: MetricSeriesBucketUpdate): unknown {
|
|
1994
|
+
const obj: any = {};
|
|
1995
|
+
if (message.groupKey) {
|
|
1996
|
+
const entries = globalThis.Object.entries(message.groupKey) as [string, string][];
|
|
1997
|
+
if (entries.length > 0) {
|
|
1998
|
+
obj.groupKey = {};
|
|
1999
|
+
entries.forEach(([k, v]) => {
|
|
2000
|
+
obj.groupKey[k] = v;
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
if (message.bucket !== undefined) {
|
|
2005
|
+
obj.bucket = MetricBucket.toJSON(message.bucket);
|
|
2006
|
+
}
|
|
2007
|
+
if (message.generatedAt !== undefined) {
|
|
2008
|
+
obj.generatedAt = message.generatedAt.toISOString();
|
|
2009
|
+
}
|
|
2010
|
+
return obj;
|
|
2011
|
+
},
|
|
2012
|
+
|
|
2013
|
+
create<I extends Exact<DeepPartial<MetricSeriesBucketUpdate>, I>>(base?: I): MetricSeriesBucketUpdate {
|
|
2014
|
+
return MetricSeriesBucketUpdate.fromPartial(base ?? ({} as any));
|
|
2015
|
+
},
|
|
2016
|
+
fromPartial<I extends Exact<DeepPartial<MetricSeriesBucketUpdate>, I>>(object: I): MetricSeriesBucketUpdate {
|
|
2017
|
+
const message = createBaseMetricSeriesBucketUpdate();
|
|
2018
|
+
message.groupKey = (globalThis.Object.entries(object.groupKey ?? {}) as [string, string][]).reduce(
|
|
2019
|
+
(acc: { [key: string]: string }, [key, value]: [string, string]) => {
|
|
2020
|
+
if (value !== undefined) {
|
|
2021
|
+
acc[key] = globalThis.String(value);
|
|
2022
|
+
}
|
|
2023
|
+
return acc;
|
|
2024
|
+
},
|
|
2025
|
+
{},
|
|
2026
|
+
);
|
|
2027
|
+
message.bucket = (object.bucket !== undefined && object.bucket !== null)
|
|
2028
|
+
? MetricBucket.fromPartial(object.bucket)
|
|
2029
|
+
: undefined;
|
|
2030
|
+
message.generatedAt = object.generatedAt ?? undefined;
|
|
2031
|
+
return message;
|
|
2032
|
+
},
|
|
2033
|
+
};
|
|
2034
|
+
|
|
2035
|
+
function createBaseMetricSeriesBucketUpdate_GroupKeyEntry(): MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
2036
|
+
return { key: "", value: "" };
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
export const MetricSeriesBucketUpdate_GroupKeyEntry: MessageFns<MetricSeriesBucketUpdate_GroupKeyEntry> = {
|
|
2040
|
+
encode(message: MetricSeriesBucketUpdate_GroupKeyEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
2041
|
+
if (message.key !== "") {
|
|
2042
|
+
writer.uint32(10).string(message.key);
|
|
2043
|
+
}
|
|
2044
|
+
if (message.value !== "") {
|
|
2045
|
+
writer.uint32(18).string(message.value);
|
|
2046
|
+
}
|
|
2047
|
+
return writer;
|
|
2048
|
+
},
|
|
2049
|
+
|
|
2050
|
+
decode(input: BinaryReader | Uint8Array, length?: number): MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
2051
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
2052
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
2053
|
+
const message = createBaseMetricSeriesBucketUpdate_GroupKeyEntry();
|
|
2054
|
+
while (reader.pos < end) {
|
|
2055
|
+
const tag = reader.uint32();
|
|
2056
|
+
switch (tag >>> 3) {
|
|
2057
|
+
case 1: {
|
|
2058
|
+
if (tag !== 10) {
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
message.key = reader.string();
|
|
2063
|
+
continue;
|
|
2064
|
+
}
|
|
2065
|
+
case 2: {
|
|
2066
|
+
if (tag !== 18) {
|
|
2067
|
+
break;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
message.value = reader.string();
|
|
2071
|
+
continue;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
2075
|
+
break;
|
|
2076
|
+
}
|
|
2077
|
+
reader.skip(tag & 7);
|
|
2078
|
+
}
|
|
2079
|
+
return message;
|
|
2080
|
+
},
|
|
2081
|
+
|
|
2082
|
+
fromJSON(object: any): MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
2083
|
+
return {
|
|
2084
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
2085
|
+
value: isSet(object.value) ? globalThis.String(object.value) : "",
|
|
2086
|
+
};
|
|
2087
|
+
},
|
|
2088
|
+
|
|
2089
|
+
toJSON(message: MetricSeriesBucketUpdate_GroupKeyEntry): unknown {
|
|
2090
|
+
const obj: any = {};
|
|
2091
|
+
if (message.key !== "") {
|
|
2092
|
+
obj.key = message.key;
|
|
2093
|
+
}
|
|
2094
|
+
if (message.value !== "") {
|
|
2095
|
+
obj.value = message.value;
|
|
2096
|
+
}
|
|
2097
|
+
return obj;
|
|
2098
|
+
},
|
|
2099
|
+
|
|
2100
|
+
create<I extends Exact<DeepPartial<MetricSeriesBucketUpdate_GroupKeyEntry>, I>>(
|
|
2101
|
+
base?: I,
|
|
2102
|
+
): MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
2103
|
+
return MetricSeriesBucketUpdate_GroupKeyEntry.fromPartial(base ?? ({} as any));
|
|
2104
|
+
},
|
|
2105
|
+
fromPartial<I extends Exact<DeepPartial<MetricSeriesBucketUpdate_GroupKeyEntry>, I>>(
|
|
2106
|
+
object: I,
|
|
2107
|
+
): MetricSeriesBucketUpdate_GroupKeyEntry {
|
|
2108
|
+
const message = createBaseMetricSeriesBucketUpdate_GroupKeyEntry();
|
|
2109
|
+
message.key = object.key ?? "";
|
|
2110
|
+
message.value = object.value ?? "";
|
|
2111
|
+
return message;
|
|
2112
|
+
},
|
|
2113
|
+
};
|
|
2114
|
+
|
|
2115
|
+
/**
|
|
2116
|
+
* TelemetryGatewayService is the web surface of telemetry.api.v1 — the types
|
|
2117
|
+
* are domain-isolated copies converted in gateways/internal/convert.
|
|
2118
|
+
*/
|
|
2119
|
+
export interface TelemetryGatewayService {
|
|
2120
|
+
ListMetrics(request: ListMetricsRequest, metadata?: Metadata): Promise<ListMetricsResponse>;
|
|
2121
|
+
ListMetricAttributes(
|
|
2122
|
+
request: ListMetricAttributesRequest,
|
|
2123
|
+
metadata?: Metadata,
|
|
2124
|
+
): Promise<ListMetricAttributesResponse>;
|
|
2125
|
+
QueryMetrics(request: QueryMetricsRequest, metadata?: Metadata): Promise<QueryMetricsResponse>;
|
|
2126
|
+
StreamMetricAnalytics(
|
|
2127
|
+
request: StreamMetricAnalyticsRequest,
|
|
2128
|
+
metadata?: Metadata,
|
|
2129
|
+
): Observable<MetricAnalyticsEnvelope>;
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
export const TelemetryGatewayServiceServiceName = "gateway.web.v1.TelemetryGatewayService";
|
|
2133
|
+
export class TelemetryGatewayServiceClientImpl implements TelemetryGatewayService {
|
|
2134
|
+
private readonly rpc: Rpc;
|
|
2135
|
+
private readonly service: string;
|
|
2136
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
2137
|
+
this.service = opts?.service || TelemetryGatewayServiceServiceName;
|
|
2138
|
+
this.rpc = rpc;
|
|
2139
|
+
this.ListMetrics = this.ListMetrics.bind(this);
|
|
2140
|
+
this.ListMetricAttributes = this.ListMetricAttributes.bind(this);
|
|
2141
|
+
this.QueryMetrics = this.QueryMetrics.bind(this);
|
|
2142
|
+
this.StreamMetricAnalytics = this.StreamMetricAnalytics.bind(this);
|
|
2143
|
+
}
|
|
2144
|
+
ListMetrics(request: ListMetricsRequest, metadata?: Metadata): Promise<ListMetricsResponse> {
|
|
2145
|
+
const data = ListMetricsRequest.encode(request).finish();
|
|
2146
|
+
const promise = this.rpc.request(this.service, "ListMetrics", data, metadata);
|
|
2147
|
+
return promise.then((data) => ListMetricsResponse.decode(new BinaryReader(data)));
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
ListMetricAttributes(
|
|
2151
|
+
request: ListMetricAttributesRequest,
|
|
2152
|
+
metadata?: Metadata,
|
|
2153
|
+
): Promise<ListMetricAttributesResponse> {
|
|
2154
|
+
const data = ListMetricAttributesRequest.encode(request).finish();
|
|
2155
|
+
const promise = this.rpc.request(this.service, "ListMetricAttributes", data, metadata);
|
|
2156
|
+
return promise.then((data) => ListMetricAttributesResponse.decode(new BinaryReader(data)));
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
QueryMetrics(request: QueryMetricsRequest, metadata?: Metadata): Promise<QueryMetricsResponse> {
|
|
2160
|
+
const data = QueryMetricsRequest.encode(request).finish();
|
|
2161
|
+
const promise = this.rpc.request(this.service, "QueryMetrics", data, metadata);
|
|
2162
|
+
return promise.then((data) => QueryMetricsResponse.decode(new BinaryReader(data)));
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
StreamMetricAnalytics(
|
|
2166
|
+
request: StreamMetricAnalyticsRequest,
|
|
2167
|
+
metadata?: Metadata,
|
|
2168
|
+
): Observable<MetricAnalyticsEnvelope> {
|
|
2169
|
+
const data = StreamMetricAnalyticsRequest.encode(request).finish();
|
|
2170
|
+
const result = this.rpc.serverStreamingRequest(this.service, "StreamMetricAnalytics", data, metadata);
|
|
2171
|
+
return result.pipe(map((data) => MetricAnalyticsEnvelope.decode(new BinaryReader(data))));
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
interface Rpc {
|
|
2176
|
+
request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
|
|
2177
|
+
clientStreamingRequest(
|
|
2178
|
+
service: string,
|
|
2179
|
+
method: string,
|
|
2180
|
+
data: Observable<Uint8Array>,
|
|
2181
|
+
metadata?: Metadata,
|
|
2182
|
+
): Promise<Uint8Array>;
|
|
2183
|
+
serverStreamingRequest(
|
|
2184
|
+
service: string,
|
|
2185
|
+
method: string,
|
|
2186
|
+
data: Uint8Array,
|
|
2187
|
+
metadata?: Metadata,
|
|
2188
|
+
): Observable<Uint8Array>;
|
|
2189
|
+
bidirectionalStreamingRequest(
|
|
2190
|
+
service: string,
|
|
2191
|
+
method: string,
|
|
2192
|
+
data: Observable<Uint8Array>,
|
|
2193
|
+
metadata?: Metadata,
|
|
2194
|
+
): Observable<Uint8Array>;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
2198
|
+
|
|
2199
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
2200
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
2201
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
2202
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
2203
|
+
: Partial<T>;
|
|
2204
|
+
|
|
2205
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
2206
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
2207
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
2208
|
+
|
|
2209
|
+
function toTimestamp(date: Date): Timestamp {
|
|
2210
|
+
const seconds = Math.trunc(date.getTime() / 1_000);
|
|
2211
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
2212
|
+
return { seconds, nanos };
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
2216
|
+
let millis = (t.seconds || 0) * 1_000;
|
|
2217
|
+
millis += (t.nanos || 0) / 1_000_000;
|
|
2218
|
+
return new globalThis.Date(millis);
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
function fromJsonTimestamp(o: any): Date {
|
|
2222
|
+
if (o instanceof globalThis.Date) {
|
|
2223
|
+
return o;
|
|
2224
|
+
} else if (typeof o === "string") {
|
|
2225
|
+
return new globalThis.Date(o);
|
|
2226
|
+
} else {
|
|
2227
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
function longToNumber(int64: { toString(): string }): number {
|
|
2232
|
+
const num = globalThis.Number(int64.toString());
|
|
2233
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
2234
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
2235
|
+
}
|
|
2236
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
2237
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
2238
|
+
}
|
|
2239
|
+
return num;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
function isObject(value: any): boolean {
|
|
2243
|
+
return typeof value === "object" && value !== null;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2246
|
+
function isSet(value: any): boolean {
|
|
2247
|
+
return value !== null && value !== undefined;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
export interface MessageFns<T> {
|
|
2251
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
2252
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
2253
|
+
fromJSON(object: any): T;
|
|
2254
|
+
toJSON(message: T): unknown;
|
|
2255
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
2256
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
2257
|
+
}
|