@taskora-uni/contracts 1.2.2 → 2.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.
package/generated/auth.ts CHANGED
@@ -20,11 +20,34 @@ export interface LoginResponse {
20
20
  refreshToken: string;
21
21
  }
22
22
 
23
- export interface RefreshRequest {
23
+ export interface RefreshTokensRequest {
24
24
  refreshToken: string;
25
25
  }
26
26
 
27
- export interface RefreshResponse {
27
+ export interface RefreshTokensResponse {
28
+ accessToken: string;
29
+ refreshToken: string;
30
+ }
31
+
32
+ export interface StartRegistrationRequest {
33
+ email: string;
34
+ password: string;
35
+ token: string;
36
+ }
37
+
38
+ export interface StartRegistrationResponse {
39
+ id: string;
40
+ }
41
+
42
+ export interface ConfirmRegistrationOtpRequest {
43
+ id: string;
44
+ code: string;
45
+ token: string;
46
+ firstName: string;
47
+ lastName: string;
48
+ }
49
+
50
+ export interface ConfirmRegistrationOtpResponse {
28
51
  accessToken: string;
29
52
  refreshToken: string;
30
53
  }
@@ -34,18 +57,35 @@ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
34
57
  export interface AuthServiceClient {
35
58
  login(request: LoginRequest): Observable<LoginResponse>;
36
59
 
37
- refresh(request: RefreshRequest): Observable<RefreshResponse>;
60
+ refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
61
+
62
+ startRegistration(request: StartRegistrationRequest): Observable<StartRegistrationResponse>;
63
+
64
+ confirmRegistrationOtp(request: ConfirmRegistrationOtpRequest): Observable<ConfirmRegistrationOtpResponse>;
38
65
  }
39
66
 
40
67
  export interface AuthServiceController {
41
68
  login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
42
69
 
43
- refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
70
+ refreshTokens(
71
+ request: RefreshTokensRequest,
72
+ ): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
73
+
74
+ startRegistration(
75
+ request: StartRegistrationRequest,
76
+ ): Promise<StartRegistrationResponse> | Observable<StartRegistrationResponse> | StartRegistrationResponse;
77
+
78
+ confirmRegistrationOtp(
79
+ request: ConfirmRegistrationOtpRequest,
80
+ ):
81
+ | Promise<ConfirmRegistrationOtpResponse>
82
+ | Observable<ConfirmRegistrationOtpResponse>
83
+ | ConfirmRegistrationOtpResponse;
44
84
  }
45
85
 
46
86
  export function AuthServiceControllerMethods() {
47
87
  return function (constructor: Function) {
48
- const grpcMethods: string[] = ["login", "refresh"];
88
+ const grpcMethods: string[] = ["login", "refreshTokens", "startRegistration", "confirmRegistrationOtp"];
49
89
  for (const method of grpcMethods) {
50
90
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
51
91
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -12,7 +12,7 @@ import { Timestamp } from "./google/protobuf/timestamp";
12
12
 
13
13
  export const protobufPackage = "invitation.v1";
14
14
 
15
- export interface CreateResponse {
15
+ export interface CreateInvitationResponse {
16
16
  token: string;
17
17
  expiresAt: Timestamp | undefined;
18
18
  }
@@ -30,41 +30,61 @@ export interface Invitation {
30
30
  createdAt: Timestamp | undefined;
31
31
  }
32
32
 
33
- export interface GetAllResponse {
33
+ export interface ListInvitationsResponse {
34
34
  invitations: Invitation[];
35
35
  }
36
36
 
37
- export interface ValidateTokenRequest {
37
+ export interface ValidateInvitationTokenRequest {
38
38
  token: string;
39
39
  }
40
40
 
41
- export interface ValidateTokenResponse {
41
+ export interface ValidateInvitationTokenResponse {
42
42
  isValid: boolean;
43
43
  }
44
44
 
45
+ export interface DeleteInvitationRequest {
46
+ id: string;
47
+ }
48
+
45
49
  export const INVITATION_V1_PACKAGE_NAME = "invitation.v1";
46
50
 
47
51
  export interface InvitationServiceClient {
48
- create(request: Empty): Observable<CreateResponse>;
52
+ createInvitation(request: Empty): Observable<CreateInvitationResponse>;
49
53
 
50
- getAll(request: Empty): Observable<GetAllResponse>;
54
+ listInvitations(request: Empty): Observable<ListInvitationsResponse>;
51
55
 
52
- validateToken(request: ValidateTokenRequest): Observable<ValidateTokenResponse>;
56
+ validateInvitationToken(request: ValidateInvitationTokenRequest): Observable<ValidateInvitationTokenResponse>;
57
+
58
+ deleteInvitation(request: DeleteInvitationRequest): Observable<Empty>;
53
59
  }
54
60
 
55
61
  export interface InvitationServiceController {
56
- create(request: Empty): Promise<CreateResponse> | Observable<CreateResponse> | CreateResponse;
57
-
58
- getAll(request: Empty): Promise<GetAllResponse> | Observable<GetAllResponse> | GetAllResponse;
59
-
60
- validateToken(
61
- request: ValidateTokenRequest,
62
- ): Promise<ValidateTokenResponse> | Observable<ValidateTokenResponse> | ValidateTokenResponse;
62
+ createInvitation(
63
+ request: Empty,
64
+ ): Promise<CreateInvitationResponse> | Observable<CreateInvitationResponse> | CreateInvitationResponse;
65
+
66
+ listInvitations(
67
+ request: Empty,
68
+ ): Promise<ListInvitationsResponse> | Observable<ListInvitationsResponse> | ListInvitationsResponse;
69
+
70
+ validateInvitationToken(
71
+ request: ValidateInvitationTokenRequest,
72
+ ):
73
+ | Promise<ValidateInvitationTokenResponse>
74
+ | Observable<ValidateInvitationTokenResponse>
75
+ | ValidateInvitationTokenResponse;
76
+
77
+ deleteInvitation(request: DeleteInvitationRequest): void | Promise<void>;
63
78
  }
64
79
 
65
80
  export function InvitationServiceControllerMethods() {
66
81
  return function (constructor: Function) {
67
- const grpcMethods: string[] = ["create", "getAll", "validateToken"];
82
+ const grpcMethods: string[] = [
83
+ "createInvitation",
84
+ "listInvitations",
85
+ "validateInvitationToken",
86
+ "deleteInvitation",
87
+ ];
68
88
  for (const method of grpcMethods) {
69
89
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
70
90
  GrpcMethod("InvitationService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskora-uni/contracts",
3
- "version": "1.2.2",
3
+ "version": "2.1.0",
4
4
  "description": "Shared protobuf contracts and generated TypeScript bindings for Taskora Uni backend services.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/proto/auth.proto CHANGED
@@ -4,7 +4,9 @@ package auth.v1;
4
4
 
5
5
  service AuthService {
6
6
  rpc Login(LoginRequest) returns (LoginResponse);
7
- rpc Refresh(RefreshRequest) returns (RefreshResponse);
7
+ rpc RefreshTokens(RefreshTokensRequest) returns (RefreshTokensResponse);
8
+ rpc StartRegistration(StartRegistrationRequest) returns (StartRegistrationResponse);
9
+ rpc ConfirmRegistrationOtp(ConfirmRegistrationOtpRequest) returns (ConfirmRegistrationOtpResponse);
8
10
  }
9
11
 
10
12
  message LoginRequest {
@@ -17,11 +19,34 @@ message LoginResponse {
17
19
  string refresh_token = 2;
18
20
  }
19
21
 
20
- message RefreshRequest {
21
- string refresh_token = 1;
22
+ message RefreshTokensRequest {
23
+ string refresh_token = 1;
22
24
  }
23
25
 
24
- message RefreshResponse {
26
+ message RefreshTokensResponse {
27
+ string access_token = 1;
28
+ string refresh_token = 2;
29
+ }
30
+
31
+ message StartRegistrationRequest {
32
+ string email = 1;
33
+ string password = 2;
34
+ string token = 3;
35
+ }
36
+
37
+ message StartRegistrationResponse {
38
+ string id = 1;
39
+ }
40
+
41
+ message ConfirmRegistrationOtpRequest {
42
+ string id = 1;
43
+ string code = 2;
44
+ string token = 3;
45
+ string first_name = 4;
46
+ string last_name = 5;
47
+ }
48
+
49
+ message ConfirmRegistrationOtpResponse {
25
50
  string access_token = 1;
26
51
  string refresh_token = 2;
27
52
  }
@@ -6,12 +6,13 @@ import "google/protobuf/empty.proto";
6
6
  import "google/protobuf/timestamp.proto";
7
7
 
8
8
  service InvitationService {
9
- rpc Create(google.protobuf.Empty) returns (CreateResponse);
10
- rpc GetAll(google.protobuf.Empty) returns (GetAllResponse);
11
- rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
9
+ rpc CreateInvitation(google.protobuf.Empty) returns (CreateInvitationResponse);
10
+ rpc ListInvitations(google.protobuf.Empty) returns (ListInvitationsResponse);
11
+ rpc ValidateInvitationToken(ValidateInvitationTokenRequest) returns (ValidateInvitationTokenResponse);
12
+ rpc DeleteInvitation(DeleteInvitationRequest) returns (google.protobuf.Empty);
12
13
  }
13
14
 
14
- message CreateResponse {
15
+ message CreateInvitationResponse {
15
16
  string token = 1;
16
17
  google.protobuf.Timestamp expires_at = 2;
17
18
  }
@@ -29,14 +30,18 @@ message Invitation {
29
30
  google.protobuf.Timestamp created_at = 5;
30
31
  }
31
32
 
32
- message GetAllResponse {
33
+ message ListInvitationsResponse {
33
34
  repeated Invitation invitations = 1;
34
35
  }
35
36
 
36
- message ValidateTokenRequest {
37
+ message ValidateInvitationTokenRequest {
37
38
  string token = 1;
38
39
  }
39
40
 
40
- message ValidateTokenResponse {
41
+ message ValidateInvitationTokenResponse {
41
42
  bool is_valid = 1;
42
43
  }
44
+
45
+ message DeleteInvitationRequest {
46
+ string id = 1;
47
+ }