@control_yourself/contracts 0.0.9 → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
- // protoc-gen-ts_proto v2.11.0
3
+ // protoc-gen-ts_proto v2.11.1
4
4
  // protoc unknown
5
5
  // source: auth.proto
6
6
 
@@ -18,6 +18,7 @@ import {
18
18
  type ServiceError,
19
19
  type UntypedServiceImplementation,
20
20
  } from "@grpc/grpc-js";
21
+ import { Empty } from "./google/protobuf/empty";
21
22
 
22
23
  export const protobufPackage = "auth.v1";
23
24
 
@@ -30,6 +31,30 @@ export interface ValidateTokenResponse {
30
31
  userId: string;
31
32
  }
32
33
 
34
+ export interface RegisterUserRequest {
35
+ email: string;
36
+ password: string;
37
+ }
38
+
39
+ export interface RegisterUserResponse {
40
+ accessToken: string;
41
+ refreshToken: string;
42
+ }
43
+
44
+ export interface LoginUserRequest {
45
+ email: string;
46
+ password: string;
47
+ }
48
+
49
+ export interface LoginUserResponse {
50
+ accessToken: string;
51
+ refreshToken: string;
52
+ }
53
+
54
+ export interface LogoutUserRequest {
55
+ userId: number;
56
+ }
57
+
33
58
  function createBaseValidateTokenRequest(): ValidateTokenRequest {
34
59
  return { accessToken: "" };
35
60
  }
@@ -67,7 +92,13 @@ export const ValidateTokenRequest: MessageFns<ValidateTokenRequest> = {
67
92
  },
68
93
 
69
94
  fromJSON(object: any): ValidateTokenRequest {
70
- return { accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "" };
95
+ return {
96
+ accessToken: isSet(object.accessToken)
97
+ ? globalThis.String(object.accessToken)
98
+ : isSet(object.access_token)
99
+ ? globalThis.String(object.access_token)
100
+ : "",
101
+ };
71
102
  },
72
103
 
