@miradorlabs/web-grpc 2.8.0 → 2.10.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.
@@ -0,0 +1,3122 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v3.21.12
5
+ // source: proto/gateway/web/v1/derived_metric_gateway.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { Metadata } from "@grpc/grpc-js";
10
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
11
+ import { ResponseStatus } from "../../common/v1/status";
12
+
13
+ export const protobufPackage = "gateway.web.v1";
14
+
15
+ export enum DerivedMetricOutcome {
16
+ DERIVED_METRIC_OUTCOME_UNSPECIFIED = 0,
17
+ DERIVED_METRIC_OUTCOME_EMITTED = 1,
18
+ DERIVED_METRIC_OUTCOME_OUT_OF_POPULATION = 2,
19
+ DERIVED_METRIC_OUTCOME_POPULATION_ERROR = 3,
20
+ DERIVED_METRIC_OUTCOME_VALUE_MISSING = 4,
21
+ DERIVED_METRIC_OUTCOME_VALUE_ERROR = 5,
22
+ DERIVED_METRIC_OUTCOME_VALUE_NON_FINITE = 6,
23
+ /** DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE - Event count exceeded the cap; never silently truncated. */
24
+ DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE = 7,
25
+ /**
26
+ * DERIVED_METRIC_OUTCOME_CANCELLED - Evaluation budget expired. Never emits: unlike an expression error it is not a property of the
27
+ * expression, so a replay could resolve differently and double-count the trace.
28
+ */
29
+ DERIVED_METRIC_OUTCOME_CANCELLED = 8,
30
+ /**
31
+ * DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE - A stored event payload did not decode, so the trace can never be evaluated. Reported rather than
32
+ * omitted, because omitting it would mimic the budget-truncation signal.
33
+ */
34
+ DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE = 9,
35
+ /**
36
+ * DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE - An integer result beyond 2^53, which the Float64 gauge column cannot hold exactly. Rejected rather
37
+ * than rounded: a wei-denominated amount passes 2^53 at roughly 0.01 ETH, and a silently rounded
38
+ * money figure is worse than no sample. Differences between wei-scale amounts are unaffected.
39
+ */
40
+ DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE = 10,
41
+ UNRECOGNIZED = -1,
42
+ }
43
+
44
+ export function derivedMetricOutcomeFromJSON(object: any): DerivedMetricOutcome {
45
+ switch (object) {
46
+ case 0:
47
+ case "DERIVED_METRIC_OUTCOME_UNSPECIFIED":
48
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_UNSPECIFIED;
49
+ case 1:
50
+ case "DERIVED_METRIC_OUTCOME_EMITTED":
51
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_EMITTED;
52
+ case 2:
53
+ case "DERIVED_METRIC_OUTCOME_OUT_OF_POPULATION":
54
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_OUT_OF_POPULATION;
55
+ case 3:
56
+ case "DERIVED_METRIC_OUTCOME_POPULATION_ERROR":
57
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_POPULATION_ERROR;
58
+ case 4:
59
+ case "DERIVED_METRIC_OUTCOME_VALUE_MISSING":
60
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_MISSING;
61
+ case 5:
62
+ case "DERIVED_METRIC_OUTCOME_VALUE_ERROR":
63
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_ERROR;
64
+ case 6:
65
+ case "DERIVED_METRIC_OUTCOME_VALUE_NON_FINITE":
66
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_NON_FINITE;
67
+ case 7:
68
+ case "DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE":
69
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE;
70
+ case 8:
71
+ case "DERIVED_METRIC_OUTCOME_CANCELLED":
72
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_CANCELLED;
73
+ case 9:
74
+ case "DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE":
75
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE;
76
+ case 10:
77
+ case "DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE":
78
+ return DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE;
79
+ case -1:
80
+ case "UNRECOGNIZED":
81
+ default:
82
+ return DerivedMetricOutcome.UNRECOGNIZED;
83
+ }
84
+ }
85
+
86
+ export function derivedMetricOutcomeToJSON(object: DerivedMetricOutcome): string {
87
+ switch (object) {
88
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_UNSPECIFIED:
89
+ return "DERIVED_METRIC_OUTCOME_UNSPECIFIED";
90
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_EMITTED:
91
+ return "DERIVED_METRIC_OUTCOME_EMITTED";
92
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_OUT_OF_POPULATION:
93
+ return "DERIVED_METRIC_OUTCOME_OUT_OF_POPULATION";
94
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_POPULATION_ERROR:
95
+ return "DERIVED_METRIC_OUTCOME_POPULATION_ERROR";
96
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_MISSING:
97
+ return "DERIVED_METRIC_OUTCOME_VALUE_MISSING";
98
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_ERROR:
99
+ return "DERIVED_METRIC_OUTCOME_VALUE_ERROR";
100
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_NON_FINITE:
101
+ return "DERIVED_METRIC_OUTCOME_VALUE_NON_FINITE";
102
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE:
103
+ return "DERIVED_METRIC_OUTCOME_TRACE_TOO_LARGE";
104
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_CANCELLED:
105
+ return "DERIVED_METRIC_OUTCOME_CANCELLED";
106
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE:
107
+ return "DERIVED_METRIC_OUTCOME_TRACE_UNREADABLE";
108
+ case DerivedMetricOutcome.DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE:
109
+ return "DERIVED_METRIC_OUTCOME_VALUE_OUT_OF_EXACT_RANGE";
110
+ case DerivedMetricOutcome.UNRECOGNIZED:
111
+ default:
112
+ return "UNRECOGNIZED";
113
+ }
114
+ }
115
+
116
+ export enum DerivedMetricAttributeType {
117
+ DERIVED_METRIC_ATTRIBUTE_TYPE_UNSPECIFIED = 0,
118
+ DERIVED_METRIC_ATTRIBUTE_TYPE_STRING = 1,
119
+ DERIVED_METRIC_ATTRIBUTE_TYPE_BOOL = 2,
120
+ DERIVED_METRIC_ATTRIBUTE_TYPE_INT = 3,
121
+ DERIVED_METRIC_ATTRIBUTE_TYPE_DOUBLE = 4,
122
+ /** DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED - The key was observed with more than one type across traces. */
123
+ DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED = 5,
124
+ UNRECOGNIZED = -1,
125
+ }
126
+
127
+ export function derivedMetricAttributeTypeFromJSON(object: any): DerivedMetricAttributeType {
128
+ switch (object) {
129
+ case 0:
130
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_UNSPECIFIED":
131
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_UNSPECIFIED;
132
+ case 1:
133
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_STRING":
134
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_STRING;
135
+ case 2:
136
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_BOOL":
137
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_BOOL;
138
+ case 3:
139
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_INT":
140
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_INT;
141
+ case 4:
142
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_DOUBLE":
143
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_DOUBLE;
144
+ case 5:
145
+ case "DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED":
146
+ return DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED;
147
+ case -1:
148
+ case "UNRECOGNIZED":
149
+ default:
150
+ return DerivedMetricAttributeType.UNRECOGNIZED;
151
+ }
152
+ }
153
+
154
+ export function derivedMetricAttributeTypeToJSON(object: DerivedMetricAttributeType): string {
155
+ switch (object) {
156
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_UNSPECIFIED:
157
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_UNSPECIFIED";
158
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_STRING:
159
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_STRING";
160
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_BOOL:
161
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_BOOL";
162
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_INT:
163
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_INT";
164
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_DOUBLE:
165
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_DOUBLE";
166
+ case DerivedMetricAttributeType.DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED:
167
+ return "DERIVED_METRIC_ATTRIBUTE_TYPE_MIXED";
168
+ case DerivedMetricAttributeType.UNRECOGNIZED:
169
+ default:
170
+ return "UNRECOGNIZED";
171
+ }
172
+ }
173
+
174
+ export interface DerivedMetric {
175
+ id: string;
176
+ organizationId: string;
177
+ projectId: string;
178
+ /** Never reusable within a project, including after deletion: it is the series identity. */
179
+ slug: string;
180
+ displayName: string;
181
+ description: string;
182
+ enabled: boolean;
183
+ /** The handle to pass to MetricGatewayService. */
184
+ metricName: string;
185
+ unit: string;
186
+ program: DerivedMetricProgram | undefined;
187
+ createdAt: Date | undefined;
188
+ updatedAt: Date | undefined;
189
+ }
190
+
191
+ export interface DerivedMetricProgram {
192
+ /**
193
+ * Selects which finished traces CONTRIBUTE -- eligibility, never success. A success condition here
194
+ * would emit only the good traces and leave any ratio over them at 100% forever. Immutable after
195
+ * create; empty matches every finished trace.
196
+ */
197
+ populationExpression: string;
198
+ /** Evaluates to a number, or to an empty optional meaning no sample. */
199
+ valueExpression: string;
200
+ /**
201
+ * Trace attribute keys stamped onto every emitted point, so any dashboard widget can group or
202
+ * filter by any of them at read time -- one measurement, many groupings. At most four (the read
203
+ * side resolves four group-by keys). Values render canonically; a missing attribute becomes the
204
+ * empty string, never a dropped sample. Immutable after create: changing dimensions rewrites
205
+ * every series identity.
206
+ */
207
+ dimensions: string[];
208
+ }
209
+
210
+ export interface CreateDerivedMetricRequest {
211
+ organizationId: string;
212
+ projectId: string;
213
+ slug: string;
214
+ displayName: string;
215
+ description: string;
216
+ enabled: boolean;
217
+ unit: string;
218
+ program: DerivedMetricProgram | undefined;
219
+ }
220
+
221
+ export interface CreateDerivedMetricResponse {
222
+ status: ResponseStatus | undefined;
223
+ derivedMetric: DerivedMetric | undefined;
224
+ }
225
+
226
+ export interface GetDerivedMetricRequest {
227
+ organizationId: string;
228
+ projectId: string;
229
+ derivedMetricId: string;
230
+ }
231
+
232
+ export interface GetDerivedMetricResponse {
233
+ status: ResponseStatus | undefined;
234
+ derivedMetric: DerivedMetric | undefined;
235
+ }
236
+
237
+ export interface ListDerivedMetricsRequest {
238
+ organizationId: string;
239
+ projectId: string;
240
+ }
241
+
242
+ export interface ListDerivedMetricsResponse {
243
+ status: ResponseStatus | undefined;
244
+ derivedMetrics: DerivedMetric[];
245
+ }
246
+
247
+ export interface UpdateDerivedMetricRequest {
248
+ organizationId: string;
249
+ projectId: string;
250
+ derivedMetricId: string;
251
+ updates: UpdateDerivedMetricRequest_DerivedMetricUpdates | undefined;
252
+ }
253
+
254
+ export interface UpdateDerivedMetricRequest_DerivedMetricUpdates {
255
+ displayName?: string | undefined;
256
+ description?:
257
+ | string
258
+ | undefined;
259
+ /**
260
+ * The measurement (population, value, dimensions, unit, slug) is immutable -- changing it
261
+ * means a new metric.
262
+ */
263
+ enabled?: boolean | undefined;
264
+ }
265
+
266
+ export interface UpdateDerivedMetricResponse {
267
+ status: ResponseStatus | undefined;
268
+ derivedMetric: DerivedMetric | undefined;
269
+ }
270
+
271
+ export interface DeleteDerivedMetricRequest {
272
+ organizationId: string;
273
+ projectId: string;
274
+ derivedMetricId: string;
275
+ }
276
+
277
+ export interface DeleteDerivedMetricResponse {
278
+ status: ResponseStatus | undefined;
279
+ }
280
+
281
+ export interface DryRunDerivedMetricRequest {
282
+ organizationId: string;
283
+ projectId: string;
284
+ program: DerivedMetricProgram | undefined;
285
+ traceLimit: number;
286
+ }
287
+
288
+ export interface DryRunDerivedMetricResponse {
289
+ status:
290
+ | ResponseStatus
291
+ | undefined;
292
+ /**
293
+ * One result per trace evaluated. Fewer than traces_selected means the request budget cut the
294
+ * replay short.
295
+ */
296
+ traceResults: DryRunTraceResult[];
297
+ outcomeCounts: DerivedMetricOutcomeCount[];
298
+ /**
299
+ * Traces the server chose to replay. Equal to trace_results when the whole sample was evaluated,
300
+ * so the author can tell a thin sample (the project has few finished traces) from a truncated one.
301
+ */
302
+ tracesSelected: number;
303
+ }
304
+
305
+ export interface DryRunTraceResult {
306
+ traceId: string;
307
+ emitted?: DryRunEmission | undefined;
308
+ notEmitted?: DryRunNonEmission | undefined;
309
+ }
310
+
311
+ export interface DryRunEmission {
312
+ value: number;
313
+ /**
314
+ * Exactly one entry per declared dimension, rendered and truncated precisely as the persisted
315
+ * point attribute would be -- the preview must never disagree with the stored series.
316
+ */
317
+ resolvedDimensions: { [key: string]: string };
318
+ }
319
+
320
+ export interface DryRunEmission_ResolvedDimensionsEntry {
321
+ key: string;
322
+ value: string;
323
+ }
324
+
325
+ export interface DryRunNonEmission {
326
+ outcome: DerivedMetricOutcome;
327
+ /** Opaque diagnostic text; clients must not parse it. */
328
+ detail: string;
329
+ }
330
+
331
+ export interface DerivedMetricOutcomeCount {
332
+ outcome: DerivedMetricOutcome;
333
+ count: number;
334
+ }
335
+
336
+ export interface ListDerivedMetricAttributesRequest {
337
+ organizationId: string;
338
+ projectId: string;
339
+ }
340
+
341
+ export interface ListDerivedMetricAttributesResponse {
342
+ status:
343
+ | ResponseStatus
344
+ | undefined;
345
+ /** Trace-level attributes: usable as dimensions, population filters, or trace-attribute operands. */
346
+ traceAttributes: DerivedMetricAttribute[];
347
+ /** Events observed on recent traces, each with the attribute keys seen on that event name. */
348
+ events: DerivedMetricEventAttributes[];
349
+ /**
350
+ * Finished traces the walk covered (oversized/unreadable histories count -- permanent skips are
351
+ * not truncation). traces_sampled < traces_selected means the request budget expired mid-walk and
352
+ * the catalog is a truncated sample a retry can improve on, same contract as the dry run.
353
+ */
354
+ tracesSampled: number;
355
+ /** Finished traces the walk selected; zero means the project has no history yet. */
356
+ tracesSelected: number;
357
+ /**
358
+ * True when an output cap (distinct event names or total keys) dropped entries -- the catalog is
359
+ * complete for what it lists, but more keys exist than fit in one response.
360
+ */
361
+ catalogCapped: boolean;
362
+ }
363
+
364
+ export interface DerivedMetricAttribute {
365
+ key: string;
366
+ /** The stored type, from the typed attribute payloads -- not inferred from rendered strings. */
367
+ type: DerivedMetricAttributeType;
368
+ /** A few observed values, rendered canonically. Never exhaustive. */
369
+ sampleValues: string[];
370
+ }
371
+
372
+ export interface DerivedMetricEventAttributes {
373
+ /** The event's author-facing name; only info/warn/error events carry one. */
374
+ name: string;
375
+ attributes: DerivedMetricAttribute[];
376
+ }
377
+
378
+ function createBaseDerivedMetric(): DerivedMetric {
379
+ return {
380
+ id: "",
381
+ organizationId: "",
382
+ projectId: "",
383
+ slug: "",
384
+ displayName: "",
385
+ description: "",
386
+ enabled: false,
387
+ metricName: "",
388
+ unit: "",
389
+ program: undefined,
390
+ createdAt: undefined,
391
+ updatedAt: undefined,
392
+ };
393
+ }
394
+
395
+ export const DerivedMetric: MessageFns<DerivedMetric> = {
396
+ encode(message: DerivedMetric, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
397
+ if (message.id !== "") {
398
+ writer.uint32(10).string(message.id);
399
+ }
400
+ if (message.organizationId !== "") {
401
+ writer.uint32(18).string(message.organizationId);
402
+ }
403
+ if (message.projectId !== "") {
404
+ writer.uint32(26).string(message.projectId);
405
+ }
406
+ if (message.slug !== "") {
407
+ writer.uint32(34).string(message.slug);
408
+ }
409
+ if (message.displayName !== "") {
410
+ writer.uint32(42).string(message.displayName);
411
+ }
412
+ if (message.description !== "") {
413
+ writer.uint32(50).string(message.description);
414
+ }
415
+ if (message.enabled !== false) {
416
+ writer.uint32(56).bool(message.enabled);
417
+ }
418
+ if (message.metricName !== "") {
419
+ writer.uint32(66).string(message.metricName);
420
+ }
421
+ if (message.unit !== "") {
422
+ writer.uint32(74).string(message.unit);
423
+ }
424
+ if (message.program !== undefined) {
425
+ DerivedMetricProgram.encode(message.program, writer.uint32(82).fork()).join();
426
+ }
427
+ if (message.createdAt !== undefined) {
428
+ Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(90).fork()).join();
429
+ }
430
+ if (message.updatedAt !== undefined) {
431
+ Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(98).fork()).join();
432
+ }
433
+ return writer;
434
+ },
435
+
436
+ decode(input: BinaryReader | Uint8Array, length?: number): DerivedMetric {
437
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
438
+ const end = length === undefined ? reader.len : reader.pos + length;
439
+ const message = createBaseDerivedMetric();
440
+ while (reader.pos < end) {
441
+ const tag = reader.uint32();
442
+ switch (tag >>> 3) {
443
+ case 1: {
444
+ if (tag !== 10) {
445
+ break;
446
+ }
447
+
448
+ message.id = reader.string();
449
+ continue;
450
+ }
451
+ case 2: {
452
+ if (tag !== 18) {
453
+ break;
454
+ }
455
+
456
+ message.organizationId = reader.string();
457
+ continue;
458
+ }
459
+ case 3: {
460
+ if (tag !== 26) {
461
+ break;
462
+ }
463
+
464
+ message.projectId = reader.string();
465
+ continue;
466
+ }
467
+ case 4: {
468
+ if (tag !== 34) {
469
+ break;
470
+ }
471
+
472
+ message.slug = reader.string();
473
+ continue;
474
+ }
475
+ case 5: {
476
+ if (tag !== 42) {
477
+ break;
478
+ }
479
+
480
+ message.displayName = reader.string();
481
+ continue;
482
+ }
483
+ case 6: {
484
+ if (tag !== 50) {
485
+ break;
486
+ }
487
+
488
+ message.description = reader.string();
489
+ continue;
490
+ }
491
+ case 7: {
492
+ if (tag !== 56) {
493
+ break;
494
+ }
495
+
496
+ message.enabled = reader.bool();
497
+ continue;
498
+ }
499
+ case 8: {
500
+ if (tag !== 66) {
501
+ break;
502
+ }
503
+
504
+ message.metricName = reader.string();
505
+ continue;
506
+ }
507
+ case 9: {
508
+ if (tag !== 74) {
509
+ break;
510
+ }
511
+
512
+ message.unit = reader.string();
513
+ continue;
514
+ }
515
+ case 10: {
516
+ if (tag !== 82) {
517
+ break;
518
+ }
519
+
520
+ message.program = DerivedMetricProgram.decode(reader, reader.uint32());
521
+ continue;
522
+ }
523
+ case 11: {
524
+ if (tag !== 90) {
525
+ break;
526
+ }
527
+
528
+ message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
529
+ continue;
530
+ }
531
+ case 12: {
532
+ if (tag !== 98) {
533
+ break;
534
+ }
535
+
536
+ message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
537
+ continue;
538
+ }
539
+ }
540
+ if ((tag & 7) === 4 || tag === 0) {
541
+ break;
542
+ }
543
+ reader.skip(tag & 7);
544
+ }
545
+ return message;
546
+ },
547
+
548
+ fromJSON(object: any): DerivedMetric {
549
+ return {
550
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
551
+ organizationId: isSet(object.organizationId)
552
+ ? globalThis.String(object.organizationId)
553
+ : isSet(object.organization_id)
554
+ ? globalThis.String(object.organization_id)
555
+ : "",
556
+ projectId: isSet(object.projectId)
557
+ ? globalThis.String(object.projectId)
558
+ : isSet(object.project_id)
559
+ ? globalThis.String(object.project_id)
560
+ : "",
561
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
562
+ displayName: isSet(object.displayName)
563
+ ? globalThis.String(object.displayName)
564
+ : isSet(object.display_name)
565
+ ? globalThis.String(object.display_name)
566
+ : "",
567
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
568
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
569
+ metricName: isSet(object.metricName)
570
+ ? globalThis.String(object.metricName)
571
+ : isSet(object.metric_name)
572
+ ? globalThis.String(object.metric_name)
573
+ : "",
574
+ unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
575
+ program: isSet(object.program) ? DerivedMetricProgram.fromJSON(object.program) : undefined,
576
+ createdAt: isSet(object.createdAt)
577
+ ? fromJsonTimestamp(object.createdAt)
578
+ : isSet(object.created_at)
579
+ ? fromJsonTimestamp(object.created_at)
580
+ : undefined,
581
+ updatedAt: isSet(object.updatedAt)
582
+ ? fromJsonTimestamp(object.updatedAt)
583
+ : isSet(object.updated_at)
584
+ ? fromJsonTimestamp(object.updated_at)
585
+ : undefined,
586
+ };
587
+ },
588
+
589
+ toJSON(message: DerivedMetric): unknown {
590
+ const obj: any = {};
591
+ if (message.id !== "") {
592
+ obj.id = message.id;
593
+ }
594
+ if (message.organizationId !== "") {
595
+ obj.organizationId = message.organizationId;
596
+ }
597
+ if (message.projectId !== "") {
598
+ obj.projectId = message.projectId;
599
+ }
600
+ if (message.slug !== "") {
601
+ obj.slug = message.slug;
602
+ }
603
+ if (message.displayName !== "") {
604
+ obj.displayName = message.displayName;
605
+ }
606
+ if (message.description !== "") {
607
+ obj.description = message.description;
608
+ }
609
+ if (message.enabled !== false) {
610
+ obj.enabled = message.enabled;
611
+ }
612
+ if (message.metricName !== "") {
613
+ obj.metricName = message.metricName;
614
+ }
615
+ if (message.unit !== "") {
616
+ obj.unit = message.unit;
617
+ }
618
+ if (message.program !== undefined) {
619
+ obj.program = DerivedMetricProgram.toJSON(message.program);
620
+ }
621
+ if (message.createdAt !== undefined) {
622
+ obj.createdAt = message.createdAt.toISOString();
623
+ }
624
+ if (message.updatedAt !== undefined) {
625
+ obj.updatedAt = message.updatedAt.toISOString();
626
+ }
627
+ return obj;
628
+ },
629
+
630
+ create<I extends Exact<DeepPartial<DerivedMetric>, I>>(base?: I): DerivedMetric {
631
+ return DerivedMetric.fromPartial(base ?? ({} as any));
632
+ },
633
+ fromPartial<I extends Exact<DeepPartial<DerivedMetric>, I>>(object: I): DerivedMetric {
634
+ const message = createBaseDerivedMetric();
635
+ message.id = object.id ?? "";
636
+ message.organizationId = object.organizationId ?? "";
637
+ message.projectId = object.projectId ?? "";
638
+ message.slug = object.slug ?? "";
639
+ message.displayName = object.displayName ?? "";
640
+ message.description = object.description ?? "";
641
+ message.enabled = object.enabled ?? false;
642
+ message.metricName = object.metricName ?? "";
643
+ message.unit = object.unit ?? "";
644
+ message.program = (object.program !== undefined && object.program !== null)
645
+ ? DerivedMetricProgram.fromPartial(object.program)
646
+ : undefined;
647
+ message.createdAt = object.createdAt ?? undefined;
648
+ message.updatedAt = object.updatedAt ?? undefined;
649
+ return message;
650
+ },
651
+ };
652
+
653
+ function createBaseDerivedMetricProgram(): DerivedMetricProgram {
654
+ return { populationExpression: "", valueExpression: "", dimensions: [] };
655
+ }
656
+
657
+ export const DerivedMetricProgram: MessageFns<DerivedMetricProgram> = {
658
+ encode(message: DerivedMetricProgram, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
659
+ if (message.populationExpression !== "") {
660
+ writer.uint32(10).string(message.populationExpression);
661
+ }
662
+ if (message.valueExpression !== "") {
663
+ writer.uint32(18).string(message.valueExpression);
664
+ }
665
+ for (const v of message.dimensions) {
666
+ writer.uint32(34).string(v!);
667
+ }
668
+ return writer;
669
+ },
670
+
671
+ decode(input: BinaryReader | Uint8Array, length?: number): DerivedMetricProgram {
672
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
673
+ const end = length === undefined ? reader.len : reader.pos + length;
674
+ const message = createBaseDerivedMetricProgram();
675
+ while (reader.pos < end) {
676
+ const tag = reader.uint32();
677
+ switch (tag >>> 3) {
678
+ case 1: {
679
+ if (tag !== 10) {
680
+ break;
681
+ }
682
+
683
+ message.populationExpression = reader.string();
684
+ continue;
685
+ }
686
+ case 2: {
687
+ if (tag !== 18) {
688
+ break;
689
+ }
690
+
691
+ message.valueExpression = reader.string();
692
+ continue;
693
+ }
694
+ case 4: {
695
+ if (tag !== 34) {
696
+ break;
697
+ }
698
+
699
+ message.dimensions.push(reader.string());
700
+ continue;
701
+ }
702
+ }
703
+ if ((tag & 7) === 4 || tag === 0) {
704
+ break;
705
+ }
706
+ reader.skip(tag & 7);
707
+ }
708
+ return message;
709
+ },
710
+
711
+ fromJSON(object: any): DerivedMetricProgram {
712
+ return {
713
+ populationExpression: isSet(object.populationExpression)
714
+ ? globalThis.String(object.populationExpression)
715
+ : isSet(object.population_expression)
716
+ ? globalThis.String(object.population_expression)
717
+ : "",
718
+ valueExpression: isSet(object.valueExpression)
719
+ ? globalThis.String(object.valueExpression)
720
+ : isSet(object.value_expression)
721
+ ? globalThis.String(object.value_expression)
722
+ : "",
723
+ dimensions: globalThis.Array.isArray(object?.dimensions)
724
+ ? object.dimensions.map((e: any) => globalThis.String(e))
725
+ : [],
726
+ };
727
+ },
728
+
729
+ toJSON(message: DerivedMetricProgram): unknown {
730
+ const obj: any = {};
731
+ if (message.populationExpression !== "") {
732
+ obj.populationExpression = message.populationExpression;
733
+ }
734
+ if (message.valueExpression !== "") {
735
+ obj.valueExpression = message.valueExpression;
736
+ }
737
+ if (message.dimensions?.length) {
738
+ obj.dimensions = message.dimensions;
739
+ }
740
+ return obj;
741
+ },
742
+
743
+ create<I extends Exact<DeepPartial<DerivedMetricProgram>, I>>(base?: I): DerivedMetricProgram {
744
+ return DerivedMetricProgram.fromPartial(base ?? ({} as any));
745
+ },
746
+ fromPartial<I extends Exact<DeepPartial<DerivedMetricProgram>, I>>(object: I): DerivedMetricProgram {
747
+ const message = createBaseDerivedMetricProgram();
748
+ message.populationExpression = object.populationExpression ?? "";
749
+ message.valueExpression = object.valueExpression ?? "";
750
+ message.dimensions = object.dimensions?.map((e) => e) || [];
751
+ return message;
752
+ },
753
+ };
754
+
755
+ function createBaseCreateDerivedMetricRequest(): CreateDerivedMetricRequest {
756
+ return {
757
+ organizationId: "",
758
+ projectId: "",
759
+ slug: "",
760
+ displayName: "",
761
+ description: "",
762
+ enabled: false,
763
+ unit: "",
764
+ program: undefined,
765
+ };
766
+ }
767
+
768
+ export const CreateDerivedMetricRequest: MessageFns<CreateDerivedMetricRequest> = {
769
+ encode(message: CreateDerivedMetricRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
770
+ if (message.organizationId !== "") {
771
+ writer.uint32(10).string(message.organizationId);
772
+ }
773
+ if (message.projectId !== "") {
774
+ writer.uint32(18).string(message.projectId);
775
+ }
776
+ if (message.slug !== "") {
777
+ writer.uint32(26).string(message.slug);
778
+ }
779
+ if (message.displayName !== "") {
780
+ writer.uint32(34).string(message.displayName);
781
+ }
782
+ if (message.description !== "") {
783
+ writer.uint32(42).string(message.description);
784
+ }
785
+ if (message.enabled !== false) {
786
+ writer.uint32(48).bool(message.enabled);
787
+ }
788
+ if (message.unit !== "") {
789
+ writer.uint32(58).string(message.unit);
790
+ }
791
+ if (message.program !== undefined) {
792
+ DerivedMetricProgram.encode(message.program, writer.uint32(66).fork()).join();
793
+ }
794
+ return writer;
795
+ },
796
+
797
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateDerivedMetricRequest {
798
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
799
+ const end = length === undefined ? reader.len : reader.pos + length;
800
+ const message = createBaseCreateDerivedMetricRequest();
801
+ while (reader.pos < end) {
802
+ const tag = reader.uint32();
803
+ switch (tag >>> 3) {
804
+ case 1: {
805
+ if (tag !== 10) {
806
+ break;
807
+ }
808
+
809
+ message.organizationId = reader.string();
810
+ continue;
811
+ }
812
+ case 2: {
813
+ if (tag !== 18) {
814
+ break;
815
+ }
816
+
817
+ message.projectId = reader.string();
818
+ continue;
819
+ }
820
+ case 3: {
821
+ if (tag !== 26) {
822
+ break;
823
+ }
824
+
825
+ message.slug = reader.string();
826
+ continue;
827
+ }
828
+ case 4: {
829
+ if (tag !== 34) {
830
+ break;
831
+ }
832
+
833
+ message.displayName = reader.string();
834
+ continue;
835
+ }
836
+ case 5: {
837
+ if (tag !== 42) {
838
+ break;
839
+ }
840
+
841
+ message.description = reader.string();
842
+ continue;
843
+ }
844
+ case 6: {
845
+ if (tag !== 48) {
846
+ break;
847
+ }
848
+
849
+ message.enabled = reader.bool();
850
+ continue;
851
+ }
852
+ case 7: {
853
+ if (tag !== 58) {
854
+ break;
855
+ }
856
+
857
+ message.unit = reader.string();
858
+ continue;
859
+ }
860
+ case 8: {
861
+ if (tag !== 66) {
862
+ break;
863
+ }
864
+
865
+ message.program = DerivedMetricProgram.decode(reader, reader.uint32());
866
+ continue;
867
+ }
868
+ }
869
+ if ((tag & 7) === 4 || tag === 0) {
870
+ break;
871
+ }
872
+ reader.skip(tag & 7);
873
+ }
874
+ return message;
875
+ },
876
+
877
+ fromJSON(object: any): CreateDerivedMetricRequest {
878
+ return {
879
+ organizationId: isSet(object.organizationId)
880
+ ? globalThis.String(object.organizationId)
881
+ : isSet(object.organization_id)
882
+ ? globalThis.String(object.organization_id)
883
+ : "",
884
+ projectId: isSet(object.projectId)
885
+ ? globalThis.String(object.projectId)
886
+ : isSet(object.project_id)
887
+ ? globalThis.String(object.project_id)
888
+ : "",
889
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
890
+ displayName: isSet(object.displayName)
891
+ ? globalThis.String(object.displayName)
892
+ : isSet(object.display_name)
893
+ ? globalThis.String(object.display_name)
894
+ : "",
895
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
896
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false,
897
+ unit: isSet(object.unit) ? globalThis.String(object.unit) : "",
898
+ program: isSet(object.program) ? DerivedMetricProgram.fromJSON(object.program) : undefined,
899
+ };
900
+ },
901
+
902
+ toJSON(message: CreateDerivedMetricRequest): unknown {
903
+ const obj: any = {};
904
+ if (message.organizationId !== "") {
905
+ obj.organizationId = message.organizationId;
906
+ }
907
+ if (message.projectId !== "") {
908
+ obj.projectId = message.projectId;
909
+ }
910
+ if (message.slug !== "") {
911
+ obj.slug = message.slug;
912
+ }
913
+ if (message.displayName !== "") {
914
+ obj.displayName = message.displayName;
915
+ }
916
+ if (message.description !== "") {
917
+ obj.description = message.description;
918
+ }
919
+ if (message.enabled !== false) {
920
+ obj.enabled = message.enabled;
921
+ }
922
+ if (message.unit !== "") {
923
+ obj.unit = message.unit;
924
+ }
925
+ if (message.program !== undefined) {
926
+ obj.program = DerivedMetricProgram.toJSON(message.program);
927
+ }
928
+ return obj;
929
+ },
930
+
931
+ create<I extends Exact<DeepPartial<CreateDerivedMetricRequest>, I>>(base?: I): CreateDerivedMetricRequest {
932
+ return CreateDerivedMetricRequest.fromPartial(base ?? ({} as any));
933
+ },
934
+ fromPartial<I extends Exact<DeepPartial<CreateDerivedMetricRequest>, I>>(object: I): CreateDerivedMetricRequest {
935
+ const message = createBaseCreateDerivedMetricRequest();
936
+ message.organizationId = object.organizationId ?? "";
937
+ message.projectId = object.projectId ?? "";
938
+ message.slug = object.slug ?? "";
939
+ message.displayName = object.displayName ?? "";
940
+ message.description = object.description ?? "";
941
+ message.enabled = object.enabled ?? false;
942
+ message.unit = object.unit ?? "";
943
+ message.program = (object.program !== undefined && object.program !== null)
944
+ ? DerivedMetricProgram.fromPartial(object.program)
945
+ : undefined;
946
+ return message;
947
+ },
948
+ };
949
+
950
+ function createBaseCreateDerivedMetricResponse(): CreateDerivedMetricResponse {
951
+ return { status: undefined, derivedMetric: undefined };
952
+ }
953
+
954
+ export const CreateDerivedMetricResponse: MessageFns<CreateDerivedMetricResponse> = {
955
+ encode(message: CreateDerivedMetricResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
956
+ if (message.status !== undefined) {
957
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
958
+ }
959
+ if (message.derivedMetric !== undefined) {
960
+ DerivedMetric.encode(message.derivedMetric, writer.uint32(18).fork()).join();
961
+ }
962
+ return writer;
963
+ },
964
+
965
+ decode(input: BinaryReader | Uint8Array, length?: number): CreateDerivedMetricResponse {
966
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
967
+ const end = length === undefined ? reader.len : reader.pos + length;
968
+ const message = createBaseCreateDerivedMetricResponse();
969
+ while (reader.pos < end) {
970
+ const tag = reader.uint32();
971
+ switch (tag >>> 3) {
972
+ case 1: {
973
+ if (tag !== 10) {
974
+ break;
975
+ }
976
+
977
+ message.status = ResponseStatus.decode(reader, reader.uint32());
978
+ continue;
979
+ }
980
+ case 2: {
981
+ if (tag !== 18) {
982
+ break;
983
+ }
984
+
985
+ message.derivedMetric = DerivedMetric.decode(reader, reader.uint32());
986
+ continue;
987
+ }
988
+ }
989
+ if ((tag & 7) === 4 || tag === 0) {
990
+ break;
991
+ }
992
+ reader.skip(tag & 7);
993
+ }
994
+ return message;
995
+ },
996
+
997
+ fromJSON(object: any): CreateDerivedMetricResponse {
998
+ return {
999
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1000
+ derivedMetric: isSet(object.derivedMetric)
1001
+ ? DerivedMetric.fromJSON(object.derivedMetric)
1002
+ : isSet(object.derived_metric)
1003
+ ? DerivedMetric.fromJSON(object.derived_metric)
1004
+ : undefined,
1005
+ };
1006
+ },
1007
+
1008
+ toJSON(message: CreateDerivedMetricResponse): unknown {
1009
+ const obj: any = {};
1010
+ if (message.status !== undefined) {
1011
+ obj.status = ResponseStatus.toJSON(message.status);
1012
+ }
1013
+ if (message.derivedMetric !== undefined) {
1014
+ obj.derivedMetric = DerivedMetric.toJSON(message.derivedMetric);
1015
+ }
1016
+ return obj;
1017
+ },
1018
+
1019
+ create<I extends Exact<DeepPartial<CreateDerivedMetricResponse>, I>>(base?: I): CreateDerivedMetricResponse {
1020
+ return CreateDerivedMetricResponse.fromPartial(base ?? ({} as any));
1021
+ },
1022
+ fromPartial<I extends Exact<DeepPartial<CreateDerivedMetricResponse>, I>>(object: I): CreateDerivedMetricResponse {
1023
+ const message = createBaseCreateDerivedMetricResponse();
1024
+ message.status = (object.status !== undefined && object.status !== null)
1025
+ ? ResponseStatus.fromPartial(object.status)
1026
+ : undefined;
1027
+ message.derivedMetric = (object.derivedMetric !== undefined && object.derivedMetric !== null)
1028
+ ? DerivedMetric.fromPartial(object.derivedMetric)
1029
+ : undefined;
1030
+ return message;
1031
+ },
1032
+ };
1033
+
1034
+ function createBaseGetDerivedMetricRequest(): GetDerivedMetricRequest {
1035
+ return { organizationId: "", projectId: "", derivedMetricId: "" };
1036
+ }
1037
+
1038
+ export const GetDerivedMetricRequest: MessageFns<GetDerivedMetricRequest> = {
1039
+ encode(message: GetDerivedMetricRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1040
+ if (message.organizationId !== "") {
1041
+ writer.uint32(10).string(message.organizationId);
1042
+ }
1043
+ if (message.projectId !== "") {
1044
+ writer.uint32(18).string(message.projectId);
1045
+ }
1046
+ if (message.derivedMetricId !== "") {
1047
+ writer.uint32(26).string(message.derivedMetricId);
1048
+ }
1049
+ return writer;
1050
+ },
1051
+
1052
+ decode(input: BinaryReader | Uint8Array, length?: number): GetDerivedMetricRequest {
1053
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1054
+ const end = length === undefined ? reader.len : reader.pos + length;
1055
+ const message = createBaseGetDerivedMetricRequest();
1056
+ while (reader.pos < end) {
1057
+ const tag = reader.uint32();
1058
+ switch (tag >>> 3) {
1059
+ case 1: {
1060
+ if (tag !== 10) {
1061
+ break;
1062
+ }
1063
+
1064
+ message.organizationId = reader.string();
1065
+ continue;
1066
+ }
1067
+ case 2: {
1068
+ if (tag !== 18) {
1069
+ break;
1070
+ }
1071
+
1072
+ message.projectId = reader.string();
1073
+ continue;
1074
+ }
1075
+ case 3: {
1076
+ if (tag !== 26) {
1077
+ break;
1078
+ }
1079
+
1080
+ message.derivedMetricId = reader.string();
1081
+ continue;
1082
+ }
1083
+ }
1084
+ if ((tag & 7) === 4 || tag === 0) {
1085
+ break;
1086
+ }
1087
+ reader.skip(tag & 7);
1088
+ }
1089
+ return message;
1090
+ },
1091
+
1092
+ fromJSON(object: any): GetDerivedMetricRequest {
1093
+ return {
1094
+ organizationId: isSet(object.organizationId)
1095
+ ? globalThis.String(object.organizationId)
1096
+ : isSet(object.organization_id)
1097
+ ? globalThis.String(object.organization_id)
1098
+ : "",
1099
+ projectId: isSet(object.projectId)
1100
+ ? globalThis.String(object.projectId)
1101
+ : isSet(object.project_id)
1102
+ ? globalThis.String(object.project_id)
1103
+ : "",
1104
+ derivedMetricId: isSet(object.derivedMetricId)
1105
+ ? globalThis.String(object.derivedMetricId)
1106
+ : isSet(object.derived_metric_id)
1107
+ ? globalThis.String(object.derived_metric_id)
1108
+ : "",
1109
+ };
1110
+ },
1111
+
1112
+ toJSON(message: GetDerivedMetricRequest): unknown {
1113
+ const obj: any = {};
1114
+ if (message.organizationId !== "") {
1115
+ obj.organizationId = message.organizationId;
1116
+ }
1117
+ if (message.projectId !== "") {
1118
+ obj.projectId = message.projectId;
1119
+ }
1120
+ if (message.derivedMetricId !== "") {
1121
+ obj.derivedMetricId = message.derivedMetricId;
1122
+ }
1123
+ return obj;
1124
+ },
1125
+
1126
+ create<I extends Exact<DeepPartial<GetDerivedMetricRequest>, I>>(base?: I): GetDerivedMetricRequest {
1127
+ return GetDerivedMetricRequest.fromPartial(base ?? ({} as any));
1128
+ },
1129
+ fromPartial<I extends Exact<DeepPartial<GetDerivedMetricRequest>, I>>(object: I): GetDerivedMetricRequest {
1130
+ const message = createBaseGetDerivedMetricRequest();
1131
+ message.organizationId = object.organizationId ?? "";
1132
+ message.projectId = object.projectId ?? "";
1133
+ message.derivedMetricId = object.derivedMetricId ?? "";
1134
+ return message;
1135
+ },
1136
+ };
1137
+
1138
+ function createBaseGetDerivedMetricResponse(): GetDerivedMetricResponse {
1139
+ return { status: undefined, derivedMetric: undefined };
1140
+ }
1141
+
1142
+ export const GetDerivedMetricResponse: MessageFns<GetDerivedMetricResponse> = {
1143
+ encode(message: GetDerivedMetricResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1144
+ if (message.status !== undefined) {
1145
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1146
+ }
1147
+ if (message.derivedMetric !== undefined) {
1148
+ DerivedMetric.encode(message.derivedMetric, writer.uint32(18).fork()).join();
1149
+ }
1150
+ return writer;
1151
+ },
1152
+
1153
+ decode(input: BinaryReader | Uint8Array, length?: number): GetDerivedMetricResponse {
1154
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1155
+ const end = length === undefined ? reader.len : reader.pos + length;
1156
+ const message = createBaseGetDerivedMetricResponse();
1157
+ while (reader.pos < end) {
1158
+ const tag = reader.uint32();
1159
+ switch (tag >>> 3) {
1160
+ case 1: {
1161
+ if (tag !== 10) {
1162
+ break;
1163
+ }
1164
+
1165
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1166
+ continue;
1167
+ }
1168
+ case 2: {
1169
+ if (tag !== 18) {
1170
+ break;
1171
+ }
1172
+
1173
+ message.derivedMetric = DerivedMetric.decode(reader, reader.uint32());
1174
+ continue;
1175
+ }
1176
+ }
1177
+ if ((tag & 7) === 4 || tag === 0) {
1178
+ break;
1179
+ }
1180
+ reader.skip(tag & 7);
1181
+ }
1182
+ return message;
1183
+ },
1184
+
1185
+ fromJSON(object: any): GetDerivedMetricResponse {
1186
+ return {
1187
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1188
+ derivedMetric: isSet(object.derivedMetric)
1189
+ ? DerivedMetric.fromJSON(object.derivedMetric)
1190
+ : isSet(object.derived_metric)
1191
+ ? DerivedMetric.fromJSON(object.derived_metric)
1192
+ : undefined,
1193
+ };
1194
+ },
1195
+
1196
+ toJSON(message: GetDerivedMetricResponse): unknown {
1197
+ const obj: any = {};
1198
+ if (message.status !== undefined) {
1199
+ obj.status = ResponseStatus.toJSON(message.status);
1200
+ }
1201
+ if (message.derivedMetric !== undefined) {
1202
+ obj.derivedMetric = DerivedMetric.toJSON(message.derivedMetric);
1203
+ }
1204
+ return obj;
1205
+ },
1206
+
1207
+ create<I extends Exact<DeepPartial<GetDerivedMetricResponse>, I>>(base?: I): GetDerivedMetricResponse {
1208
+ return GetDerivedMetricResponse.fromPartial(base ?? ({} as any));
1209
+ },
1210
+ fromPartial<I extends Exact<DeepPartial<GetDerivedMetricResponse>, I>>(object: I): GetDerivedMetricResponse {
1211
+ const message = createBaseGetDerivedMetricResponse();
1212
+ message.status = (object.status !== undefined && object.status !== null)
1213
+ ? ResponseStatus.fromPartial(object.status)
1214
+ : undefined;
1215
+ message.derivedMetric = (object.derivedMetric !== undefined && object.derivedMetric !== null)
1216
+ ? DerivedMetric.fromPartial(object.derivedMetric)
1217
+ : undefined;
1218
+ return message;
1219
+ },
1220
+ };
1221
+
1222
+ function createBaseListDerivedMetricsRequest(): ListDerivedMetricsRequest {
1223
+ return { organizationId: "", projectId: "" };
1224
+ }
1225
+
1226
+ export const ListDerivedMetricsRequest: MessageFns<ListDerivedMetricsRequest> = {
1227
+ encode(message: ListDerivedMetricsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1228
+ if (message.organizationId !== "") {
1229
+ writer.uint32(10).string(message.organizationId);
1230
+ }
1231
+ if (message.projectId !== "") {
1232
+ writer.uint32(18).string(message.projectId);
1233
+ }
1234
+ return writer;
1235
+ },
1236
+
1237
+ decode(input: BinaryReader | Uint8Array, length?: number): ListDerivedMetricsRequest {
1238
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1239
+ const end = length === undefined ? reader.len : reader.pos + length;
1240
+ const message = createBaseListDerivedMetricsRequest();
1241
+ while (reader.pos < end) {
1242
+ const tag = reader.uint32();
1243
+ switch (tag >>> 3) {
1244
+ case 1: {
1245
+ if (tag !== 10) {
1246
+ break;
1247
+ }
1248
+
1249
+ message.organizationId = reader.string();
1250
+ continue;
1251
+ }
1252
+ case 2: {
1253
+ if (tag !== 18) {
1254
+ break;
1255
+ }
1256
+
1257
+ message.projectId = reader.string();
1258
+ continue;
1259
+ }
1260
+ }
1261
+ if ((tag & 7) === 4 || tag === 0) {
1262
+ break;
1263
+ }
1264
+ reader.skip(tag & 7);
1265
+ }
1266
+ return message;
1267
+ },
1268
+
1269
+ fromJSON(object: any): ListDerivedMetricsRequest {
1270
+ return {
1271
+ organizationId: isSet(object.organizationId)
1272
+ ? globalThis.String(object.organizationId)
1273
+ : isSet(object.organization_id)
1274
+ ? globalThis.String(object.organization_id)
1275
+ : "",
1276
+ projectId: isSet(object.projectId)
1277
+ ? globalThis.String(object.projectId)
1278
+ : isSet(object.project_id)
1279
+ ? globalThis.String(object.project_id)
1280
+ : "",
1281
+ };
1282
+ },
1283
+
1284
+ toJSON(message: ListDerivedMetricsRequest): unknown {
1285
+ const obj: any = {};
1286
+ if (message.organizationId !== "") {
1287
+ obj.organizationId = message.organizationId;
1288
+ }
1289
+ if (message.projectId !== "") {
1290
+ obj.projectId = message.projectId;
1291
+ }
1292
+ return obj;
1293
+ },
1294
+
1295
+ create<I extends Exact<DeepPartial<ListDerivedMetricsRequest>, I>>(base?: I): ListDerivedMetricsRequest {
1296
+ return ListDerivedMetricsRequest.fromPartial(base ?? ({} as any));
1297
+ },
1298
+ fromPartial<I extends Exact<DeepPartial<ListDerivedMetricsRequest>, I>>(object: I): ListDerivedMetricsRequest {
1299
+ const message = createBaseListDerivedMetricsRequest();
1300
+ message.organizationId = object.organizationId ?? "";
1301
+ message.projectId = object.projectId ?? "";
1302
+ return message;
1303
+ },
1304
+ };
1305
+
1306
+ function createBaseListDerivedMetricsResponse(): ListDerivedMetricsResponse {
1307
+ return { status: undefined, derivedMetrics: [] };
1308
+ }
1309
+
1310
+ export const ListDerivedMetricsResponse: MessageFns<ListDerivedMetricsResponse> = {
1311
+ encode(message: ListDerivedMetricsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1312
+ if (message.status !== undefined) {
1313
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1314
+ }
1315
+ for (const v of message.derivedMetrics) {
1316
+ DerivedMetric.encode(v!, writer.uint32(18).fork()).join();
1317
+ }
1318
+ return writer;
1319
+ },
1320
+
1321
+ decode(input: BinaryReader | Uint8Array, length?: number): ListDerivedMetricsResponse {
1322
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1323
+ const end = length === undefined ? reader.len : reader.pos + length;
1324
+ const message = createBaseListDerivedMetricsResponse();
1325
+ while (reader.pos < end) {
1326
+ const tag = reader.uint32();
1327
+ switch (tag >>> 3) {
1328
+ case 1: {
1329
+ if (tag !== 10) {
1330
+ break;
1331
+ }
1332
+
1333
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1334
+ continue;
1335
+ }
1336
+ case 2: {
1337
+ if (tag !== 18) {
1338
+ break;
1339
+ }
1340
+
1341
+ message.derivedMetrics.push(DerivedMetric.decode(reader, reader.uint32()));
1342
+ continue;
1343
+ }
1344
+ }
1345
+ if ((tag & 7) === 4 || tag === 0) {
1346
+ break;
1347
+ }
1348
+ reader.skip(tag & 7);
1349
+ }
1350
+ return message;
1351
+ },
1352
+
1353
+ fromJSON(object: any): ListDerivedMetricsResponse {
1354
+ return {
1355
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1356
+ derivedMetrics: globalThis.Array.isArray(object?.derivedMetrics)
1357
+ ? object.derivedMetrics.map((e: any) => DerivedMetric.fromJSON(e))
1358
+ : globalThis.Array.isArray(object?.derived_metrics)
1359
+ ? object.derived_metrics.map((e: any) => DerivedMetric.fromJSON(e))
1360
+ : [],
1361
+ };
1362
+ },
1363
+
1364
+ toJSON(message: ListDerivedMetricsResponse): unknown {
1365
+ const obj: any = {};
1366
+ if (message.status !== undefined) {
1367
+ obj.status = ResponseStatus.toJSON(message.status);
1368
+ }
1369
+ if (message.derivedMetrics?.length) {
1370
+ obj.derivedMetrics = message.derivedMetrics.map((e) => DerivedMetric.toJSON(e));
1371
+ }
1372
+ return obj;
1373
+ },
1374
+
1375
+ create<I extends Exact<DeepPartial<ListDerivedMetricsResponse>, I>>(base?: I): ListDerivedMetricsResponse {
1376
+ return ListDerivedMetricsResponse.fromPartial(base ?? ({} as any));
1377
+ },
1378
+ fromPartial<I extends Exact<DeepPartial<ListDerivedMetricsResponse>, I>>(object: I): ListDerivedMetricsResponse {
1379
+ const message = createBaseListDerivedMetricsResponse();
1380
+ message.status = (object.status !== undefined && object.status !== null)
1381
+ ? ResponseStatus.fromPartial(object.status)
1382
+ : undefined;
1383
+ message.derivedMetrics = object.derivedMetrics?.map((e) => DerivedMetric.fromPartial(e)) || [];
1384
+ return message;
1385
+ },
1386
+ };
1387
+
1388
+ function createBaseUpdateDerivedMetricRequest(): UpdateDerivedMetricRequest {
1389
+ return { organizationId: "", projectId: "", derivedMetricId: "", updates: undefined };
1390
+ }
1391
+
1392
+ export const UpdateDerivedMetricRequest: MessageFns<UpdateDerivedMetricRequest> = {
1393
+ encode(message: UpdateDerivedMetricRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1394
+ if (message.organizationId !== "") {
1395
+ writer.uint32(10).string(message.organizationId);
1396
+ }
1397
+ if (message.projectId !== "") {
1398
+ writer.uint32(18).string(message.projectId);
1399
+ }
1400
+ if (message.derivedMetricId !== "") {
1401
+ writer.uint32(26).string(message.derivedMetricId);
1402
+ }
1403
+ if (message.updates !== undefined) {
1404
+ UpdateDerivedMetricRequest_DerivedMetricUpdates.encode(message.updates, writer.uint32(34).fork()).join();
1405
+ }
1406
+ return writer;
1407
+ },
1408
+
1409
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateDerivedMetricRequest {
1410
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1411
+ const end = length === undefined ? reader.len : reader.pos + length;
1412
+ const message = createBaseUpdateDerivedMetricRequest();
1413
+ while (reader.pos < end) {
1414
+ const tag = reader.uint32();
1415
+ switch (tag >>> 3) {
1416
+ case 1: {
1417
+ if (tag !== 10) {
1418
+ break;
1419
+ }
1420
+
1421
+ message.organizationId = reader.string();
1422
+ continue;
1423
+ }
1424
+ case 2: {
1425
+ if (tag !== 18) {
1426
+ break;
1427
+ }
1428
+
1429
+ message.projectId = reader.string();
1430
+ continue;
1431
+ }
1432
+ case 3: {
1433
+ if (tag !== 26) {
1434
+ break;
1435
+ }
1436
+
1437
+ message.derivedMetricId = reader.string();
1438
+ continue;
1439
+ }
1440
+ case 4: {
1441
+ if (tag !== 34) {
1442
+ break;
1443
+ }
1444
+
1445
+ message.updates = UpdateDerivedMetricRequest_DerivedMetricUpdates.decode(reader, reader.uint32());
1446
+ continue;
1447
+ }
1448
+ }
1449
+ if ((tag & 7) === 4 || tag === 0) {
1450
+ break;
1451
+ }
1452
+ reader.skip(tag & 7);
1453
+ }
1454
+ return message;
1455
+ },
1456
+
1457
+ fromJSON(object: any): UpdateDerivedMetricRequest {
1458
+ return {
1459
+ organizationId: isSet(object.organizationId)
1460
+ ? globalThis.String(object.organizationId)
1461
+ : isSet(object.organization_id)
1462
+ ? globalThis.String(object.organization_id)
1463
+ : "",
1464
+ projectId: isSet(object.projectId)
1465
+ ? globalThis.String(object.projectId)
1466
+ : isSet(object.project_id)
1467
+ ? globalThis.String(object.project_id)
1468
+ : "",
1469
+ derivedMetricId: isSet(object.derivedMetricId)
1470
+ ? globalThis.String(object.derivedMetricId)
1471
+ : isSet(object.derived_metric_id)
1472
+ ? globalThis.String(object.derived_metric_id)
1473
+ : "",
1474
+ updates: isSet(object.updates)
1475
+ ? UpdateDerivedMetricRequest_DerivedMetricUpdates.fromJSON(object.updates)
1476
+ : undefined,
1477
+ };
1478
+ },
1479
+
1480
+ toJSON(message: UpdateDerivedMetricRequest): unknown {
1481
+ const obj: any = {};
1482
+ if (message.organizationId !== "") {
1483
+ obj.organizationId = message.organizationId;
1484
+ }
1485
+ if (message.projectId !== "") {
1486
+ obj.projectId = message.projectId;
1487
+ }
1488
+ if (message.derivedMetricId !== "") {
1489
+ obj.derivedMetricId = message.derivedMetricId;
1490
+ }
1491
+ if (message.updates !== undefined) {
1492
+ obj.updates = UpdateDerivedMetricRequest_DerivedMetricUpdates.toJSON(message.updates);
1493
+ }
1494
+ return obj;
1495
+ },
1496
+
1497
+ create<I extends Exact<DeepPartial<UpdateDerivedMetricRequest>, I>>(base?: I): UpdateDerivedMetricRequest {
1498
+ return UpdateDerivedMetricRequest.fromPartial(base ?? ({} as any));
1499
+ },
1500
+ fromPartial<I extends Exact<DeepPartial<UpdateDerivedMetricRequest>, I>>(object: I): UpdateDerivedMetricRequest {
1501
+ const message = createBaseUpdateDerivedMetricRequest();
1502
+ message.organizationId = object.organizationId ?? "";
1503
+ message.projectId = object.projectId ?? "";
1504
+ message.derivedMetricId = object.derivedMetricId ?? "";
1505
+ message.updates = (object.updates !== undefined && object.updates !== null)
1506
+ ? UpdateDerivedMetricRequest_DerivedMetricUpdates.fromPartial(object.updates)
1507
+ : undefined;
1508
+ return message;
1509
+ },
1510
+ };
1511
+
1512
+ function createBaseUpdateDerivedMetricRequest_DerivedMetricUpdates(): UpdateDerivedMetricRequest_DerivedMetricUpdates {
1513
+ return { displayName: undefined, description: undefined, enabled: undefined };
1514
+ }
1515
+
1516
+ export const UpdateDerivedMetricRequest_DerivedMetricUpdates: MessageFns<
1517
+ UpdateDerivedMetricRequest_DerivedMetricUpdates
1518
+ > = {
1519
+ encode(
1520
+ message: UpdateDerivedMetricRequest_DerivedMetricUpdates,
1521
+ writer: BinaryWriter = new BinaryWriter(),
1522
+ ): BinaryWriter {
1523
+ if (message.displayName !== undefined) {
1524
+ writer.uint32(10).string(message.displayName);
1525
+ }
1526
+ if (message.description !== undefined) {
1527
+ writer.uint32(18).string(message.description);
1528
+ }
1529
+ if (message.enabled !== undefined) {
1530
+ writer.uint32(24).bool(message.enabled);
1531
+ }
1532
+ return writer;
1533
+ },
1534
+
1535
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateDerivedMetricRequest_DerivedMetricUpdates {
1536
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1537
+ const end = length === undefined ? reader.len : reader.pos + length;
1538
+ const message = createBaseUpdateDerivedMetricRequest_DerivedMetricUpdates();
1539
+ while (reader.pos < end) {
1540
+ const tag = reader.uint32();
1541
+ switch (tag >>> 3) {
1542
+ case 1: {
1543
+ if (tag !== 10) {
1544
+ break;
1545
+ }
1546
+
1547
+ message.displayName = reader.string();
1548
+ continue;
1549
+ }
1550
+ case 2: {
1551
+ if (tag !== 18) {
1552
+ break;
1553
+ }
1554
+
1555
+ message.description = reader.string();
1556
+ continue;
1557
+ }
1558
+ case 3: {
1559
+ if (tag !== 24) {
1560
+ break;
1561
+ }
1562
+
1563
+ message.enabled = reader.bool();
1564
+ continue;
1565
+ }
1566
+ }
1567
+ if ((tag & 7) === 4 || tag === 0) {
1568
+ break;
1569
+ }
1570
+ reader.skip(tag & 7);
1571
+ }
1572
+ return message;
1573
+ },
1574
+
1575
+ fromJSON(object: any): UpdateDerivedMetricRequest_DerivedMetricUpdates {
1576
+ return {
1577
+ displayName: isSet(object.displayName)
1578
+ ? globalThis.String(object.displayName)
1579
+ : isSet(object.display_name)
1580
+ ? globalThis.String(object.display_name)
1581
+ : undefined,
1582
+ description: isSet(object.description) ? globalThis.String(object.description) : undefined,
1583
+ enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : undefined,
1584
+ };
1585
+ },
1586
+
1587
+ toJSON(message: UpdateDerivedMetricRequest_DerivedMetricUpdates): unknown {
1588
+ const obj: any = {};
1589
+ if (message.displayName !== undefined) {
1590
+ obj.displayName = message.displayName;
1591
+ }
1592
+ if (message.description !== undefined) {
1593
+ obj.description = message.description;
1594
+ }
1595
+ if (message.enabled !== undefined) {
1596
+ obj.enabled = message.enabled;
1597
+ }
1598
+ return obj;
1599
+ },
1600
+
1601
+ create<I extends Exact<DeepPartial<UpdateDerivedMetricRequest_DerivedMetricUpdates>, I>>(
1602
+ base?: I,
1603
+ ): UpdateDerivedMetricRequest_DerivedMetricUpdates {
1604
+ return UpdateDerivedMetricRequest_DerivedMetricUpdates.fromPartial(base ?? ({} as any));
1605
+ },
1606
+ fromPartial<I extends Exact<DeepPartial<UpdateDerivedMetricRequest_DerivedMetricUpdates>, I>>(
1607
+ object: I,
1608
+ ): UpdateDerivedMetricRequest_DerivedMetricUpdates {
1609
+ const message = createBaseUpdateDerivedMetricRequest_DerivedMetricUpdates();
1610
+ message.displayName = object.displayName ?? undefined;
1611
+ message.description = object.description ?? undefined;
1612
+ message.enabled = object.enabled ?? undefined;
1613
+ return message;
1614
+ },
1615
+ };
1616
+
1617
+ function createBaseUpdateDerivedMetricResponse(): UpdateDerivedMetricResponse {
1618
+ return { status: undefined, derivedMetric: undefined };
1619
+ }
1620
+
1621
+ export const UpdateDerivedMetricResponse: MessageFns<UpdateDerivedMetricResponse> = {
1622
+ encode(message: UpdateDerivedMetricResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1623
+ if (message.status !== undefined) {
1624
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1625
+ }
1626
+ if (message.derivedMetric !== undefined) {
1627
+ DerivedMetric.encode(message.derivedMetric, writer.uint32(18).fork()).join();
1628
+ }
1629
+ return writer;
1630
+ },
1631
+
1632
+ decode(input: BinaryReader | Uint8Array, length?: number): UpdateDerivedMetricResponse {
1633
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1634
+ const end = length === undefined ? reader.len : reader.pos + length;
1635
+ const message = createBaseUpdateDerivedMetricResponse();
1636
+ while (reader.pos < end) {
1637
+ const tag = reader.uint32();
1638
+ switch (tag >>> 3) {
1639
+ case 1: {
1640
+ if (tag !== 10) {
1641
+ break;
1642
+ }
1643
+
1644
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1645
+ continue;
1646
+ }
1647
+ case 2: {
1648
+ if (tag !== 18) {
1649
+ break;
1650
+ }
1651
+
1652
+ message.derivedMetric = DerivedMetric.decode(reader, reader.uint32());
1653
+ continue;
1654
+ }
1655
+ }
1656
+ if ((tag & 7) === 4 || tag === 0) {
1657
+ break;
1658
+ }
1659
+ reader.skip(tag & 7);
1660
+ }
1661
+ return message;
1662
+ },
1663
+
1664
+ fromJSON(object: any): UpdateDerivedMetricResponse {
1665
+ return {
1666
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1667
+ derivedMetric: isSet(object.derivedMetric)
1668
+ ? DerivedMetric.fromJSON(object.derivedMetric)
1669
+ : isSet(object.derived_metric)
1670
+ ? DerivedMetric.fromJSON(object.derived_metric)
1671
+ : undefined,
1672
+ };
1673
+ },
1674
+
1675
+ toJSON(message: UpdateDerivedMetricResponse): unknown {
1676
+ const obj: any = {};
1677
+ if (message.status !== undefined) {
1678
+ obj.status = ResponseStatus.toJSON(message.status);
1679
+ }
1680
+ if (message.derivedMetric !== undefined) {
1681
+ obj.derivedMetric = DerivedMetric.toJSON(message.derivedMetric);
1682
+ }
1683
+ return obj;
1684
+ },
1685
+
1686
+ create<I extends Exact<DeepPartial<UpdateDerivedMetricResponse>, I>>(base?: I): UpdateDerivedMetricResponse {
1687
+ return UpdateDerivedMetricResponse.fromPartial(base ?? ({} as any));
1688
+ },
1689
+ fromPartial<I extends Exact<DeepPartial<UpdateDerivedMetricResponse>, I>>(object: I): UpdateDerivedMetricResponse {
1690
+ const message = createBaseUpdateDerivedMetricResponse();
1691
+ message.status = (object.status !== undefined && object.status !== null)
1692
+ ? ResponseStatus.fromPartial(object.status)
1693
+ : undefined;
1694
+ message.derivedMetric = (object.derivedMetric !== undefined && object.derivedMetric !== null)
1695
+ ? DerivedMetric.fromPartial(object.derivedMetric)
1696
+ : undefined;
1697
+ return message;
1698
+ },
1699
+ };
1700
+
1701
+ function createBaseDeleteDerivedMetricRequest(): DeleteDerivedMetricRequest {
1702
+ return { organizationId: "", projectId: "", derivedMetricId: "" };
1703
+ }
1704
+
1705
+ export const DeleteDerivedMetricRequest: MessageFns<DeleteDerivedMetricRequest> = {
1706
+ encode(message: DeleteDerivedMetricRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1707
+ if (message.organizationId !== "") {
1708
+ writer.uint32(10).string(message.organizationId);
1709
+ }
1710
+ if (message.projectId !== "") {
1711
+ writer.uint32(18).string(message.projectId);
1712
+ }
1713
+ if (message.derivedMetricId !== "") {
1714
+ writer.uint32(26).string(message.derivedMetricId);
1715
+ }
1716
+ return writer;
1717
+ },
1718
+
1719
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteDerivedMetricRequest {
1720
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1721
+ const end = length === undefined ? reader.len : reader.pos + length;
1722
+ const message = createBaseDeleteDerivedMetricRequest();
1723
+ while (reader.pos < end) {
1724
+ const tag = reader.uint32();
1725
+ switch (tag >>> 3) {
1726
+ case 1: {
1727
+ if (tag !== 10) {
1728
+ break;
1729
+ }
1730
+
1731
+ message.organizationId = reader.string();
1732
+ continue;
1733
+ }
1734
+ case 2: {
1735
+ if (tag !== 18) {
1736
+ break;
1737
+ }
1738
+
1739
+ message.projectId = reader.string();
1740
+ continue;
1741
+ }
1742
+ case 3: {
1743
+ if (tag !== 26) {
1744
+ break;
1745
+ }
1746
+
1747
+ message.derivedMetricId = reader.string();
1748
+ continue;
1749
+ }
1750
+ }
1751
+ if ((tag & 7) === 4 || tag === 0) {
1752
+ break;
1753
+ }
1754
+ reader.skip(tag & 7);
1755
+ }
1756
+ return message;
1757
+ },
1758
+
1759
+ fromJSON(object: any): DeleteDerivedMetricRequest {
1760
+ return {
1761
+ organizationId: isSet(object.organizationId)
1762
+ ? globalThis.String(object.organizationId)
1763
+ : isSet(object.organization_id)
1764
+ ? globalThis.String(object.organization_id)
1765
+ : "",
1766
+ projectId: isSet(object.projectId)
1767
+ ? globalThis.String(object.projectId)
1768
+ : isSet(object.project_id)
1769
+ ? globalThis.String(object.project_id)
1770
+ : "",
1771
+ derivedMetricId: isSet(object.derivedMetricId)
1772
+ ? globalThis.String(object.derivedMetricId)
1773
+ : isSet(object.derived_metric_id)
1774
+ ? globalThis.String(object.derived_metric_id)
1775
+ : "",
1776
+ };
1777
+ },
1778
+
1779
+ toJSON(message: DeleteDerivedMetricRequest): unknown {
1780
+ const obj: any = {};
1781
+ if (message.organizationId !== "") {
1782
+ obj.organizationId = message.organizationId;
1783
+ }
1784
+ if (message.projectId !== "") {
1785
+ obj.projectId = message.projectId;
1786
+ }
1787
+ if (message.derivedMetricId !== "") {
1788
+ obj.derivedMetricId = message.derivedMetricId;
1789
+ }
1790
+ return obj;
1791
+ },
1792
+
1793
+ create<I extends Exact<DeepPartial<DeleteDerivedMetricRequest>, I>>(base?: I): DeleteDerivedMetricRequest {
1794
+ return DeleteDerivedMetricRequest.fromPartial(base ?? ({} as any));
1795
+ },
1796
+ fromPartial<I extends Exact<DeepPartial<DeleteDerivedMetricRequest>, I>>(object: I): DeleteDerivedMetricRequest {
1797
+ const message = createBaseDeleteDerivedMetricRequest();
1798
+ message.organizationId = object.organizationId ?? "";
1799
+ message.projectId = object.projectId ?? "";
1800
+ message.derivedMetricId = object.derivedMetricId ?? "";
1801
+ return message;
1802
+ },
1803
+ };
1804
+
1805
+ function createBaseDeleteDerivedMetricResponse(): DeleteDerivedMetricResponse {
1806
+ return { status: undefined };
1807
+ }
1808
+
1809
+ export const DeleteDerivedMetricResponse: MessageFns<DeleteDerivedMetricResponse> = {
1810
+ encode(message: DeleteDerivedMetricResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1811
+ if (message.status !== undefined) {
1812
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1813
+ }
1814
+ return writer;
1815
+ },
1816
+
1817
+ decode(input: BinaryReader | Uint8Array, length?: number): DeleteDerivedMetricResponse {
1818
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1819
+ const end = length === undefined ? reader.len : reader.pos + length;
1820
+ const message = createBaseDeleteDerivedMetricResponse();
1821
+ while (reader.pos < end) {
1822
+ const tag = reader.uint32();
1823
+ switch (tag >>> 3) {
1824
+ case 1: {
1825
+ if (tag !== 10) {
1826
+ break;
1827
+ }
1828
+
1829
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1830
+ continue;
1831
+ }
1832
+ }
1833
+ if ((tag & 7) === 4 || tag === 0) {
1834
+ break;
1835
+ }
1836
+ reader.skip(tag & 7);
1837
+ }
1838
+ return message;
1839
+ },
1840
+
1841
+ fromJSON(object: any): DeleteDerivedMetricResponse {
1842
+ return { status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined };
1843
+ },
1844
+
1845
+ toJSON(message: DeleteDerivedMetricResponse): unknown {
1846
+ const obj: any = {};
1847
+ if (message.status !== undefined) {
1848
+ obj.status = ResponseStatus.toJSON(message.status);
1849
+ }
1850
+ return obj;
1851
+ },
1852
+
1853
+ create<I extends Exact<DeepPartial<DeleteDerivedMetricResponse>, I>>(base?: I): DeleteDerivedMetricResponse {
1854
+ return DeleteDerivedMetricResponse.fromPartial(base ?? ({} as any));
1855
+ },
1856
+ fromPartial<I extends Exact<DeepPartial<DeleteDerivedMetricResponse>, I>>(object: I): DeleteDerivedMetricResponse {
1857
+ const message = createBaseDeleteDerivedMetricResponse();
1858
+ message.status = (object.status !== undefined && object.status !== null)
1859
+ ? ResponseStatus.fromPartial(object.status)
1860
+ : undefined;
1861
+ return message;
1862
+ },
1863
+ };
1864
+
1865
+ function createBaseDryRunDerivedMetricRequest(): DryRunDerivedMetricRequest {
1866
+ return { organizationId: "", projectId: "", program: undefined, traceLimit: 0 };
1867
+ }
1868
+
1869
+ export const DryRunDerivedMetricRequest: MessageFns<DryRunDerivedMetricRequest> = {
1870
+ encode(message: DryRunDerivedMetricRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1871
+ if (message.organizationId !== "") {
1872
+ writer.uint32(10).string(message.organizationId);
1873
+ }
1874
+ if (message.projectId !== "") {
1875
+ writer.uint32(18).string(message.projectId);
1876
+ }
1877
+ if (message.program !== undefined) {
1878
+ DerivedMetricProgram.encode(message.program, writer.uint32(26).fork()).join();
1879
+ }
1880
+ if (message.traceLimit !== 0) {
1881
+ writer.uint32(32).int32(message.traceLimit);
1882
+ }
1883
+ return writer;
1884
+ },
1885
+
1886
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunDerivedMetricRequest {
1887
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1888
+ const end = length === undefined ? reader.len : reader.pos + length;
1889
+ const message = createBaseDryRunDerivedMetricRequest();
1890
+ while (reader.pos < end) {
1891
+ const tag = reader.uint32();
1892
+ switch (tag >>> 3) {
1893
+ case 1: {
1894
+ if (tag !== 10) {
1895
+ break;
1896
+ }
1897
+
1898
+ message.organizationId = reader.string();
1899
+ continue;
1900
+ }
1901
+ case 2: {
1902
+ if (tag !== 18) {
1903
+ break;
1904
+ }
1905
+
1906
+ message.projectId = reader.string();
1907
+ continue;
1908
+ }
1909
+ case 3: {
1910
+ if (tag !== 26) {
1911
+ break;
1912
+ }
1913
+
1914
+ message.program = DerivedMetricProgram.decode(reader, reader.uint32());
1915
+ continue;
1916
+ }
1917
+ case 4: {
1918
+ if (tag !== 32) {
1919
+ break;
1920
+ }
1921
+
1922
+ message.traceLimit = reader.int32();
1923
+ continue;
1924
+ }
1925
+ }
1926
+ if ((tag & 7) === 4 || tag === 0) {
1927
+ break;
1928
+ }
1929
+ reader.skip(tag & 7);
1930
+ }
1931
+ return message;
1932
+ },
1933
+
1934
+ fromJSON(object: any): DryRunDerivedMetricRequest {
1935
+ return {
1936
+ organizationId: isSet(object.organizationId)
1937
+ ? globalThis.String(object.organizationId)
1938
+ : isSet(object.organization_id)
1939
+ ? globalThis.String(object.organization_id)
1940
+ : "",
1941
+ projectId: isSet(object.projectId)
1942
+ ? globalThis.String(object.projectId)
1943
+ : isSet(object.project_id)
1944
+ ? globalThis.String(object.project_id)
1945
+ : "",
1946
+ program: isSet(object.program) ? DerivedMetricProgram.fromJSON(object.program) : undefined,
1947
+ traceLimit: isSet(object.traceLimit)
1948
+ ? globalThis.Number(object.traceLimit)
1949
+ : isSet(object.trace_limit)
1950
+ ? globalThis.Number(object.trace_limit)
1951
+ : 0,
1952
+ };
1953
+ },
1954
+
1955
+ toJSON(message: DryRunDerivedMetricRequest): unknown {
1956
+ const obj: any = {};
1957
+ if (message.organizationId !== "") {
1958
+ obj.organizationId = message.organizationId;
1959
+ }
1960
+ if (message.projectId !== "") {
1961
+ obj.projectId = message.projectId;
1962
+ }
1963
+ if (message.program !== undefined) {
1964
+ obj.program = DerivedMetricProgram.toJSON(message.program);
1965
+ }
1966
+ if (message.traceLimit !== 0) {
1967
+ obj.traceLimit = Math.round(message.traceLimit);
1968
+ }
1969
+ return obj;
1970
+ },
1971
+
1972
+ create<I extends Exact<DeepPartial<DryRunDerivedMetricRequest>, I>>(base?: I): DryRunDerivedMetricRequest {
1973
+ return DryRunDerivedMetricRequest.fromPartial(base ?? ({} as any));
1974
+ },
1975
+ fromPartial<I extends Exact<DeepPartial<DryRunDerivedMetricRequest>, I>>(object: I): DryRunDerivedMetricRequest {
1976
+ const message = createBaseDryRunDerivedMetricRequest();
1977
+ message.organizationId = object.organizationId ?? "";
1978
+ message.projectId = object.projectId ?? "";
1979
+ message.program = (object.program !== undefined && object.program !== null)
1980
+ ? DerivedMetricProgram.fromPartial(object.program)
1981
+ : undefined;
1982
+ message.traceLimit = object.traceLimit ?? 0;
1983
+ return message;
1984
+ },
1985
+ };
1986
+
1987
+ function createBaseDryRunDerivedMetricResponse(): DryRunDerivedMetricResponse {
1988
+ return { status: undefined, traceResults: [], outcomeCounts: [], tracesSelected: 0 };
1989
+ }
1990
+
1991
+ export const DryRunDerivedMetricResponse: MessageFns<DryRunDerivedMetricResponse> = {
1992
+ encode(message: DryRunDerivedMetricResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1993
+ if (message.status !== undefined) {
1994
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1995
+ }
1996
+ for (const v of message.traceResults) {
1997
+ DryRunTraceResult.encode(v!, writer.uint32(18).fork()).join();
1998
+ }
1999
+ for (const v of message.outcomeCounts) {
2000
+ DerivedMetricOutcomeCount.encode(v!, writer.uint32(26).fork()).join();
2001
+ }
2002
+ if (message.tracesSelected !== 0) {
2003
+ writer.uint32(32).uint32(message.tracesSelected);
2004
+ }
2005
+ return writer;
2006
+ },
2007
+
2008
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunDerivedMetricResponse {
2009
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2010
+ const end = length === undefined ? reader.len : reader.pos + length;
2011
+ const message = createBaseDryRunDerivedMetricResponse();
2012
+ while (reader.pos < end) {
2013
+ const tag = reader.uint32();
2014
+ switch (tag >>> 3) {
2015
+ case 1: {
2016
+ if (tag !== 10) {
2017
+ break;
2018
+ }
2019
+
2020
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2021
+ continue;
2022
+ }
2023
+ case 2: {
2024
+ if (tag !== 18) {
2025
+ break;
2026
+ }
2027
+
2028
+ message.traceResults.push(DryRunTraceResult.decode(reader, reader.uint32()));
2029
+ continue;
2030
+ }
2031
+ case 3: {
2032
+ if (tag !== 26) {
2033
+ break;
2034
+ }
2035
+
2036
+ message.outcomeCounts.push(DerivedMetricOutcomeCount.decode(reader, reader.uint32()));
2037
+ continue;
2038
+ }
2039
+ case 4: {
2040
+ if (tag !== 32) {
2041
+ break;
2042
+ }
2043
+
2044
+ message.tracesSelected = reader.uint32();
2045
+ continue;
2046
+ }
2047
+ }
2048
+ if ((tag & 7) === 4 || tag === 0) {
2049
+ break;
2050
+ }
2051
+ reader.skip(tag & 7);
2052
+ }
2053
+ return message;
2054
+ },
2055
+
2056
+ fromJSON(object: any): DryRunDerivedMetricResponse {
2057
+ return {
2058
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2059
+ traceResults: globalThis.Array.isArray(object?.traceResults)
2060
+ ? object.traceResults.map((e: any) => DryRunTraceResult.fromJSON(e))
2061
+ : globalThis.Array.isArray(object?.trace_results)
2062
+ ? object.trace_results.map((e: any) => DryRunTraceResult.fromJSON(e))
2063
+ : [],
2064
+ outcomeCounts: globalThis.Array.isArray(object?.outcomeCounts)
2065
+ ? object.outcomeCounts.map((e: any) => DerivedMetricOutcomeCount.fromJSON(e))
2066
+ : globalThis.Array.isArray(object?.outcome_counts)
2067
+ ? object.outcome_counts.map((e: any) => DerivedMetricOutcomeCount.fromJSON(e))
2068
+ : [],
2069
+ tracesSelected: isSet(object.tracesSelected)
2070
+ ? globalThis.Number(object.tracesSelected)
2071
+ : isSet(object.traces_selected)
2072
+ ? globalThis.Number(object.traces_selected)
2073
+ : 0,
2074
+ };
2075
+ },
2076
+
2077
+ toJSON(message: DryRunDerivedMetricResponse): unknown {
2078
+ const obj: any = {};
2079
+ if (message.status !== undefined) {
2080
+ obj.status = ResponseStatus.toJSON(message.status);
2081
+ }
2082
+ if (message.traceResults?.length) {
2083
+ obj.traceResults = message.traceResults.map((e) => DryRunTraceResult.toJSON(e));
2084
+ }
2085
+ if (message.outcomeCounts?.length) {
2086
+ obj.outcomeCounts = message.outcomeCounts.map((e) => DerivedMetricOutcomeCount.toJSON(e));
2087
+ }
2088
+ if (message.tracesSelected !== 0) {
2089
+ obj.tracesSelected = Math.round(message.tracesSelected);
2090
+ }
2091
+ return obj;
2092
+ },
2093
+
2094
+ create<I extends Exact<DeepPartial<DryRunDerivedMetricResponse>, I>>(base?: I): DryRunDerivedMetricResponse {
2095
+ return DryRunDerivedMetricResponse.fromPartial(base ?? ({} as any));
2096
+ },
2097
+ fromPartial<I extends Exact<DeepPartial<DryRunDerivedMetricResponse>, I>>(object: I): DryRunDerivedMetricResponse {
2098
+ const message = createBaseDryRunDerivedMetricResponse();
2099
+ message.status = (object.status !== undefined && object.status !== null)
2100
+ ? ResponseStatus.fromPartial(object.status)
2101
+ : undefined;
2102
+ message.traceResults = object.traceResults?.map((e) => DryRunTraceResult.fromPartial(e)) || [];
2103
+ message.outcomeCounts = object.outcomeCounts?.map((e) => DerivedMetricOutcomeCount.fromPartial(e)) || [];
2104
+ message.tracesSelected = object.tracesSelected ?? 0;
2105
+ return message;
2106
+ },
2107
+ };
2108
+
2109
+ function createBaseDryRunTraceResult(): DryRunTraceResult {
2110
+ return { traceId: "", emitted: undefined, notEmitted: undefined };
2111
+ }
2112
+
2113
+ export const DryRunTraceResult: MessageFns<DryRunTraceResult> = {
2114
+ encode(message: DryRunTraceResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2115
+ if (message.traceId !== "") {
2116
+ writer.uint32(10).string(message.traceId);
2117
+ }
2118
+ if (message.emitted !== undefined) {
2119
+ DryRunEmission.encode(message.emitted, writer.uint32(18).fork()).join();
2120
+ }
2121
+ if (message.notEmitted !== undefined) {
2122
+ DryRunNonEmission.encode(message.notEmitted, writer.uint32(26).fork()).join();
2123
+ }
2124
+ return writer;
2125
+ },
2126
+
2127
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunTraceResult {
2128
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2129
+ const end = length === undefined ? reader.len : reader.pos + length;
2130
+ const message = createBaseDryRunTraceResult();
2131
+ while (reader.pos < end) {
2132
+ const tag = reader.uint32();
2133
+ switch (tag >>> 3) {
2134
+ case 1: {
2135
+ if (tag !== 10) {
2136
+ break;
2137
+ }
2138
+
2139
+ message.traceId = reader.string();
2140
+ continue;
2141
+ }
2142
+ case 2: {
2143
+ if (tag !== 18) {
2144
+ break;
2145
+ }
2146
+
2147
+ message.emitted = DryRunEmission.decode(reader, reader.uint32());
2148
+ continue;
2149
+ }
2150
+ case 3: {
2151
+ if (tag !== 26) {
2152
+ break;
2153
+ }
2154
+
2155
+ message.notEmitted = DryRunNonEmission.decode(reader, reader.uint32());
2156
+ continue;
2157
+ }
2158
+ }
2159
+ if ((tag & 7) === 4 || tag === 0) {
2160
+ break;
2161
+ }
2162
+ reader.skip(tag & 7);
2163
+ }
2164
+ return message;
2165
+ },
2166
+
2167
+ fromJSON(object: any): DryRunTraceResult {
2168
+ return {
2169
+ traceId: isSet(object.traceId)
2170
+ ? globalThis.String(object.traceId)
2171
+ : isSet(object.trace_id)
2172
+ ? globalThis.String(object.trace_id)
2173
+ : "",
2174
+ emitted: isSet(object.emitted) ? DryRunEmission.fromJSON(object.emitted) : undefined,
2175
+ notEmitted: isSet(object.notEmitted)
2176
+ ? DryRunNonEmission.fromJSON(object.notEmitted)
2177
+ : isSet(object.not_emitted)
2178
+ ? DryRunNonEmission.fromJSON(object.not_emitted)
2179
+ : undefined,
2180
+ };
2181
+ },
2182
+
2183
+ toJSON(message: DryRunTraceResult): unknown {
2184
+ const obj: any = {};
2185
+ if (message.traceId !== "") {
2186
+ obj.traceId = message.traceId;
2187
+ }
2188
+ if (message.emitted !== undefined) {
2189
+ obj.emitted = DryRunEmission.toJSON(message.emitted);
2190
+ }
2191
+ if (message.notEmitted !== undefined) {
2192
+ obj.notEmitted = DryRunNonEmission.toJSON(message.notEmitted);
2193
+ }
2194
+ return obj;
2195
+ },
2196
+
2197
+ create<I extends Exact<DeepPartial<DryRunTraceResult>, I>>(base?: I): DryRunTraceResult {
2198
+ return DryRunTraceResult.fromPartial(base ?? ({} as any));
2199
+ },
2200
+ fromPartial<I extends Exact<DeepPartial<DryRunTraceResult>, I>>(object: I): DryRunTraceResult {
2201
+ const message = createBaseDryRunTraceResult();
2202
+ message.traceId = object.traceId ?? "";
2203
+ message.emitted = (object.emitted !== undefined && object.emitted !== null)
2204
+ ? DryRunEmission.fromPartial(object.emitted)
2205
+ : undefined;
2206
+ message.notEmitted = (object.notEmitted !== undefined && object.notEmitted !== null)
2207
+ ? DryRunNonEmission.fromPartial(object.notEmitted)
2208
+ : undefined;
2209
+ return message;
2210
+ },
2211
+ };
2212
+
2213
+ function createBaseDryRunEmission(): DryRunEmission {
2214
+ return { value: 0, resolvedDimensions: {} };
2215
+ }
2216
+
2217
+ export const DryRunEmission: MessageFns<DryRunEmission> = {
2218
+ encode(message: DryRunEmission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2219
+ if (message.value !== 0) {
2220
+ writer.uint32(9).double(message.value);
2221
+ }
2222
+ globalThis.Object.entries(message.resolvedDimensions).forEach(([key, value]: [string, string]) => {
2223
+ DryRunEmission_ResolvedDimensionsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join();
2224
+ });
2225
+ return writer;
2226
+ },
2227
+
2228
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunEmission {
2229
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2230
+ const end = length === undefined ? reader.len : reader.pos + length;
2231
+ const message = createBaseDryRunEmission();
2232
+ while (reader.pos < end) {
2233
+ const tag = reader.uint32();
2234
+ switch (tag >>> 3) {
2235
+ case 1: {
2236
+ if (tag !== 9) {
2237
+ break;
2238
+ }
2239
+
2240
+ message.value = reader.double();
2241
+ continue;
2242
+ }
2243
+ case 3: {
2244
+ if (tag !== 26) {
2245
+ break;
2246
+ }
2247
+
2248
+ const entry3 = DryRunEmission_ResolvedDimensionsEntry.decode(reader, reader.uint32());
2249
+ if (entry3.value !== undefined) {
2250
+ message.resolvedDimensions[entry3.key] = entry3.value;
2251
+ }
2252
+ continue;
2253
+ }
2254
+ }
2255
+ if ((tag & 7) === 4 || tag === 0) {
2256
+ break;
2257
+ }
2258
+ reader.skip(tag & 7);
2259
+ }
2260
+ return message;
2261
+ },
2262
+
2263
+ fromJSON(object: any): DryRunEmission {
2264
+ return {
2265
+ value: isSet(object.value) ? globalThis.Number(object.value) : 0,
2266
+ resolvedDimensions: isObject(object.resolvedDimensions)
2267
+ ? (globalThis.Object.entries(object.resolvedDimensions) as [string, any][]).reduce(
2268
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2269
+ acc[key] = globalThis.String(value);
2270
+ return acc;
2271
+ },
2272
+ {},
2273
+ )
2274
+ : isObject(object.resolved_dimensions)
2275
+ ? (globalThis.Object.entries(object.resolved_dimensions) as [string, any][]).reduce(
2276
+ (acc: { [key: string]: string }, [key, value]: [string, any]) => {
2277
+ acc[key] = globalThis.String(value);
2278
+ return acc;
2279
+ },
2280
+ {},
2281
+ )
2282
+ : {},
2283
+ };
2284
+ },
2285
+
2286
+ toJSON(message: DryRunEmission): unknown {
2287
+ const obj: any = {};
2288
+ if (message.value !== 0) {
2289
+ obj.value = message.value;
2290
+ }
2291
+ if (message.resolvedDimensions) {
2292
+ const entries = globalThis.Object.entries(message.resolvedDimensions) as [string, string][];
2293
+ if (entries.length > 0) {
2294
+ obj.resolvedDimensions = {};
2295
+ entries.forEach(([k, v]) => {
2296
+ obj.resolvedDimensions[k] = v;
2297
+ });
2298
+ }
2299
+ }
2300
+ return obj;
2301
+ },
2302
+
2303
+ create<I extends Exact<DeepPartial<DryRunEmission>, I>>(base?: I): DryRunEmission {
2304
+ return DryRunEmission.fromPartial(base ?? ({} as any));
2305
+ },
2306
+ fromPartial<I extends Exact<DeepPartial<DryRunEmission>, I>>(object: I): DryRunEmission {
2307
+ const message = createBaseDryRunEmission();
2308
+ message.value = object.value ?? 0;
2309
+ message.resolvedDimensions = (globalThis.Object.entries(object.resolvedDimensions ?? {}) as [string, string][])
2310
+ .reduce((acc: { [key: string]: string }, [key, value]: [string, string]) => {
2311
+ if (value !== undefined) {
2312
+ acc[key] = globalThis.String(value);
2313
+ }
2314
+ return acc;
2315
+ }, {});
2316
+ return message;
2317
+ },
2318
+ };
2319
+
2320
+ function createBaseDryRunEmission_ResolvedDimensionsEntry(): DryRunEmission_ResolvedDimensionsEntry {
2321
+ return { key: "", value: "" };
2322
+ }
2323
+
2324
+ export const DryRunEmission_ResolvedDimensionsEntry: MessageFns<DryRunEmission_ResolvedDimensionsEntry> = {
2325
+ encode(message: DryRunEmission_ResolvedDimensionsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2326
+ if (message.key !== "") {
2327
+ writer.uint32(10).string(message.key);
2328
+ }
2329
+ if (message.value !== "") {
2330
+ writer.uint32(18).string(message.value);
2331
+ }
2332
+ return writer;
2333
+ },
2334
+
2335
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunEmission_ResolvedDimensionsEntry {
2336
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2337
+ const end = length === undefined ? reader.len : reader.pos + length;
2338
+ const message = createBaseDryRunEmission_ResolvedDimensionsEntry();
2339
+ while (reader.pos < end) {
2340
+ const tag = reader.uint32();
2341
+ switch (tag >>> 3) {
2342
+ case 1: {
2343
+ if (tag !== 10) {
2344
+ break;
2345
+ }
2346
+
2347
+ message.key = reader.string();
2348
+ continue;
2349
+ }
2350
+ case 2: {
2351
+ if (tag !== 18) {
2352
+ break;
2353
+ }
2354
+
2355
+ message.value = reader.string();
2356
+ continue;
2357
+ }
2358
+ }
2359
+ if ((tag & 7) === 4 || tag === 0) {
2360
+ break;
2361
+ }
2362
+ reader.skip(tag & 7);
2363
+ }
2364
+ return message;
2365
+ },
2366
+
2367
+ fromJSON(object: any): DryRunEmission_ResolvedDimensionsEntry {
2368
+ return {
2369
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2370
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
2371
+ };
2372
+ },
2373
+
2374
+ toJSON(message: DryRunEmission_ResolvedDimensionsEntry): unknown {
2375
+ const obj: any = {};
2376
+ if (message.key !== "") {
2377
+ obj.key = message.key;
2378
+ }
2379
+ if (message.value !== "") {
2380
+ obj.value = message.value;
2381
+ }
2382
+ return obj;
2383
+ },
2384
+
2385
+ create<I extends Exact<DeepPartial<DryRunEmission_ResolvedDimensionsEntry>, I>>(
2386
+ base?: I,
2387
+ ): DryRunEmission_ResolvedDimensionsEntry {
2388
+ return DryRunEmission_ResolvedDimensionsEntry.fromPartial(base ?? ({} as any));
2389
+ },
2390
+ fromPartial<I extends Exact<DeepPartial<DryRunEmission_ResolvedDimensionsEntry>, I>>(
2391
+ object: I,
2392
+ ): DryRunEmission_ResolvedDimensionsEntry {
2393
+ const message = createBaseDryRunEmission_ResolvedDimensionsEntry();
2394
+ message.key = object.key ?? "";
2395
+ message.value = object.value ?? "";
2396
+ return message;
2397
+ },
2398
+ };
2399
+
2400
+ function createBaseDryRunNonEmission(): DryRunNonEmission {
2401
+ return { outcome: 0, detail: "" };
2402
+ }
2403
+
2404
+ export const DryRunNonEmission: MessageFns<DryRunNonEmission> = {
2405
+ encode(message: DryRunNonEmission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2406
+ if (message.outcome !== 0) {
2407
+ writer.uint32(8).int32(message.outcome);
2408
+ }
2409
+ if (message.detail !== "") {
2410
+ writer.uint32(18).string(message.detail);
2411
+ }
2412
+ return writer;
2413
+ },
2414
+
2415
+ decode(input: BinaryReader | Uint8Array, length?: number): DryRunNonEmission {
2416
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2417
+ const end = length === undefined ? reader.len : reader.pos + length;
2418
+ const message = createBaseDryRunNonEmission();
2419
+ while (reader.pos < end) {
2420
+ const tag = reader.uint32();
2421
+ switch (tag >>> 3) {
2422
+ case 1: {
2423
+ if (tag !== 8) {
2424
+ break;
2425
+ }
2426
+
2427
+ message.outcome = reader.int32() as any;
2428
+ continue;
2429
+ }
2430
+ case 2: {
2431
+ if (tag !== 18) {
2432
+ break;
2433
+ }
2434
+
2435
+ message.detail = reader.string();
2436
+ continue;
2437
+ }
2438
+ }
2439
+ if ((tag & 7) === 4 || tag === 0) {
2440
+ break;
2441
+ }
2442
+ reader.skip(tag & 7);
2443
+ }
2444
+ return message;
2445
+ },
2446
+
2447
+ fromJSON(object: any): DryRunNonEmission {
2448
+ return {
2449
+ outcome: isSet(object.outcome) ? derivedMetricOutcomeFromJSON(object.outcome) : 0,
2450
+ detail: isSet(object.detail) ? globalThis.String(object.detail) : "",
2451
+ };
2452
+ },
2453
+
2454
+ toJSON(message: DryRunNonEmission): unknown {
2455
+ const obj: any = {};
2456
+ if (message.outcome !== 0) {
2457
+ obj.outcome = derivedMetricOutcomeToJSON(message.outcome);
2458
+ }
2459
+ if (message.detail !== "") {
2460
+ obj.detail = message.detail;
2461
+ }
2462
+ return obj;
2463
+ },
2464
+
2465
+ create<I extends Exact<DeepPartial<DryRunNonEmission>, I>>(base?: I): DryRunNonEmission {
2466
+ return DryRunNonEmission.fromPartial(base ?? ({} as any));
2467
+ },
2468
+ fromPartial<I extends Exact<DeepPartial<DryRunNonEmission>, I>>(object: I): DryRunNonEmission {
2469
+ const message = createBaseDryRunNonEmission();
2470
+ message.outcome = object.outcome ?? 0;
2471
+ message.detail = object.detail ?? "";
2472
+ return message;
2473
+ },
2474
+ };
2475
+
2476
+ function createBaseDerivedMetricOutcomeCount(): DerivedMetricOutcomeCount {
2477
+ return { outcome: 0, count: 0 };
2478
+ }
2479
+
2480
+ export const DerivedMetricOutcomeCount: MessageFns<DerivedMetricOutcomeCount> = {
2481
+ encode(message: DerivedMetricOutcomeCount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2482
+ if (message.outcome !== 0) {
2483
+ writer.uint32(8).int32(message.outcome);
2484
+ }
2485
+ if (message.count !== 0) {
2486
+ writer.uint32(16).uint32(message.count);
2487
+ }
2488
+ return writer;
2489
+ },
2490
+
2491
+ decode(input: BinaryReader | Uint8Array, length?: number): DerivedMetricOutcomeCount {
2492
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2493
+ const end = length === undefined ? reader.len : reader.pos + length;
2494
+ const message = createBaseDerivedMetricOutcomeCount();
2495
+ while (reader.pos < end) {
2496
+ const tag = reader.uint32();
2497
+ switch (tag >>> 3) {
2498
+ case 1: {
2499
+ if (tag !== 8) {
2500
+ break;
2501
+ }
2502
+
2503
+ message.outcome = reader.int32() as any;
2504
+ continue;
2505
+ }
2506
+ case 2: {
2507
+ if (tag !== 16) {
2508
+ break;
2509
+ }
2510
+
2511
+ message.count = reader.uint32();
2512
+ continue;
2513
+ }
2514
+ }
2515
+ if ((tag & 7) === 4 || tag === 0) {
2516
+ break;
2517
+ }
2518
+ reader.skip(tag & 7);
2519
+ }
2520
+ return message;
2521
+ },
2522
+
2523
+ fromJSON(object: any): DerivedMetricOutcomeCount {
2524
+ return {
2525
+ outcome: isSet(object.outcome) ? derivedMetricOutcomeFromJSON(object.outcome) : 0,
2526
+ count: isSet(object.count) ? globalThis.Number(object.count) : 0,
2527
+ };
2528
+ },
2529
+
2530
+ toJSON(message: DerivedMetricOutcomeCount): unknown {
2531
+ const obj: any = {};
2532
+ if (message.outcome !== 0) {
2533
+ obj.outcome = derivedMetricOutcomeToJSON(message.outcome);
2534
+ }
2535
+ if (message.count !== 0) {
2536
+ obj.count = Math.round(message.count);
2537
+ }
2538
+ return obj;
2539
+ },
2540
+
2541
+ create<I extends Exact<DeepPartial<DerivedMetricOutcomeCount>, I>>(base?: I): DerivedMetricOutcomeCount {
2542
+ return DerivedMetricOutcomeCount.fromPartial(base ?? ({} as any));
2543
+ },
2544
+ fromPartial<I extends Exact<DeepPartial<DerivedMetricOutcomeCount>, I>>(object: I): DerivedMetricOutcomeCount {
2545
+ const message = createBaseDerivedMetricOutcomeCount();
2546
+ message.outcome = object.outcome ?? 0;
2547
+ message.count = object.count ?? 0;
2548
+ return message;
2549
+ },
2550
+ };
2551
+
2552
+ function createBaseListDerivedMetricAttributesRequest(): ListDerivedMetricAttributesRequest {
2553
+ return { organizationId: "", projectId: "" };
2554
+ }
2555
+
2556
+ export const ListDerivedMetricAttributesRequest: MessageFns<ListDerivedMetricAttributesRequest> = {
2557
+ encode(message: ListDerivedMetricAttributesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2558
+ if (message.organizationId !== "") {
2559
+ writer.uint32(10).string(message.organizationId);
2560
+ }
2561
+ if (message.projectId !== "") {
2562
+ writer.uint32(18).string(message.projectId);
2563
+ }
2564
+ return writer;
2565
+ },
2566
+
2567
+ decode(input: BinaryReader | Uint8Array, length?: number): ListDerivedMetricAttributesRequest {
2568
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2569
+ const end = length === undefined ? reader.len : reader.pos + length;
2570
+ const message = createBaseListDerivedMetricAttributesRequest();
2571
+ while (reader.pos < end) {
2572
+ const tag = reader.uint32();
2573
+ switch (tag >>> 3) {
2574
+ case 1: {
2575
+ if (tag !== 10) {
2576
+ break;
2577
+ }
2578
+
2579
+ message.organizationId = reader.string();
2580
+ continue;
2581
+ }
2582
+ case 2: {
2583
+ if (tag !== 18) {
2584
+ break;
2585
+ }
2586
+
2587
+ message.projectId = reader.string();
2588
+ continue;
2589
+ }
2590
+ }
2591
+ if ((tag & 7) === 4 || tag === 0) {
2592
+ break;
2593
+ }
2594
+ reader.skip(tag & 7);
2595
+ }
2596
+ return message;
2597
+ },
2598
+
2599
+ fromJSON(object: any): ListDerivedMetricAttributesRequest {
2600
+ return {
2601
+ organizationId: isSet(object.organizationId)
2602
+ ? globalThis.String(object.organizationId)
2603
+ : isSet(object.organization_id)
2604
+ ? globalThis.String(object.organization_id)
2605
+ : "",
2606
+ projectId: isSet(object.projectId)
2607
+ ? globalThis.String(object.projectId)
2608
+ : isSet(object.project_id)
2609
+ ? globalThis.String(object.project_id)
2610
+ : "",
2611
+ };
2612
+ },
2613
+
2614
+ toJSON(message: ListDerivedMetricAttributesRequest): unknown {
2615
+ const obj: any = {};
2616
+ if (message.organizationId !== "") {
2617
+ obj.organizationId = message.organizationId;
2618
+ }
2619
+ if (message.projectId !== "") {
2620
+ obj.projectId = message.projectId;
2621
+ }
2622
+ return obj;
2623
+ },
2624
+
2625
+ create<I extends Exact<DeepPartial<ListDerivedMetricAttributesRequest>, I>>(
2626
+ base?: I,
2627
+ ): ListDerivedMetricAttributesRequest {
2628
+ return ListDerivedMetricAttributesRequest.fromPartial(base ?? ({} as any));
2629
+ },
2630
+ fromPartial<I extends Exact<DeepPartial<ListDerivedMetricAttributesRequest>, I>>(
2631
+ object: I,
2632
+ ): ListDerivedMetricAttributesRequest {
2633
+ const message = createBaseListDerivedMetricAttributesRequest();
2634
+ message.organizationId = object.organizationId ?? "";
2635
+ message.projectId = object.projectId ?? "";
2636
+ return message;
2637
+ },
2638
+ };
2639
+
2640
+ function createBaseListDerivedMetricAttributesResponse(): ListDerivedMetricAttributesResponse {
2641
+ return {
2642
+ status: undefined,
2643
+ traceAttributes: [],
2644
+ events: [],
2645
+ tracesSampled: 0,
2646
+ tracesSelected: 0,
2647
+ catalogCapped: false,
2648
+ };
2649
+ }
2650
+
2651
+ export const ListDerivedMetricAttributesResponse: MessageFns<ListDerivedMetricAttributesResponse> = {
2652
+ encode(message: ListDerivedMetricAttributesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2653
+ if (message.status !== undefined) {
2654
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2655
+ }
2656
+ for (const v of message.traceAttributes) {
2657
+ DerivedMetricAttribute.encode(v!, writer.uint32(18).fork()).join();
2658
+ }
2659
+ for (const v of message.events) {
2660
+ DerivedMetricEventAttributes.encode(v!, writer.uint32(26).fork()).join();
2661
+ }
2662
+ if (message.tracesSampled !== 0) {
2663
+ writer.uint32(32).uint32(message.tracesSampled);
2664
+ }
2665
+ if (message.tracesSelected !== 0) {
2666
+ writer.uint32(40).uint32(message.tracesSelected);
2667
+ }
2668
+ if (message.catalogCapped !== false) {
2669
+ writer.uint32(48).bool(message.catalogCapped);
2670
+ }
2671
+ return writer;
2672
+ },
2673
+
2674
+ decode(input: BinaryReader | Uint8Array, length?: number): ListDerivedMetricAttributesResponse {
2675
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2676
+ const end = length === undefined ? reader.len : reader.pos + length;
2677
+ const message = createBaseListDerivedMetricAttributesResponse();
2678
+ while (reader.pos < end) {
2679
+ const tag = reader.uint32();
2680
+ switch (tag >>> 3) {
2681
+ case 1: {
2682
+ if (tag !== 10) {
2683
+ break;
2684
+ }
2685
+
2686
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2687
+ continue;
2688
+ }
2689
+ case 2: {
2690
+ if (tag !== 18) {
2691
+ break;
2692
+ }
2693
+
2694
+ message.traceAttributes.push(DerivedMetricAttribute.decode(reader, reader.uint32()));
2695
+ continue;
2696
+ }
2697
+ case 3: {
2698
+ if (tag !== 26) {
2699
+ break;
2700
+ }
2701
+
2702
+ message.events.push(DerivedMetricEventAttributes.decode(reader, reader.uint32()));
2703
+ continue;
2704
+ }
2705
+ case 4: {
2706
+ if (tag !== 32) {
2707
+ break;
2708
+ }
2709
+
2710
+ message.tracesSampled = reader.uint32();
2711
+ continue;
2712
+ }
2713
+ case 5: {
2714
+ if (tag !== 40) {
2715
+ break;
2716
+ }
2717
+
2718
+ message.tracesSelected = reader.uint32();
2719
+ continue;
2720
+ }
2721
+ case 6: {
2722
+ if (tag !== 48) {
2723
+ break;
2724
+ }
2725
+
2726
+ message.catalogCapped = reader.bool();
2727
+ continue;
2728
+ }
2729
+ }
2730
+ if ((tag & 7) === 4 || tag === 0) {
2731
+ break;
2732
+ }
2733
+ reader.skip(tag & 7);
2734
+ }
2735
+ return message;
2736
+ },
2737
+
2738
+ fromJSON(object: any): ListDerivedMetricAttributesResponse {
2739
+ return {
2740
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2741
+ traceAttributes: globalThis.Array.isArray(object?.traceAttributes)
2742
+ ? object.traceAttributes.map((e: any) => DerivedMetricAttribute.fromJSON(e))
2743
+ : globalThis.Array.isArray(object?.trace_attributes)
2744
+ ? object.trace_attributes.map((e: any) => DerivedMetricAttribute.fromJSON(e))
2745
+ : [],
2746
+ events: globalThis.Array.isArray(object?.events)
2747
+ ? object.events.map((e: any) => DerivedMetricEventAttributes.fromJSON(e))
2748
+ : [],
2749
+ tracesSampled: isSet(object.tracesSampled)
2750
+ ? globalThis.Number(object.tracesSampled)
2751
+ : isSet(object.traces_sampled)
2752
+ ? globalThis.Number(object.traces_sampled)
2753
+ : 0,
2754
+ tracesSelected: isSet(object.tracesSelected)
2755
+ ? globalThis.Number(object.tracesSelected)
2756
+ : isSet(object.traces_selected)
2757
+ ? globalThis.Number(object.traces_selected)
2758
+ : 0,
2759
+ catalogCapped: isSet(object.catalogCapped)
2760
+ ? globalThis.Boolean(object.catalogCapped)
2761
+ : isSet(object.catalog_capped)
2762
+ ? globalThis.Boolean(object.catalog_capped)
2763
+ : false,
2764
+ };
2765
+ },
2766
+
2767
+ toJSON(message: ListDerivedMetricAttributesResponse): unknown {
2768
+ const obj: any = {};
2769
+ if (message.status !== undefined) {
2770
+ obj.status = ResponseStatus.toJSON(message.status);
2771
+ }
2772
+ if (message.traceAttributes?.length) {
2773
+ obj.traceAttributes = message.traceAttributes.map((e) => DerivedMetricAttribute.toJSON(e));
2774
+ }
2775
+ if (message.events?.length) {
2776
+ obj.events = message.events.map((e) => DerivedMetricEventAttributes.toJSON(e));
2777
+ }
2778
+ if (message.tracesSampled !== 0) {
2779
+ obj.tracesSampled = Math.round(message.tracesSampled);
2780
+ }
2781
+ if (message.tracesSelected !== 0) {
2782
+ obj.tracesSelected = Math.round(message.tracesSelected);
2783
+ }
2784
+ if (message.catalogCapped !== false) {
2785
+ obj.catalogCapped = message.catalogCapped;
2786
+ }
2787
+ return obj;
2788
+ },
2789
+
2790
+ create<I extends Exact<DeepPartial<ListDerivedMetricAttributesResponse>, I>>(
2791
+ base?: I,
2792
+ ): ListDerivedMetricAttributesResponse {
2793
+ return ListDerivedMetricAttributesResponse.fromPartial(base ?? ({} as any));
2794
+ },
2795
+ fromPartial<I extends Exact<DeepPartial<ListDerivedMetricAttributesResponse>, I>>(
2796
+ object: I,
2797
+ ): ListDerivedMetricAttributesResponse {
2798
+ const message = createBaseListDerivedMetricAttributesResponse();
2799
+ message.status = (object.status !== undefined && object.status !== null)
2800
+ ? ResponseStatus.fromPartial(object.status)
2801
+ : undefined;
2802
+ message.traceAttributes = object.traceAttributes?.map((e) => DerivedMetricAttribute.fromPartial(e)) || [];
2803
+ message.events = object.events?.map((e) => DerivedMetricEventAttributes.fromPartial(e)) || [];
2804
+ message.tracesSampled = object.tracesSampled ?? 0;
2805
+ message.tracesSelected = object.tracesSelected ?? 0;
2806
+ message.catalogCapped = object.catalogCapped ?? false;
2807
+ return message;
2808
+ },
2809
+ };
2810
+
2811
+ function createBaseDerivedMetricAttribute(): DerivedMetricAttribute {
2812
+ return { key: "", type: 0, sampleValues: [] };
2813
+ }
2814
+
2815
+ export const DerivedMetricAttribute: MessageFns<DerivedMetricAttribute> = {
2816
+ encode(message: DerivedMetricAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2817
+ if (message.key !== "") {
2818
+ writer.uint32(10).string(message.key);
2819
+ }
2820
+ if (message.type !== 0) {
2821
+ writer.uint32(16).int32(message.type);
2822
+ }
2823
+ for (const v of message.sampleValues) {
2824
+ writer.uint32(26).string(v!);
2825
+ }
2826
+ return writer;
2827
+ },
2828
+
2829
+ decode(input: BinaryReader | Uint8Array, length?: number): DerivedMetricAttribute {
2830
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2831
+ const end = length === undefined ? reader.len : reader.pos + length;
2832
+ const message = createBaseDerivedMetricAttribute();
2833
+ while (reader.pos < end) {
2834
+ const tag = reader.uint32();
2835
+ switch (tag >>> 3) {
2836
+ case 1: {
2837
+ if (tag !== 10) {
2838
+ break;
2839
+ }
2840
+
2841
+ message.key = reader.string();
2842
+ continue;
2843
+ }
2844
+ case 2: {
2845
+ if (tag !== 16) {
2846
+ break;
2847
+ }
2848
+
2849
+ message.type = reader.int32() as any;
2850
+ continue;
2851
+ }
2852
+ case 3: {
2853
+ if (tag !== 26) {
2854
+ break;
2855
+ }
2856
+
2857
+ message.sampleValues.push(reader.string());
2858
+ continue;
2859
+ }
2860
+ }
2861
+ if ((tag & 7) === 4 || tag === 0) {
2862
+ break;
2863
+ }
2864
+ reader.skip(tag & 7);
2865
+ }
2866
+ return message;
2867
+ },
2868
+
2869
+ fromJSON(object: any): DerivedMetricAttribute {
2870
+ return {
2871
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
2872
+ type: isSet(object.type) ? derivedMetricAttributeTypeFromJSON(object.type) : 0,
2873
+ sampleValues: globalThis.Array.isArray(object?.sampleValues)
2874
+ ? object.sampleValues.map((e: any) => globalThis.String(e))
2875
+ : globalThis.Array.isArray(object?.sample_values)
2876
+ ? object.sample_values.map((e: any) => globalThis.String(e))
2877
+ : [],
2878
+ };
2879
+ },
2880
+
2881
+ toJSON(message: DerivedMetricAttribute): unknown {
2882
+ const obj: any = {};
2883
+ if (message.key !== "") {
2884
+ obj.key = message.key;
2885
+ }
2886
+ if (message.type !== 0) {
2887
+ obj.type = derivedMetricAttributeTypeToJSON(message.type);
2888
+ }
2889
+ if (message.sampleValues?.length) {
2890
+ obj.sampleValues = message.sampleValues;
2891
+ }
2892
+ return obj;
2893
+ },
2894
+
2895
+ create<I extends Exact<DeepPartial<DerivedMetricAttribute>, I>>(base?: I): DerivedMetricAttribute {
2896
+ return DerivedMetricAttribute.fromPartial(base ?? ({} as any));
2897
+ },
2898
+ fromPartial<I extends Exact<DeepPartial<DerivedMetricAttribute>, I>>(object: I): DerivedMetricAttribute {
2899
+ const message = createBaseDerivedMetricAttribute();
2900
+ message.key = object.key ?? "";
2901
+ message.type = object.type ?? 0;
2902
+ message.sampleValues = object.sampleValues?.map((e) => e) || [];
2903
+ return message;
2904
+ },
2905
+ };
2906
+
2907
+ function createBaseDerivedMetricEventAttributes(): DerivedMetricEventAttributes {
2908
+ return { name: "", attributes: [] };
2909
+ }
2910
+
2911
+ export const DerivedMetricEventAttributes: MessageFns<DerivedMetricEventAttributes> = {
2912
+ encode(message: DerivedMetricEventAttributes, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2913
+ if (message.name !== "") {
2914
+ writer.uint32(10).string(message.name);
2915
+ }
2916
+ for (const v of message.attributes) {
2917
+ DerivedMetricAttribute.encode(v!, writer.uint32(18).fork()).join();
2918
+ }
2919
+ return writer;
2920
+ },
2921
+
2922
+ decode(input: BinaryReader | Uint8Array, length?: number): DerivedMetricEventAttributes {
2923
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2924
+ const end = length === undefined ? reader.len : reader.pos + length;
2925
+ const message = createBaseDerivedMetricEventAttributes();
2926
+ while (reader.pos < end) {
2927
+ const tag = reader.uint32();
2928
+ switch (tag >>> 3) {
2929
+ case 1: {
2930
+ if (tag !== 10) {
2931
+ break;
2932
+ }
2933
+
2934
+ message.name = reader.string();
2935
+ continue;
2936
+ }
2937
+ case 2: {
2938
+ if (tag !== 18) {
2939
+ break;
2940
+ }
2941
+
2942
+ message.attributes.push(DerivedMetricAttribute.decode(reader, reader.uint32()));
2943
+ continue;
2944
+ }
2945
+ }
2946
+ if ((tag & 7) === 4 || tag === 0) {
2947
+ break;
2948
+ }
2949
+ reader.skip(tag & 7);
2950
+ }
2951
+ return message;
2952
+ },
2953
+
2954
+ fromJSON(object: any): DerivedMetricEventAttributes {
2955
+ return {
2956
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
2957
+ attributes: globalThis.Array.isArray(object?.attributes)
2958
+ ? object.attributes.map((e: any) => DerivedMetricAttribute.fromJSON(e))
2959
+ : [],
2960
+ };
2961
+ },
2962
+
2963
+ toJSON(message: DerivedMetricEventAttributes): unknown {
2964
+ const obj: any = {};
2965
+ if (message.name !== "") {
2966
+ obj.name = message.name;
2967
+ }
2968
+ if (message.attributes?.length) {
2969
+ obj.attributes = message.attributes.map((e) => DerivedMetricAttribute.toJSON(e));
2970
+ }
2971
+ return obj;
2972
+ },
2973
+
2974
+ create<I extends Exact<DeepPartial<DerivedMetricEventAttributes>, I>>(base?: I): DerivedMetricEventAttributes {
2975
+ return DerivedMetricEventAttributes.fromPartial(base ?? ({} as any));
2976
+ },
2977
+ fromPartial<I extends Exact<DeepPartial<DerivedMetricEventAttributes>, I>>(object: I): DerivedMetricEventAttributes {
2978
+ const message = createBaseDerivedMetricEventAttributes();
2979
+ message.name = object.name ?? "";
2980
+ message.attributes = object.attributes?.map((e) => DerivedMetricAttribute.fromPartial(e)) || [];
2981
+ return message;
2982
+ },
2983
+ };
2984
+
2985
+ /**
2986
+ * DerivedMetricGatewayService provides web client access to derived metrics: definitions that turn
2987
+ * each finished trace into one gauge datapoint. The resulting series is queried through
2988
+ * MetricGatewayService.
2989
+ */
2990
+ export interface DerivedMetricGatewayService {
2991
+ CreateDerivedMetric(request: CreateDerivedMetricRequest, metadata?: Metadata): Promise<CreateDerivedMetricResponse>;
2992
+ GetDerivedMetric(request: GetDerivedMetricRequest, metadata?: Metadata): Promise<GetDerivedMetricResponse>;
2993
+ ListDerivedMetrics(request: ListDerivedMetricsRequest, metadata?: Metadata): Promise<ListDerivedMetricsResponse>;
2994
+ UpdateDerivedMetric(request: UpdateDerivedMetricRequest, metadata?: Metadata): Promise<UpdateDerivedMetricResponse>;
2995
+ DeleteDerivedMetric(request: DeleteDerivedMetricRequest, metadata?: Metadata): Promise<DeleteDerivedMetricResponse>;
2996
+ /** Evaluates an unsaved program against recent finished traces; persists nothing. */
2997
+ DryRunDerivedMetric(request: DryRunDerivedMetricRequest, metadata?: Metadata): Promise<DryRunDerivedMetricResponse>;
2998
+ /**
2999
+ * The authoring catalog: attribute keys, types and sample values observed on recent finished
3000
+ * traces -- trace-level and per-event -- so a builder offers real keys instead of free text.
3001
+ */
3002
+ ListDerivedMetricAttributes(
3003
+ request: ListDerivedMetricAttributesRequest,
3004
+ metadata?: Metadata,
3005
+ ): Promise<ListDerivedMetricAttributesResponse>;
3006
+ }
3007
+
3008
+ export const DerivedMetricGatewayServiceServiceName = "gateway.web.v1.DerivedMetricGatewayService";
3009
+ export class DerivedMetricGatewayServiceClientImpl implements DerivedMetricGatewayService {
3010
+ private readonly rpc: Rpc;
3011
+ private readonly service: string;
3012
+ constructor(rpc: Rpc, opts?: { service?: string }) {
3013
+ this.service = opts?.service || DerivedMetricGatewayServiceServiceName;
3014
+ this.rpc = rpc;
3015
+ this.CreateDerivedMetric = this.CreateDerivedMetric.bind(this);
3016
+ this.GetDerivedMetric = this.GetDerivedMetric.bind(this);
3017
+ this.ListDerivedMetrics = this.ListDerivedMetrics.bind(this);
3018
+ this.UpdateDerivedMetric = this.UpdateDerivedMetric.bind(this);
3019
+ this.DeleteDerivedMetric = this.DeleteDerivedMetric.bind(this);
3020
+ this.DryRunDerivedMetric = this.DryRunDerivedMetric.bind(this);
3021
+ this.ListDerivedMetricAttributes = this.ListDerivedMetricAttributes.bind(this);
3022
+ }
3023
+ CreateDerivedMetric(request: CreateDerivedMetricRequest, metadata?: Metadata): Promise<CreateDerivedMetricResponse> {
3024
+ const data = CreateDerivedMetricRequest.encode(request).finish();
3025
+ const promise = this.rpc.request(this.service, "CreateDerivedMetric", data, metadata);
3026
+ return promise.then((data) => CreateDerivedMetricResponse.decode(new BinaryReader(data)));
3027
+ }
3028
+
3029
+ GetDerivedMetric(request: GetDerivedMetricRequest, metadata?: Metadata): Promise<GetDerivedMetricResponse> {
3030
+ const data = GetDerivedMetricRequest.encode(request).finish();
3031
+ const promise = this.rpc.request(this.service, "GetDerivedMetric", data, metadata);
3032
+ return promise.then((data) => GetDerivedMetricResponse.decode(new BinaryReader(data)));
3033
+ }
3034
+
3035
+ ListDerivedMetrics(request: ListDerivedMetricsRequest, metadata?: Metadata): Promise<ListDerivedMetricsResponse> {
3036
+ const data = ListDerivedMetricsRequest.encode(request).finish();
3037
+ const promise = this.rpc.request(this.service, "ListDerivedMetrics", data, metadata);
3038
+ return promise.then((data) => ListDerivedMetricsResponse.decode(new BinaryReader(data)));
3039
+ }
3040
+
3041
+ UpdateDerivedMetric(request: UpdateDerivedMetricRequest, metadata?: Metadata): Promise<UpdateDerivedMetricResponse> {
3042
+ const data = UpdateDerivedMetricRequest.encode(request).finish();
3043
+ const promise = this.rpc.request(this.service, "UpdateDerivedMetric", data, metadata);
3044
+ return promise.then((data) => UpdateDerivedMetricResponse.decode(new BinaryReader(data)));
3045
+ }
3046
+
3047
+ DeleteDerivedMetric(request: DeleteDerivedMetricRequest, metadata?: Metadata): Promise<DeleteDerivedMetricResponse> {
3048
+ const data = DeleteDerivedMetricRequest.encode(request).finish();
3049
+ const promise = this.rpc.request(this.service, "DeleteDerivedMetric", data, metadata);
3050
+ return promise.then((data) => DeleteDerivedMetricResponse.decode(new BinaryReader(data)));
3051
+ }
3052
+
3053
+ DryRunDerivedMetric(request: DryRunDerivedMetricRequest, metadata?: Metadata): Promise<DryRunDerivedMetricResponse> {
3054
+ const data = DryRunDerivedMetricRequest.encode(request).finish();
3055
+ const promise = this.rpc.request(this.service, "DryRunDerivedMetric", data, metadata);
3056
+ return promise.then((data) => DryRunDerivedMetricResponse.decode(new BinaryReader(data)));
3057
+ }
3058
+
3059
+ ListDerivedMetricAttributes(
3060
+ request: ListDerivedMetricAttributesRequest,
3061
+ metadata?: Metadata,
3062
+ ): Promise<ListDerivedMetricAttributesResponse> {
3063
+ const data = ListDerivedMetricAttributesRequest.encode(request).finish();
3064
+ const promise = this.rpc.request(this.service, "ListDerivedMetricAttributes", data, metadata);
3065
+ return promise.then((data) => ListDerivedMetricAttributesResponse.decode(new BinaryReader(data)));
3066
+ }
3067
+ }
3068
+
3069
+ interface Rpc {
3070
+ request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise<Uint8Array>;
3071
+ }
3072
+
3073
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
3074
+
3075
+ export type DeepPartial<T> = T extends Builtin ? T
3076
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
3077
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
3078
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
3079
+ : Partial<T>;
3080
+
3081
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
3082
+ export type Exact<P, I extends P> = P extends Builtin ? P
3083
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
3084
+
3085
+ function toTimestamp(date: Date): Timestamp {
3086
+ const seconds = Math.trunc(date.getTime() / 1_000);
3087
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
3088
+ return { seconds, nanos };
3089
+ }
3090
+
3091
+ function fromTimestamp(t: Timestamp): Date {
3092
+ let millis = (t.seconds || 0) * 1_000;
3093
+ millis += (t.nanos || 0) / 1_000_000;
3094
+ return new globalThis.Date(millis);
3095
+ }
3096
+
3097
+ function fromJsonTimestamp(o: any): Date {
3098
+ if (o instanceof globalThis.Date) {
3099
+ return o;
3100
+ } else if (typeof o === "string") {
3101
+ return new globalThis.Date(o);
3102
+ } else {
3103
+ return fromTimestamp(Timestamp.fromJSON(o));
3104
+ }
3105
+ }
3106
+
3107
+ function isObject(value: any): boolean {
3108
+ return typeof value === "object" && value !== null;
3109
+ }
3110
+
3111
+ function isSet(value: any): boolean {
3112
+ return value !== null && value !== undefined;
3113
+ }
3114
+
3115
+ export interface MessageFns<T> {
3116
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
3117
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
3118
+ fromJSON(object: any): T;
3119
+ toJSON(message: T): unknown;
3120
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
3121
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
3122
+ }