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