73
104
  toJSON(message: ValidateTokenRequest): unknown {
@@ -138,7 +169,11 @@ export const ValidateTokenResponse: MessageFns<ValidateTokenResponse> = {
138
169
  fromJSON(object: any): ValidateTokenResponse {
139
170
  return {
140
171
  valid: isSet(object.valid) ? globalThis.Boolean(object.valid) : false,
141
- userId: isSet(object.userId) ? globalThis.String(object.userId) : "",
172
+ userId: isSet(object.userId)
173
+ ? globalThis.String(object.userId)
174
+ : isSet(object.user_id)
175
+ ? globalThis.String(object.user_id)
176
+ : "",
142
177
  };
143
178
  },
144
179
 
@@ -164,6 +199,390 @@ export const ValidateTokenResponse: MessageFns<ValidateTokenResponse> = {
164
199
  },
165
200
  };
166
201
 
202
+ function createBaseRegisterUserRequest(): RegisterUserRequest {
203
+ return { email: "", password: "" };
204
+ }
205
+
206
+ export const RegisterUserRequest: MessageFns<RegisterUserRequest> = {
207
+ encode(message: RegisterUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
208
+ if (message.email !== "") {
209
+ writer.uint32(10).string(message.email);
210
+ }
211
+ if (message.password !== "") {
212
+ writer.uint32(18).string(message.password);
213
+ }
214
+ return writer;
215
+ },
216
+
217
+ decode(input: BinaryReader | Uint8Array, length?: number): RegisterUserRequest {
218
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
219
+ const end = length === undefined ? reader.len : reader.pos + length;
220
+ const message = createBaseRegisterUserRequest();
221
+ while (reader.pos < end) {
222
+ const tag = reader.uint32();
223
+ switch (tag >>> 3) {
224
+ case 1: {
225
+ if (tag !== 10) {
226
+ break;
227
+ }
228
+
229
+ message.email = reader.string();
230
+ continue;
231
+ }
232
+ case 2: {
233
+ if (tag !== 18) {
234
+ break;
235
+ }
236
+
237
+ message.password = reader.string();
238
+ continue;
239
+ }
240
+ }
241
+ if ((tag & 7) === 4 || tag === 0) {
242
+ break;
243
+ }
244
+ reader.skip(tag & 7);
245
+ }
246
+ return message;
247
+ },
248
+
249
+ fromJSON(object: any): RegisterUserRequest {
250
+ return {
251
+ email: isSet(object.email) ? globalThis.String(object.email) : "",
252
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
253
+ };
254
+ },
255
+
256
+ toJSON(message: RegisterUserRequest): unknown {
257
+ const obj: any = {};
258
+ if (message.email !== "") {
259
+ obj.email = message.email;
260
+ }
261
+ if (message.password !== "") {
262
+ obj.password = message.password;
263
+ }
264
+ return obj;
265
+ },
266
+
267
+ create<I extends Exact<DeepPartial<RegisterUserRequest>, I>>(base?: I): RegisterUserRequest {
268
+ return RegisterUserRequest.fromPartial(base ?? ({} as any));
269
+ },
270
+ fromPartial<I extends Exact<DeepPartial<RegisterUserRequest>, I>>(object: I): RegisterUserRequest {
271
+ const message = createBaseRegisterUserRequest();
272
+ message.email = object.email ?? "";
273
+ message.password = object.password ?? "";
274
+ return message;
275
+ },
276
+ };
277
+
278
+ function createBaseRegisterUserResponse(): RegisterUserResponse {
279
+ return { accessToken: "", refreshToken: "" };
280
+ }
281
+
282
+ export const RegisterUserResponse: MessageFns<RegisterUserResponse> = {
283
+ encode(message: RegisterUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
284
+ if (message.accessToken !== "") {
285
+ writer.uint32(10).string(message.accessToken);
286
+ }
287
+ if (message.refreshToken !== "") {
288
+ writer.uint32(18).string(message.refreshToken);
289
+ }
290
+ return writer;
291
+ },
292
+
293
+ decode(input: BinaryReader | Uint8Array, length?: number): RegisterUserResponse {
294
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
295
+ const end = length === undefined ? reader.len : reader.pos + length;
296
+ const message = createBaseRegisterUserResponse();
297
+ while (reader.pos < end) {
298
+ const tag = reader.uint32();
299
+ switch (tag >>> 3) {
300
+ case 1: {
301
+ if (tag !== 10) {
302
+ break;
303
+ }
304
+
305
+ message.accessToken = reader.string();
306
+ continue;
307
+ }
308
+ case 2: {
309
+ if (tag !== 18) {
310
+ break;
311
+ }
312
+
313
+ message.refreshToken = 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): RegisterUserResponse {
326
+ return {
327
+ accessToken: isSet(object.accessToken)
328
+ ? globalThis.String(object.accessToken)
329
+ : isSet(object.access_token)
330
+ ? globalThis.String(object.access_token)
331
+ : "",
332
+ refreshToken: isSet(object.refreshToken)
333
+ ? globalThis.String(object.refreshToken)
334
+ : isSet(object.refresh_token)
335
+ ? globalThis.String(object.refresh_token)
336
+ : "",
337
+ };
338
+ },
339
+
340
+ toJSON(message: RegisterUserResponse): unknown {
341
+ const obj: any = {};
342
+ if (message.accessToken !== "") {
343
+ obj.accessToken = message.accessToken;
344
+ }
345
+ if (message.refreshToken !== "") {
346
+ obj.refreshToken = message.refreshToken;
347
+ }
348
+ return obj;
349
+ },
350
+
351
+ create<I extends Exact<DeepPartial<RegisterUserResponse>, I>>(base?: I): RegisterUserResponse {
352
+ return RegisterUserResponse.fromPartial(base ?? ({} as any));
353
+ },
354
+ fromPartial<I extends Exact<DeepPartial<RegisterUserResponse>, I>>(object: I): RegisterUserResponse {
355
+ const message = createBaseRegisterUserResponse();
356
+ message.accessToken = object.accessToken ?? "";
357
+ message.refreshToken = object.refreshToken ?? "";
358
+ return message;
359
+ },
360
+ };
361
+
362
+ function createBaseLoginUserRequest(): LoginUserRequest {
363
+ return { email: "", password: "" };
364
+ }
365
+
366
+ export const LoginUserRequest: MessageFns<LoginUserRequest> = {
367
+ encode(message: LoginUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
368
+ if (message.email !== "") {
369
+ writer.uint32(10).string(message.email);
370
+ }
371
+ if (message.password !== "") {
372
+ writer.uint32(18).string(message.password);
373
+ }
374
+ return writer;
375
+ },
376
+
377
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginUserRequest {
378
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
379
+ const end = length === undefined ? reader.len : reader.pos + length;
380
+ const message = createBaseLoginUserRequest();
381
+ while (reader.pos < end) {
382
+ const tag = reader.uint32();
383
+ switch (tag >>> 3) {
384
+ case 1: {
385
+ if (tag !== 10) {
386
+ break;
387
+ }
388
+
389
+ message.email = reader.string();
390
+ continue;
391
+ }
392
+ case 2: {
393
+ if (tag !== 18) {
394
+ break;
395
+ }
396
+
397
+ message.password = reader.string();
398
+ continue;
399
+ }
400
+ }
401
+ if ((tag & 7) === 4 || tag === 0) {
402
+ break;
403
+ }
404
+ reader.skip(tag & 7);
405
+ }
406
+ return message;
407
+ },
408
+
409
+ fromJSON(object: any): LoginUserRequest {
410
+ return {
411
+ email: isSet(object.email) ? globalThis.String(object.email) : "",
412
+ password: isSet(object.password) ? globalThis.String(object.password) : "",
413
+ };
414
+ },
415
+
416
+ toJSON(message: LoginUserRequest): unknown {
417
+ const obj: any = {};
418
+ if (message.email !== "") {
419
+ obj.email = message.email;
420
+ }
421
+ if (message.password !== "") {
422
+ obj.password = message.password;
423
+ }
424
+ return obj;
425
+ },
426
+
427
+ create<I extends Exact<DeepPartial<LoginUserRequest>, I>>(base?: I): LoginUserRequest {
428
+ return LoginUserRequest.fromPartial(base ?? ({} as any));
429
+ },
430
+ fromPartial<I extends Exact<DeepPartial<LoginUserRequest>, I>>(object: I): LoginUserRequest {
431
+ const message = createBaseLoginUserRequest();
432
+ message.email = object.email ?? "";
433
+ message.password = object.password ?? "";
434
+ return message;
435
+ },
436
+ };
437
+
438
+ function createBaseLoginUserResponse(): LoginUserResponse {
439
+ return { accessToken: "", refreshToken: "" };
440
+ }
441
+
442
+ export const LoginUserResponse: MessageFns<LoginUserResponse> = {
443
+ encode(message: LoginUserResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
444
+ if (message.accessToken !== "") {
445
+ writer.uint32(10).string(message.accessToken);
446
+ }
447
+ if (message.refreshToken !== "") {
448
+ writer.uint32(18).string(message.refreshToken);
449
+ }
450
+ return writer;
451
+ },
452
+
453
+ decode(input: BinaryReader | Uint8Array, length?: number): LoginUserResponse {
454
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
455
+ const end = length === undefined ? reader.len : reader.pos + length;
456
+ const message = createBaseLoginUserResponse();
457
+ while (reader.pos < end) {
458
+ const tag = reader.uint32();
459
+ switch (tag >>> 3) {
460
+ case 1: {
461
+ if (tag !== 10) {
462
+ break;
463
+ }
464
+
465
+ message.accessToken = reader.string();
466
+ continue;
467
+ }
468
+ case 2: {
469
+ if (tag !== 18) {
470
+ break;
471
+ }
472
+
473
+ message.refreshToken = reader.string();
474
+ continue;
475
+ }
476
+ }
477
+ if ((tag & 7) === 4 || tag === 0) {
478
+ break;
479
+ }
480
+ reader.skip(tag & 7);
481
+ }
482
+ return message;
483
+ },
484
+
485
+ fromJSON(object: any): LoginUserResponse {
486
+ return {
487
+ accessToken: isSet(object.accessToken)
488
+ ? globalThis.String(object.accessToken)
489
+ : isSet(object.access_token)
490
+ ? globalThis.String(object.access_token)
491
+ : "",
492
+ refreshToken: isSet(object.refreshToken)
493
+ ? globalThis.String(object.refreshToken)
494
+ : isSet(object.refresh_token)
495
+ ? globalThis.String(object.refresh_token)
496
+ : "",
497
+ };
498
+ },
499
+
500
+ toJSON(message: LoginUserResponse): unknown {
501
+ const obj: any = {};
502
+ if (message.accessToken !== "") {
503
+ obj.accessToken = message.accessToken;
504
+ }
505
+ if (message.refreshToken !== "") {
506
+ obj.refreshToken = message.refreshToken;
507
+ }
508
+ return obj;
509
+ },
510
+
511
+ create<I extends Exact<DeepPartial<LoginUserResponse>, I>>(base?: I): LoginUserResponse {
512
+ return LoginUserResponse.fromPartial(base ?? ({} as any));
513
+ },
514
+ fromPartial<I extends Exact<DeepPartial<LoginUserResponse>, I>>(object: I): LoginUserResponse {
515
+ const message = createBaseLoginUserResponse();
516
+ message.accessToken = object.accessToken ?? "";
517
+ message.refreshToken = object.refreshToken ?? "";
518
+ return message;
519
+ },
520
+ };
521
+
522
+ function createBaseLogoutUserRequest(): LogoutUserRequest {
523
+ return { userId: 0 };
524
+ }
525
+
526
+ export const LogoutUserRequest: MessageFns<LogoutUserRequest> = {
527
+ encode(message: LogoutUserRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
528
+ if (message.userId !== 0) {
529
+ writer.uint32(8).int32(message.userId);
530
+ }
531
+ return writer;
532
+ },
533
+
534
+ decode(input: BinaryReader | Uint8Array, length?: number): LogoutUserRequest {
535
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
536
+ const end = length === undefined ? reader.len : reader.pos + length;
537
+ const message = createBaseLogoutUserRequest();
538
+ while (reader.pos < end) {
539
+ const tag = reader.uint32();
540
+ switch (tag >>> 3) {
541
+ case 1: {
542
+ if (tag !== 8) {
543
+ break;
544
+ }
545
+
546
+ message.userId = reader.int32();
547
+ continue;
548
+ }
549
+ }
550
+ if ((tag & 7) === 4 || tag === 0) {
551
+ break;
552
+ }
553
+ reader.skip(tag & 7);
554
+ }
555
+ return message;
556
+ },
557
+
558
+ fromJSON(object: any): LogoutUserRequest {
559
+ return {
560
+ userId: isSet(object.userId)
561
+ ? globalThis.Number(object.userId)
562
+ : isSet(object.user_id)
563
+ ? globalThis.Number(object.user_id)
564
+ : 0,
565
+ };
566
+ },
567
+
568
+ toJSON(message: LogoutUserRequest): unknown {
569
+ const obj: any = {};
570
+ if (message.userId !== 0) {
571
+ obj.userId = Math.round(message.userId);
572
+ }
573
+ return obj;
574
+ },
575
+
576
+ create<I extends Exact<DeepPartial<LogoutUserRequest>, I>>(base?: I): LogoutUserRequest {
577
+ return LogoutUserRequest.fromPartial(base ?? ({} as any));
578
+ },
579
+ fromPartial<I extends Exact<DeepPartial<LogoutUserRequest>, I>>(object: I): LogoutUserRequest {
580
+ const message = createBaseLogoutUserRequest();
581
+ message.userId = object.userId ?? 0;
582
+ return message;
583
+ },
584
+ };
585
+
167
586
  export type AuthServiceService = typeof AuthServiceService;
168
587
  export const AuthServiceService = {
169
588
  validateToken: {
@@ -176,10 +595,41 @@ export const AuthServiceService = {
176
595
  Buffer.from(ValidateTokenResponse.encode(value).finish()),
177
596
  responseDeserialize: (value: Buffer): ValidateTokenResponse => ValidateTokenResponse.decode(value),
178
597
  },
598
+ registerUser: {
599
+ path: "/auth.v1.AuthService/RegisterUser",
600
+ requestStream: false,
601
+ responseStream: false,
602
+ requestSerialize: (value: RegisterUserRequest): Buffer => Buffer.from(RegisterUserRequest.encode(value).finish()),
603
+ requestDeserialize: (value: Buffer): RegisterUserRequest => RegisterUserRequest.decode(value),
604
+ responseSerialize: (value: RegisterUserResponse): Buffer =>
605
+ Buffer.from(RegisterUserResponse.encode(value).finish()),
606
+ responseDeserialize: (value: Buffer): RegisterUserResponse => RegisterUserResponse.decode(value),
607
+ },
608
+ loginUser: {
609
+ path: "/auth.v1.AuthService/LoginUser",
610
+ requestStream: false,
611
+ responseStream: false,
612
+ requestSerialize: (value: LoginUserRequest): Buffer => Buffer.from(LoginUserRequest.encode(value).finish()),
613
+ requestDeserialize: (value: Buffer): LoginUserRequest => LoginUserRequest.decode(value),
614
+ responseSerialize: (value: LoginUserResponse): Buffer => Buffer.from(LoginUserResponse.encode(value).finish()),
615
+ responseDeserialize: (value: Buffer): LoginUserResponse => LoginUserResponse.decode(value),
616
+ },
617
+ logoutUser: {
618
+ path: "/auth.v1.AuthService/LogoutUser",
619
+ requestStream: false,
620
+ responseStream: false,
621
+ requestSerialize: (value: LogoutUserRequest): Buffer => Buffer.from(LogoutUserRequest.encode(value).finish()),
622
+ requestDeserialize: (value: Buffer): LogoutUserRequest => LogoutUserRequest.decode(value),
623
+ responseSerialize: (value: Empty): Buffer => Buffer.from(Empty.encode(value).finish()),
624
+ responseDeserialize: (value: Buffer): Empty => Empty.decode(value),
625
+ },
179
626
  } as const;
180
627
 
181
628
  export interface AuthServiceServer extends UntypedServiceImplementation {
182
629
  validateToken: handleUnaryCall<ValidateTokenRequest, ValidateTokenResponse>;
630
+ registerUser: handleUnaryCall<RegisterUserRequest, RegisterUserResponse>;
631
+ loginUser: handleUnaryCall<LoginUserRequest, LoginUserResponse>;
632
+ logoutUser: handleUnaryCall<LogoutUserRequest, Empty>;
183
633
  }
184
634
 
185
635
  export interface AuthServiceClient extends Client {
@@ -198,6 +648,51 @@ export interface AuthServiceClient extends Client {
198
648
  options: Partial<CallOptions>,
199
649
  callback: (error: ServiceError | null, response: ValidateTokenResponse) => void,
200
650
  ): ClientUnaryCall;
651
+ registerUser(
652
+ request: RegisterUserRequest,
653
+ callback: (error: ServiceError | null, response: RegisterUserResponse) => void,
654
+ ): ClientUnaryCall;
655
+ registerUser(
656
+ request: RegisterUserRequest,
657
+ metadata: Metadata,
658
+ callback: (error: ServiceError | null, response: RegisterUserResponse) => void,
659
+ ): ClientUnaryCall;
660
+ registerUser(
661
+ request: RegisterUserRequest,
662
+ metadata: Metadata,
663
+ options: Partial<CallOptions>,
664
+ callback: (error: ServiceError | null, response: RegisterUserResponse) => void,
665
+ ): ClientUnaryCall;
666
+ loginUser(
667
+ request: LoginUserRequest,
668
+ callback: (error: ServiceError | null, response: LoginUserResponse) => void,
669
+ ): ClientUnaryCall;
670
+ loginUser(
671
+ request: LoginUserRequest,
672
+ metadata: Metadata,
673
+ callback: (error: ServiceError | null, response: LoginUserResponse) => void,
674
+ ): ClientUnaryCall;
675
+ loginUser(
676
+ request: LoginUserRequest,
677
+ metadata: Metadata,
678
+ options: Partial<CallOptions>,
679
+ callback: (error: ServiceError | null, response: LoginUserResponse) => void,
680
+ ): ClientUnaryCall;
681
+ logoutUser(
682
+ request: LogoutUserRequest,
683
+ callback: (error: ServiceError | null, response: Empty) => void,
684
+ ): ClientUnaryCall;
685
+ logoutUser(
686
+ request: LogoutUserRequest,
687
+ metadata: Metadata,
688
+ callback: (error: ServiceError | null, response: Empty) => void,
689
+ ): ClientUnaryCall;
690
+ logoutUser(
691
+ request: LogoutUserRequest,
692
+ metadata: Metadata,
693
+ options: Partial<CallOptions>,
694
+ callback: (error: ServiceError | null, response: Empty) => void,
695
+ ): ClientUnaryCall;
201
696
  }
202
697
 
203
698
  export const AuthServiceClient = makeGenericClientConstructor(AuthServiceService, "auth.v1.AuthService") as unknown as {
@@ -0,0 +1,86 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.1
4
+ // protoc unknown
5
+ // source: google/protobuf/empty.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+
10
+ export const protobufPackage = "google.protobuf";
11
+
12
+ /**
13
+ * A generic empty message that you can re-use to avoid defining duplicated
14
+ * empty messages in your APIs. A typical example is to use it as the request
15
+ * or the response type of an API method. For instance:
16
+ *
17
+ * service Foo {
18
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
19
+ * }
20
+ */
21
+ export interface Empty {
22
+ }
23
+
24
+ function createBaseEmpty(): Empty {
25
+ return {};
26
+ }
27
+
28
+ export const Empty: MessageFns<Empty> = {
29
+ encode(_: Empty, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
30
+ return writer;
31
+ },
32
+
33
+ decode(input: BinaryReader | Uint8Array, length?: number): Empty {
34
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
35
+ const end = length === undefined ? reader.len : reader.pos + length;
36
+ const message = createBaseEmpty();
37
+ while (reader.pos < end) {
38
+ const tag = reader.uint32();
39
+ switch (tag >>> 3) {
40
+ }
41
+ if ((tag & 7) === 4 || tag === 0) {
42
+ break;
43
+ }
44
+ reader.skip(tag & 7);
45
+ }
46
+ return message;
47
+ },
48
+
49
+ fromJSON(_: any): Empty {
50
+ return {};
51
+ },
52
+
53
+ toJSON(_: Empty): unknown {
54
+ const obj: any = {};
55
+ return obj;
56
+ },
57
+
58
+ create<I extends Exact<DeepPartial<Empty>, I>>(base?: I): Empty {
59
+ return Empty.fromPartial(base ?? ({} as any));
60
+ },
61
+ fromPartial<I extends Exact<DeepPartial<Empty>, I>>(_: I): Empty {
62
+ const message = createBaseEmpty();
63
+ return message;
64
+ },
65
+ };
66
+
67
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
68
+
69
+ export type DeepPartial<T> = T extends Builtin ? T
70
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
71
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
72
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
73
+ : Partial<T>;
74
+
75
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
76
+ export type Exact<P, I extends P> = P extends Builtin ? P
77
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
78
+
79
+ export interface MessageFns<T> {
80
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
81
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
82
+ fromJSON(object: any): T;
83
+ toJSON(message: T): unknown;
84
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
85
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
86
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@control_yourself/contracts",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "author": "vladimir.pariy@gmail.com",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/protos/auth.proto CHANGED
@@ -2,15 +2,44 @@ syntax = "proto3";
2
2
 
3
3
  package auth.v1;
4
4
 
5
+ import "google/protobuf/empty.proto";
6
+
5
7
  service AuthService {
6
8
  rpc ValidateToken (ValidateTokenRequest) returns (ValidateTokenResponse);
9
+ rpc RegisterUser (RegisterUserRequest) returns (RegisterUserResponse);
10
+ rpc LoginUser (LoginUserRequest) returns (LoginUserResponse);
11
+ rpc LogoutUser (LogoutUserRequest) returns (google.protobuf.Empty);
7
12
  }
8
13
 
9
14
  message ValidateTokenRequest {
10
- string accessToken = 1;
15
+ string access_token = 1;
11
16
  }
12
17
 
13
18
  message ValidateTokenResponse {
14
19
  bool valid = 1;
15
- string userId = 2;
20
+ string user_id = 2;
21
+ }
22
+
23
+ message RegisterUserRequest {
24
+ string email = 1;
25
+ string password = 2;
26
+ }
27
+
28
+ message RegisterUserResponse {
29
+ string access_token = 1;
30
+ string refresh_token = 2;
31
+ }
32
+
33
+ message LoginUserRequest {
34
+ string email = 1;
35
+ string password = 2;
36
+ }
37
+
38
+ message LoginUserResponse {
39
+ string access_token = 1;
40
+ string refresh_token = 2;
41
+ }
42
+
43
+ message LogoutUserRequest {
44
+ int32 user_id = 1;
16
45
  }