@ssoeasy-dev/proto 1.1.0-beta.1

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,627 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc unknown
5
+ // source: auth/v1/verification.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import type { CallContext, CallOptions } from "nice-grpc-common";
10
+ import { StatusResponse } from "../../common/v1/types";
11
+
12
+ export enum VerificationType {
13
+ VERIFICATION_TYPE_UNSPECIFIED = "VERIFICATION_TYPE_UNSPECIFIED",
14
+ VERIFICATION_TYPE_EMAIL_CODE = "VERIFICATION_TYPE_EMAIL_CODE",
15
+ VERIFICATION_TYPE_EMAIL_LINK = "VERIFICATION_TYPE_EMAIL_LINK",
16
+ UNRECOGNIZED = "UNRECOGNIZED",
17
+ }
18
+
19
+ export function verificationTypeFromJSON(object: any): VerificationType {
20
+ switch (object) {
21
+ case 0:
22
+ case "VERIFICATION_TYPE_UNSPECIFIED":
23
+ return VerificationType.VERIFICATION_TYPE_UNSPECIFIED;
24
+ case 1:
25
+ case "VERIFICATION_TYPE_EMAIL_CODE":
26
+ return VerificationType.VERIFICATION_TYPE_EMAIL_CODE;
27
+ case 2:
28
+ case "VERIFICATION_TYPE_EMAIL_LINK":
29
+ return VerificationType.VERIFICATION_TYPE_EMAIL_LINK;
30
+ case -1:
31
+ case "UNRECOGNIZED":
32
+ default:
33
+ return VerificationType.UNRECOGNIZED;
34
+ }
35
+ }
36
+
37
+ export function verificationTypeToJSON(object: VerificationType): string {
38
+ switch (object) {
39
+ case VerificationType.VERIFICATION_TYPE_UNSPECIFIED:
40
+ return "VERIFICATION_TYPE_UNSPECIFIED";
41
+ case VerificationType.VERIFICATION_TYPE_EMAIL_CODE:
42
+ return "VERIFICATION_TYPE_EMAIL_CODE";
43
+ case VerificationType.VERIFICATION_TYPE_EMAIL_LINK:
44
+ return "VERIFICATION_TYPE_EMAIL_LINK";
45
+ case VerificationType.UNRECOGNIZED:
46
+ default:
47
+ return "UNRECOGNIZED";
48
+ }
49
+ }
50
+
51
+ export function verificationTypeToNumber(object: VerificationType): number {
52
+ switch (object) {
53
+ case VerificationType.VERIFICATION_TYPE_UNSPECIFIED:
54
+ return 0;
55
+ case VerificationType.VERIFICATION_TYPE_EMAIL_CODE:
56
+ return 1;
57
+ case VerificationType.VERIFICATION_TYPE_EMAIL_LINK:
58
+ return 2;
59
+ case VerificationType.UNRECOGNIZED:
60
+ default:
61
+ return -1;
62
+ }
63
+ }
64
+
65
+ export enum VerificationStatus {
66
+ VERIFICATION_STATUS_UNSPECIFIED = "VERIFICATION_STATUS_UNSPECIFIED",
67
+ VERIFICATION_STATUS_WAIT = "VERIFICATION_STATUS_WAIT",
68
+ VERIFICATION_STATUS_EXPIRES = "VERIFICATION_STATUS_EXPIRES",
69
+ VERIFICATION_STATUS_VERIFIED = "VERIFICATION_STATUS_VERIFIED",
70
+ UNRECOGNIZED = "UNRECOGNIZED",
71
+ }
72
+
73
+ export function verificationStatusFromJSON(object: any): VerificationStatus {
74
+ switch (object) {
75
+ case 0:
76
+ case "VERIFICATION_STATUS_UNSPECIFIED":
77
+ return VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED;
78
+ case 1:
79
+ case "VERIFICATION_STATUS_WAIT":
80
+ return VerificationStatus.VERIFICATION_STATUS_WAIT;
81
+ case 2:
82
+ case "VERIFICATION_STATUS_EXPIRES":
83
+ return VerificationStatus.VERIFICATION_STATUS_EXPIRES;
84
+ case 3:
85
+ case "VERIFICATION_STATUS_VERIFIED":
86
+ return VerificationStatus.VERIFICATION_STATUS_VERIFIED;
87
+ case -1:
88
+ case "UNRECOGNIZED":
89
+ default:
90
+ return VerificationStatus.UNRECOGNIZED;
91
+ }
92
+ }
93
+
94
+ export function verificationStatusToJSON(object: VerificationStatus): string {
95
+ switch (object) {
96
+ case VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED:
97
+ return "VERIFICATION_STATUS_UNSPECIFIED";
98
+ case VerificationStatus.VERIFICATION_STATUS_WAIT:
99
+ return "VERIFICATION_STATUS_WAIT";
100
+ case VerificationStatus.VERIFICATION_STATUS_EXPIRES:
101
+ return "VERIFICATION_STATUS_EXPIRES";
102
+ case VerificationStatus.VERIFICATION_STATUS_VERIFIED:
103
+ return "VERIFICATION_STATUS_VERIFIED";
104
+ case VerificationStatus.UNRECOGNIZED:
105
+ default:
106
+ return "UNRECOGNIZED";
107
+ }
108
+ }
109
+
110
+ export function verificationStatusToNumber(object: VerificationStatus): number {
111
+ switch (object) {
112
+ case VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED:
113
+ return 0;
114
+ case VerificationStatus.VERIFICATION_STATUS_WAIT:
115
+ return 1;
116
+ case VerificationStatus.VERIFICATION_STATUS_EXPIRES:
117
+ return 2;
118
+ case VerificationStatus.VERIFICATION_STATUS_VERIFIED:
119
+ return 3;
120
+ case VerificationStatus.UNRECOGNIZED:
121
+ default:
122
+ return -1;
123
+ }
124
+ }
125
+
126
+ export interface Verification {
127
+ $type: "auth.v1.Verification";
128
+ id: string;
129
+ value: string;
130
+ expiresAt: number;
131
+ }
132
+
133
+ export interface VerificateRequest {
134
+ $type: "auth.v1.VerificateRequest";
135
+ id: string;
136
+ value: string;
137
+ }
138
+
139
+ export interface RefreshRequest {
140
+ $type: "auth.v1.RefreshRequest";
141
+ userId: string;
142
+ type: VerificationType;
143
+ }
144
+
145
+ export interface CheckStatusRequest {
146
+ $type: "auth.v1.CheckStatusRequest";
147
+ id: string;
148
+ }
149
+
150
+ export interface CheckStatusResponse {
151
+ $type: "auth.v1.CheckStatusResponse";
152
+ status: VerificationStatus;
153
+ }
154
+
155
+ function createBaseVerification(): Verification {
156
+ return { $type: "auth.v1.Verification", id: "", value: "", expiresAt: 0 };
157
+ }
158
+
159
+ export const Verification: MessageFns<Verification, "auth.v1.Verification"> = {
160
+ $type: "auth.v1.Verification" as const,
161
+
162
+ encode(message: Verification, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
163
+ if (message.id !== "") {
164
+ writer.uint32(10).string(message.id);
165
+ }
166
+ if (message.value !== "") {
167
+ writer.uint32(18).string(message.value);
168
+ }
169
+ if (message.expiresAt !== 0) {
170
+ writer.uint32(24).int64(message.expiresAt);
171
+ }
172
+ return writer;
173
+ },
174
+
175
+ decode(input: BinaryReader | Uint8Array, length?: number): Verification {
176
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
177
+ const end = length === undefined ? reader.len : reader.pos + length;
178
+ const message = createBaseVerification();
179
+ while (reader.pos < end) {
180
+ const tag = reader.uint32();
181
+ switch (tag >>> 3) {
182
+ case 1: {
183
+ if (tag !== 10) {
184
+ break;
185
+ }
186
+
187
+ message.id = reader.string();
188
+ continue;
189
+ }
190
+ case 2: {
191
+ if (tag !== 18) {
192
+ break;
193
+ }
194
+
195
+ message.value = reader.string();
196
+ continue;
197
+ }
198
+ case 3: {
199
+ if (tag !== 24) {
200
+ break;
201
+ }
202
+
203
+ message.expiresAt = longToNumber(reader.int64());
204
+ continue;
205
+ }
206
+ }
207
+ if ((tag & 7) === 4 || tag === 0) {
208
+ break;
209
+ }
210
+ reader.skip(tag & 7);
211
+ }
212
+ return message;
213
+ },
214
+
215
+ fromJSON(object: any): Verification {
216
+ return {
217
+ $type: Verification.$type,
218
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
219
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
220
+ expiresAt: isSet(object.expiresAt)
221
+ ? globalThis.Number(object.expiresAt)
222
+ : isSet(object.expires_at)
223
+ ? globalThis.Number(object.expires_at)
224
+ : 0,
225
+ };
226
+ },
227
+
228
+ toJSON(message: Verification): unknown {
229
+ const obj: any = {};
230
+ if (message.id !== "") {
231
+ obj.id = message.id;
232
+ }
233
+ if (message.value !== "") {
234
+ obj.value = message.value;
235
+ }
236
+ if (message.expiresAt !== 0) {
237
+ obj.expiresAt = Math.round(message.expiresAt);
238
+ }
239
+ return obj;
240
+ },
241
+
242
+ create<I extends Exact<DeepPartial<Verification>, I>>(base?: I): Verification {
243
+ return Verification.fromPartial(base ?? ({} as any));
244
+ },
245
+ fromPartial<I extends Exact<DeepPartial<Verification>, I>>(object: I): Verification {
246
+ const message = createBaseVerification();
247
+ message.id = object.id ?? "";
248
+ message.value = object.value ?? "";
249
+ message.expiresAt = object.expiresAt ?? 0;
250
+ return message;
251
+ },
252
+ };
253
+
254
+ function createBaseVerificateRequest(): VerificateRequest {
255
+ return { $type: "auth.v1.VerificateRequest", id: "", value: "" };
256
+ }
257
+
258
+ export const VerificateRequest: MessageFns<VerificateRequest, "auth.v1.VerificateRequest"> = {
259
+ $type: "auth.v1.VerificateRequest" as const,
260
+
261
+ encode(message: VerificateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
262
+ if (message.id !== "") {
263
+ writer.uint32(10).string(message.id);
264
+ }
265
+ if (message.value !== "") {
266
+ writer.uint32(18).string(message.value);
267
+ }
268
+ return writer;
269
+ },
270
+
271
+ decode(input: BinaryReader | Uint8Array, length?: number): VerificateRequest {
272
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
273
+ const end = length === undefined ? reader.len : reader.pos + length;
274
+ const message = createBaseVerificateRequest();
275
+ while (reader.pos < end) {
276
+ const tag = reader.uint32();
277
+ switch (tag >>> 3) {
278
+ case 1: {
279
+ if (tag !== 10) {
280
+ break;
281
+ }
282
+
283
+ message.id = reader.string();
284
+ continue;
285
+ }
286
+ case 2: {
287
+ if (tag !== 18) {
288
+ break;
289
+ }
290
+
291
+ message.value = reader.string();
292
+ continue;
293
+ }
294
+ }
295
+ if ((tag & 7) === 4 || tag === 0) {
296
+ break;
297
+ }
298
+ reader.skip(tag & 7);
299
+ }
300
+ return message;
301
+ },
302
+
303
+ fromJSON(object: any): VerificateRequest {
304
+ return {
305
+ $type: VerificateRequest.$type,
306
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
307
+ value: isSet(object.value) ? globalThis.String(object.value) : "",
308
+ };
309
+ },
310
+
311
+ toJSON(message: VerificateRequest): unknown {
312
+ const obj: any = {};
313
+ if (message.id !== "") {
314
+ obj.id = message.id;
315
+ }
316
+ if (message.value !== "") {
317
+ obj.value = message.value;
318
+ }
319
+ return obj;
320
+ },
321
+
322
+ create<I extends Exact<DeepPartial<VerificateRequest>, I>>(base?: I): VerificateRequest {
323
+ return VerificateRequest.fromPartial(base ?? ({} as any));
324
+ },
325
+ fromPartial<I extends Exact<DeepPartial<VerificateRequest>, I>>(object: I): VerificateRequest {
326
+ const message = createBaseVerificateRequest();
327
+ message.id = object.id ?? "";
328
+ message.value = object.value ?? "";
329
+ return message;
330
+ },
331
+ };
332
+
333
+ function createBaseRefreshRequest(): RefreshRequest {
334
+ return { $type: "auth.v1.RefreshRequest", userId: "", type: VerificationType.VERIFICATION_TYPE_UNSPECIFIED };
335
+ }
336
+
337
+ export const RefreshRequest: MessageFns<RefreshRequest, "auth.v1.RefreshRequest"> = {
338
+ $type: "auth.v1.RefreshRequest" as const,
339
+
340
+ encode(message: RefreshRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
341
+ if (message.userId !== "") {
342
+ writer.uint32(10).string(message.userId);
343
+ }
344
+ if (message.type !== VerificationType.VERIFICATION_TYPE_UNSPECIFIED) {
345
+ writer.uint32(16).int32(verificationTypeToNumber(message.type));
346
+ }
347
+ return writer;
348
+ },
349
+
350
+ decode(input: BinaryReader | Uint8Array, length?: number): RefreshRequest {
351
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
352
+ const end = length === undefined ? reader.len : reader.pos + length;
353
+ const message = createBaseRefreshRequest();
354
+ while (reader.pos < end) {
355
+ const tag = reader.uint32();
356
+ switch (tag >>> 3) {
357
+ case 1: {
358
+ if (tag !== 10) {
359
+ break;
360
+ }
361
+
362
+ message.userId = reader.string();
363
+ continue;
364
+ }
365
+ case 2: {
366
+ if (tag !== 16) {
367
+ break;
368
+ }
369
+
370
+ message.type = verificationTypeFromJSON(reader.int32());
371
+ continue;
372
+ }
373
+ }
374
+ if ((tag & 7) === 4 || tag === 0) {
375
+ break;
376
+ }
377
+ reader.skip(tag & 7);
378
+ }
379
+ return message;
380
+ },
381
+
382
+ fromJSON(object: any): RefreshRequest {
383
+ return {
384
+ $type: RefreshRequest.$type,
385
+ userId: isSet(object.userId)
386
+ ? globalThis.String(object.userId)
387
+ : isSet(object.user_id)
388
+ ? globalThis.String(object.user_id)
389
+ : "",
390
+ type: isSet(object.type) ? verificationTypeFromJSON(object.type) : VerificationType.VERIFICATION_TYPE_UNSPECIFIED,
391
+ };
392
+ },
393
+
394
+ toJSON(message: RefreshRequest): unknown {
395
+ const obj: any = {};
396
+ if (message.userId !== "") {
397
+ obj.userId = message.userId;
398
+ }
399
+ if (message.type !== VerificationType.VERIFICATION_TYPE_UNSPECIFIED) {
400
+ obj.type = verificationTypeToJSON(message.type);
401
+ }
402
+ return obj;
403
+ },
404
+
405
+ create<I extends Exact<DeepPartial<RefreshRequest>, I>>(base?: I): RefreshRequest {
406
+ return RefreshRequest.fromPartial(base ?? ({} as any));
407
+ },
408
+ fromPartial<I extends Exact<DeepPartial<RefreshRequest>, I>>(object: I): RefreshRequest {
409
+ const message = createBaseRefreshRequest();
410
+ message.userId = object.userId ?? "";
411
+ message.type = object.type ?? VerificationType.VERIFICATION_TYPE_UNSPECIFIED;
412
+ return message;
413
+ },
414
+ };
415
+
416
+ function createBaseCheckStatusRequest(): CheckStatusRequest {
417
+ return { $type: "auth.v1.CheckStatusRequest", id: "" };
418
+ }
419
+
420
+ export const CheckStatusRequest: MessageFns<CheckStatusRequest, "auth.v1.CheckStatusRequest"> = {
421
+ $type: "auth.v1.CheckStatusRequest" as const,
422
+
423
+ encode(message: CheckStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
424
+ if (message.id !== "") {
425
+ writer.uint32(10).string(message.id);
426
+ }
427
+ return writer;
428
+ },
429
+
430
+ decode(input: BinaryReader | Uint8Array, length?: number): CheckStatusRequest {
431
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
432
+ const end = length === undefined ? reader.len : reader.pos + length;
433
+ const message = createBaseCheckStatusRequest();
434
+ while (reader.pos < end) {
435
+ const tag = reader.uint32();
436
+ switch (tag >>> 3) {
437
+ case 1: {
438
+ if (tag !== 10) {
439
+ break;
440
+ }
441
+
442
+ message.id = reader.string();
443
+ continue;
444
+ }
445
+ }
446
+ if ((tag & 7) === 4 || tag === 0) {
447
+ break;
448
+ }
449
+ reader.skip(tag & 7);
450
+ }
451
+ return message;
452
+ },
453
+
454
+ fromJSON(object: any): CheckStatusRequest {
455
+ return { $type: CheckStatusRequest.$type, id: isSet(object.id) ? globalThis.String(object.id) : "" };
456
+ },
457
+
458
+ toJSON(message: CheckStatusRequest): unknown {
459
+ const obj: any = {};
460
+ if (message.id !== "") {
461
+ obj.id = message.id;
462
+ }
463
+ return obj;
464
+ },
465
+
466
+ create<I extends Exact<DeepPartial<CheckStatusRequest>, I>>(base?: I): CheckStatusRequest {
467
+ return CheckStatusRequest.fromPartial(base ?? ({} as any));
468
+ },
469
+ fromPartial<I extends Exact<DeepPartial<CheckStatusRequest>, I>>(object: I): CheckStatusRequest {
470
+ const message = createBaseCheckStatusRequest();
471
+ message.id = object.id ?? "";
472
+ return message;
473
+ },
474
+ };
475
+
476
+ function createBaseCheckStatusResponse(): CheckStatusResponse {
477
+ return { $type: "auth.v1.CheckStatusResponse", status: VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED };
478
+ }
479
+
480
+ export const CheckStatusResponse: MessageFns<CheckStatusResponse, "auth.v1.CheckStatusResponse"> = {
481
+ $type: "auth.v1.CheckStatusResponse" as const,
482
+
483
+ encode(message: CheckStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
484
+ if (message.status !== VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED) {
485
+ writer.uint32(8).int32(verificationStatusToNumber(message.status));
486
+ }
487
+ return writer;
488
+ },
489
+
490
+ decode(input: BinaryReader | Uint8Array, length?: number): CheckStatusResponse {
491
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
492
+ const end = length === undefined ? reader.len : reader.pos + length;
493
+ const message = createBaseCheckStatusResponse();
494
+ while (reader.pos < end) {
495
+ const tag = reader.uint32();
496
+ switch (tag >>> 3) {
497
+ case 1: {
498
+ if (tag !== 8) {
499
+ break;
500
+ }
501
+
502
+ message.status = verificationStatusFromJSON(reader.int32());
503
+ continue;
504
+ }
505
+ }
506
+ if ((tag & 7) === 4 || tag === 0) {
507
+ break;
508
+ }
509
+ reader.skip(tag & 7);
510
+ }
511
+ return message;
512
+ },
513
+
514
+ fromJSON(object: any): CheckStatusResponse {
515
+ return {
516
+ $type: CheckStatusResponse.$type,
517
+ status: isSet(object.status)
518
+ ? verificationStatusFromJSON(object.status)
519
+ : VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED,
520
+ };
521
+ },
522
+
523
+ toJSON(message: CheckStatusResponse): unknown {
524
+ const obj: any = {};
525
+ if (message.status !== VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED) {
526
+ obj.status = verificationStatusToJSON(message.status);
527
+ }
528
+ return obj;
529
+ },
530
+
531
+ create<I extends Exact<DeepPartial<CheckStatusResponse>, I>>(base?: I): CheckStatusResponse {
532
+ return CheckStatusResponse.fromPartial(base ?? ({} as any));
533
+ },
534
+ fromPartial<I extends Exact<DeepPartial<CheckStatusResponse>, I>>(object: I): CheckStatusResponse {
535
+ const message = createBaseCheckStatusResponse();
536
+ message.status = object.status ?? VerificationStatus.VERIFICATION_STATUS_UNSPECIFIED;
537
+ return message;
538
+ },
539
+ };
540
+
541
+ export type VerificationServiceDefinition = typeof VerificationServiceDefinition;
542
+ export const VerificationServiceDefinition = {
543
+ name: "VerificationService",
544
+ fullName: "auth.v1.VerificationService",
545
+ methods: {
546
+ verificate: {
547
+ name: "Verificate",
548
+ requestType: VerificateRequest as typeof VerificateRequest,
549
+ requestStream: false,
550
+ responseType: StatusResponse as typeof StatusResponse,
551
+ responseStream: false,
552
+ options: {},
553
+ },
554
+ refresh: {
555
+ name: "Refresh",
556
+ requestType: RefreshRequest as typeof RefreshRequest,
557
+ requestStream: false,
558
+ responseType: Verification as typeof Verification,
559
+ responseStream: false,
560
+ options: {},
561
+ },
562
+ checkStatus: {
563
+ name: "CheckStatus",
564
+ requestType: CheckStatusRequest as typeof CheckStatusRequest,
565
+ requestStream: false,
566
+ responseType: CheckStatusResponse as typeof CheckStatusResponse,
567
+ responseStream: false,
568
+ options: {},
569
+ },
570
+ },
571
+ } as const;
572
+
573
+ export interface VerificationServiceImplementation<CallContextExt = {}> {
574
+ verificate(request: VerificateRequest, context: CallContext & CallContextExt): Promise<DeepPartial<StatusResponse>>;
575
+ refresh(request: RefreshRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Verification>>;
576
+ checkStatus(
577
+ request: CheckStatusRequest,
578
+ context: CallContext & CallContextExt,
579
+ ): Promise<DeepPartial<CheckStatusResponse>>;
580
+ }
581
+
582
+ export interface VerificationServiceClient<CallOptionsExt = {}> {
583
+ verificate(request: DeepPartial<VerificateRequest>, options?: CallOptions & CallOptionsExt): Promise<StatusResponse>;
584
+ refresh(request: DeepPartial<RefreshRequest>, options?: CallOptions & CallOptionsExt): Promise<Verification>;
585
+ checkStatus(
586
+ request: DeepPartial<CheckStatusRequest>,
587
+ options?: CallOptions & CallOptionsExt,
588
+ ): Promise<CheckStatusResponse>;
589
+ }
590
+
591
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
592
+
593
+ type DeepPartial<T> = T extends Builtin ? T
594
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
595
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
596
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
597
+ : T extends {} ? { [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]> }
598
+ : Partial<T>;
599
+
600
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
601
+ type Exact<P, I extends P> = P extends Builtin ? P
602
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never };
603
+
604
+ function longToNumber(int64: { toString(): string }): number {
605
+ const num = globalThis.Number(int64.toString());
606
+ if (num > globalThis.Number.MAX_SAFE_INTEGER) {
607
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
608
+ }
609
+ if (num < globalThis.Number.MIN_SAFE_INTEGER) {
610
+ throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
611
+ }
612
+ return num;
613
+ }
614
+
615
+ function isSet(value: any): boolean {
616
+ return value !== null && value !== undefined;
617
+ }
618
+
619
+ interface MessageFns<T, V extends string> {
620
+ readonly $type: V;
621
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
622
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
623
+ fromJSON(object: any): T;
624
+ toJSON(message: T): unknown;
625
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
626
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
627
+ }