@taskora-uni/contracts 1.2.1 → 2.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.
package/generated/auth.ts CHANGED
@@ -20,11 +20,11 @@ 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
28
  accessToken: string;
29
29
  refreshToken: string;
30
30
  }
@@ -34,18 +34,20 @@ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
34
34
  export interface AuthServiceClient {
35
35
  login(request: LoginRequest): Observable<LoginResponse>;
36
36
 
37
- refresh(request: RefreshRequest): Observable<RefreshResponse>;
37
+ refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
38
38
  }
39
39
 
40
40
  export interface AuthServiceController {
41
41
  login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
42
42
 
43
- refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
43
+ refreshTokens(
44
+ request: RefreshTokensRequest,
45
+ ): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
44
46
  }
45
47
 
46
48
  export function AuthServiceControllerMethods() {
47
49
  return function (constructor: Function) {
48
- const grpcMethods: string[] = ["login", "refresh"];
50
+ const grpcMethods: string[] = ["login", "refreshTokens"];
49
51
  for (const method of grpcMethods) {
50
52
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
51
53
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -12,54 +12,79 @@ 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
  }
19
19
 
20
+ export interface InvitationUsedBy {
21
+ id: string;
22
+ email: string;
23
+ }
24
+
20
25
  export interface Invitation {
21
26
  id: string;
22
- usedById?: string | undefined;
27
+ usedBy?: InvitationUsedBy | undefined;
23
28
  expiresAt: Timestamp | undefined;
24
29
  usedAt?: Timestamp | undefined;
25
30
  createdAt: Timestamp | undefined;
26
31
  }
27
32
 
28
- export interface GetAllResponse {
33
+ export interface ListInvitationsResponse {
29
34
  invitations: Invitation[];
30
35
  }
31
36
 
32
- export interface ValidateTokenRequest {
37
+ export interface ValidateInvitationTokenRequest {
33
38
  token: string;
34
39
  }
35
40
 
36
- export interface ValidateTokenResponse {
41
+ export interface ValidateInvitationTokenResponse {
37
42
  isValid: boolean;
38
43
  }
39
44
 
45
+ export interface DeleteInvitationRequest {
46
+ id: string;
47
+ }
48
+
40
49
  export const INVITATION_V1_PACKAGE_NAME = "invitation.v1";
41
50
 
42
51
  export interface InvitationServiceClient {
43
- create(request: Empty): Observable<CreateResponse>;
52
+ createInvitation(request: Empty): Observable<CreateInvitationResponse>;
53
+
54
+ listInvitations(request: Empty): Observable<ListInvitationsResponse>;
44
55
 
45
- getAll(request: Empty): Observable<GetAllResponse>;
56
+ validateInvitationToken(request: ValidateInvitationTokenRequest): Observable<ValidateInvitationTokenResponse>;
46
57
 
47
- validateToken(request: ValidateTokenRequest): Observable<ValidateTokenResponse>;
58
+ deleteInvitation(request: DeleteInvitationRequest): Observable<Empty>;
48
59
  }
49
60
 
50
61
  export interface InvitationServiceController {
51
- create(request: Empty): Promise<CreateResponse> | Observable<CreateResponse> | CreateResponse;
52
-
53
- getAll(request: Empty): Promise<GetAllResponse> | Observable<GetAllResponse> | GetAllResponse;
54
-
55
- validateToken(
56
- request: ValidateTokenRequest,
57
- ): 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>;
58
78
  }
59
79
 
60
80
  export function InvitationServiceControllerMethods() {
61
81
  return function (constructor: Function) {
62
- const grpcMethods: string[] = ["create", "getAll", "validateToken"];
82
+ const grpcMethods: string[] = [
83
+ "createInvitation",
84
+ "listInvitations",
85
+ "validateInvitationToken",
86
+ "deleteInvitation",
87
+ ];
63
88
  for (const method of grpcMethods) {
64
89
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
65
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.1",
3
+ "version": "2.0.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,7 @@ 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
8
  }
9
9
 
10
10
  message LoginRequest {
@@ -17,11 +17,11 @@ message LoginResponse {
17
17
  string refresh_token = 2;
18
18
  }
19
19
 
20
- message RefreshRequest {
21
- string refresh_token = 1;
20
+ message RefreshTokensRequest {
21
+ string refresh_token = 1;
22
22
  }
23
23
 
24
- message RefreshResponse {
24
+ message RefreshTokensResponse {
25
25
  string access_token = 1;
26
26
  string refresh_token = 2;
27
27
  }
@@ -1,4 +1,4 @@
1
- syntax="proto3";
1
+ syntax = "proto3";
2
2
 
3
3
  package invitation.v1;
4
4
 
@@ -6,32 +6,42 @@ 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
- string token = 1;
16
- google.protobuf.Timestamp expires_at = 2;
15
+ message CreateInvitationResponse {
16
+ string token = 1;
17
+ google.protobuf.Timestamp expires_at = 2;
18
+ }
19
+
20
+ message InvitationUsedBy {
21
+ string id = 1;
22
+ string email = 2;
17
23
  }
18
24
 
19
25
  message Invitation {
20
- string id = 1;
21
- optional string used_by_id = 2;
22
- google.protobuf.Timestamp expires_at = 3;
23
- optional google.protobuf.Timestamp used_at = 4;
24
- google.protobuf.Timestamp created_at = 5;
26
+ string id = 1;
27
+ optional InvitationUsedBy used_by = 2;
28
+ google.protobuf.Timestamp expires_at = 3;
29
+ optional google.protobuf.Timestamp used_at = 4;
30
+ google.protobuf.Timestamp created_at = 5;
31
+ }
32
+
33
+ message ListInvitationsResponse {
34
+ repeated Invitation invitations = 1;
25
35
  }
26
36
 
27
- message GetAllResponse {
28
- repeated Invitation invitations = 1;
37
+ message ValidateInvitationTokenRequest {
38
+ string token = 1;
29
39
  }
30
40
 
31
- message ValidateTokenRequest {
32
- string token = 1;
41
+ message ValidateInvitationTokenResponse {
42
+ bool is_valid = 1;
33
43
  }
34
44
 
35
- message ValidateTokenResponse {
36
- bool is_valid = 1;
45
+ message DeleteInvitationRequest {
46
+ string id = 1;
37
47
  }