@readytomog/contracts 1.4.1 → 1.5.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.
@@ -2,4 +2,5 @@ export declare const PROTO_PATHS: {
2
2
  readonly AUTH: string;
3
3
  readonly USER: string;
4
4
  readonly CHAT: string;
5
+ readonly PAYMENT: string;
5
6
  };
@@ -6,4 +6,5 @@ exports.PROTO_PATHS = {
6
6
  AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
7
7
  USER: (0, path_1.join)(__dirname, "../../proto/user.proto"),
8
8
  CHAT: (0, path_1.join)(__dirname, "../../proto/chat.proto"),
9
+ PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
9
10
  };
package/gen/chat.ts CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  /* eslint-disable */
8
8
  import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
- import { wrappers } from "protobufjs";
10
9
  import { Observable } from "rxjs";
11
10
 
12
11
  export const protobufPackage = "chat.v1";
@@ -32,8 +31,8 @@ export interface Message {
32
31
  message: string;
33
32
  senderId: string;
34
33
  id: string;
35
- createdAt: Date | undefined;
36
- updatedAt: Date | undefined;
34
+ createdAt: string;
35
+ updatedAt: string;
37
36
  }
38
37
 
39
38
  export interface User {
@@ -47,8 +46,8 @@ export interface Chat {
47
46
  id: string;
48
47
  users: User[];
49
48
  lastMessage: string;
50
- createdAt: Date | undefined;
51
- updatedAt: Date | undefined;
49
+ createdAt: string;
50
+ updatedAt: string;
52
51
  }
53
52
 
54
53
  export interface GetMessagesRequest {
@@ -69,15 +68,6 @@ export interface GetChatsResponse {
69
68
 
70
69
  export const CHAT_V1_PACKAGE_NAME = "chat.v1";
71
70
 
72
- wrappers[".google.protobuf.Timestamp"] = {
73
- fromObject(value: Date) {
74
- return { seconds: value.getTime() / 1000, nanos: (value.getTime() % 1000) * 1e6 };
75
- },
76
- toObject(message: { seconds: number; nanos: number }) {
77
- return new Date(message.seconds * 1000 + message.nanos / 1e6);
78
- },
79
- } as any;
80
-
81
71
  export interface ChatServiceClient {
82
72
  createChat(request: CreateChatRequest): Observable<CreateChatResponse>;
83
73
 
@@ -1,7 +1,7 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.8
4
- // protoc v3.21.12
4
+ // protoc v7.35.1
5
5
  // source: google/protobuf/timestamp.proto
6
6
 
7
7
  /* eslint-disable */
@@ -81,8 +81,8 @@ export const protobufPackage = "google.protobuf";
81
81
  * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
82
82
  * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
83
83
  * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
84
- * is required. A proto3 JSON serializer should always use UTC (as indicated by
85
- * "Z") when printing the Timestamp type and a proto3 JSON parser should be
84
+ * is required. A ProtoJSON serializer should always use UTC (as indicated by
85
+ * "Z") when printing the Timestamp type and a ProtoJSON parser should be
86
86
  * able to accept both UTC and other timezones (as indicated by an offset).
87
87
  *
88
88
  * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
@@ -96,20 +96,21 @@ export const protobufPackage = "google.protobuf";
96
96
  * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
97
97
  * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
98
98
  * the Joda Time's [`ISODateTimeFormat.dateTime()`](
99
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
+ * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
100
100
  * ) to obtain a formatter capable of generating timestamps in this format.
101
101
  */
102
102
  export interface Timestamp {
103
103
  /**
104
- * Represents seconds of UTC time since Unix epoch
105
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
106
- * 9999-12-31T23:59:59Z inclusive.
104
+ * Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
105
+ * be between -62135596800 and 253402300799 inclusive (which corresponds to
106
+ * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
107
107
  */
108
108
  seconds: number;
109
109
  /**
110
- * Non-negative fractions of a second at nanosecond resolution. Negative
111
- * second values with fractions must still have non-negative nanos values
112
- * that count forward in time. Must be from 0 to 999,999,999
110
+ * Non-negative fractions of a second at nanosecond resolution. This field is
111
+ * the nanosecond portion of the duration, not an alternative to seconds.
112
+ * Negative second values with fractions must still have non-negative nanos
113
+ * values that count forward in time. Must be between 0 and 999,999,999
113
114
  * inclusive.
114
115
  */
115
116
  nanos: number;
package/gen/payment.ts ADDED
@@ -0,0 +1,110 @@
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: payment.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { Empty } from "./google/protobuf/empty";
11
+
12
+ export const protobufPackage = "payment.v3";
13
+
14
+ export interface GetHistoryRequest {
15
+ }
16
+
17
+ export interface GetHistoryResponse {
18
+ }
19
+
20
+ export interface InitTransactionRequest {
21
+ }
22
+
23
+ export interface InitTransactionResponse {
24
+ }
25
+
26
+ export interface UpdateAutoRenewalStatusRequest {
27
+ }
28
+
29
+ export interface UpdateAutoRenewalStatusResponse {
30
+ }
31
+
32
+ export interface GetPlansResponse {
33
+ }
34
+
35
+ export interface GetPlanByIdRequest {
36
+ }
37
+
38
+ export interface GetPlanByIdResponse {
39
+ }
40
+
41
+ export interface RefundRequest {
42
+ }
43
+
44
+ export interface RefundResponse {
45
+ }
46
+
47
+ export const PAYMENT_V3_PACKAGE_NAME = "payment.v3";
48
+
49
+ export interface PaymentServiceClient {
50
+ getHistory(request: GetHistoryRequest): Observable<GetHistoryResponse>;
51
+
52
+ initTransaction(request: InitTransactionRequest): Observable<InitTransactionResponse>;
53
+
54
+ updateAutoRenewalStatus(request: UpdateAutoRenewalStatusRequest): Observable<UpdateAutoRenewalStatusResponse>;
55
+
56
+ getPlans(request: Empty): Observable<GetPlansResponse>;
57
+
58
+ getPlanById(request: GetPlanByIdRequest): Observable<GetPlanByIdResponse>;
59
+
60
+ refund(request: RefundRequest): Observable<RefundResponse>;
61
+ }
62
+
63
+ export interface PaymentServiceController {
64
+ getHistory(
65
+ request: GetHistoryRequest,
66
+ ): Promise<GetHistoryResponse> | Observable<GetHistoryResponse> | GetHistoryResponse;
67
+
68
+ initTransaction(
69
+ request: InitTransactionRequest,
70
+ ): Promise<InitTransactionResponse> | Observable<InitTransactionResponse> | InitTransactionResponse;
71
+
72
+ updateAutoRenewalStatus(
73
+ request: UpdateAutoRenewalStatusRequest,
74
+ ):
75
+ | Promise<UpdateAutoRenewalStatusResponse>
76
+ | Observable<UpdateAutoRenewalStatusResponse>
77
+ | UpdateAutoRenewalStatusResponse;
78
+
79
+ getPlans(request: Empty): Promise<GetPlansResponse> | Observable<GetPlansResponse> | GetPlansResponse;
80
+
81
+ getPlanById(
82
+ request: GetPlanByIdRequest,
83
+ ): Promise<GetPlanByIdResponse> | Observable<GetPlanByIdResponse> | GetPlanByIdResponse;
84
+
85
+ refund(request: RefundRequest): Promise<RefundResponse> | Observable<RefundResponse> | RefundResponse;
86
+ }
87
+
88
+ export function PaymentServiceControllerMethods() {
89
+ return function (constructor: Function) {
90
+ const grpcMethods: string[] = [
91
+ "getHistory",
92
+ "initTransaction",
93
+ "updateAutoRenewalStatus",
94
+ "getPlans",
95
+ "getPlanById",
96
+ "refund",
97
+ ];
98
+ for (const method of grpcMethods) {
99
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
100
+ GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
101
+ }
102
+ const grpcStreamMethods: string[] = [];
103
+ for (const method of grpcStreamMethods) {
104
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
105
+ GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
106
+ }
107
+ };
108
+ }
109
+
110
+ export const PAYMENT_SERVICE_NAME = "PaymentService";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readytomog/contracts",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Protobuf definitions and generated Typescript types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/proto/chat.proto CHANGED
@@ -2,7 +2,7 @@ syntax = "proto3";
2
2
 
3
3
  package chat.v1;
4
4
 
5
- import "google/protobuf/timestamp.proto";
5
+
6
6
 
7
7
  service ChatService {
8
8
  rpc CreateChat(CreateChatRequest) returns (CreateChatResponse);
@@ -32,8 +32,8 @@ message Message {
32
32
  string message = 1;
33
33
  string senderId = 2;
34
34
  string id = 4;
35
- google.protobuf.Timestamp created_at = 5;
36
- google.protobuf.Timestamp updated_at = 6;
35
+ string created_at = 5;
36
+ string updated_at = 6;
37
37
  }
38
38
 
39
39
  message User {
@@ -47,8 +47,8 @@ message Chat {
47
47
  string id = 1;
48
48
  repeated User users = 2;
49
49
  string lastMessage = 3;
50
- google.protobuf.Timestamp created_at = 5;
51
- google.protobuf.Timestamp updated_at = 6;
50
+ string created_at = 5;
51
+ string updated_at = 6;
52
52
  }
53
53
 
54
54
  message GetMessagesRequest {
@@ -0,0 +1,46 @@
1
+ syntax = "proto3";
2
+
3
+ package payment.v3;
4
+
5
+ import "google/protobuf/empty.proto";
6
+
7
+ service PaymentService {
8
+ rpc GetHistory(GetHistoryRequest) returns (GetHistoryResponse);
9
+ rpc InitTransaction(InitTransactionRequest) returns (InitTransactionResponse);
10
+ rpc UpdateAutoRenewalStatus(UpdateAutoRenewalStatusRequest) returns (UpdateAutoRenewalStatusResponse);
11
+ rpc GetPlans(google.protobuf.Empty) returns (GetPlansResponse);
12
+ rpc GetPlanById(GetPlanByIdRequest) returns (GetPlanByIdResponse);
13
+ rpc Refund(RefundRequest) returns (RefundResponse);
14
+ }
15
+
16
+ message GetHistoryRequest{}
17
+
18
+ message GetHistoryResponse {
19
+
20
+ }
21
+
22
+ message InitTransactionRequest {
23
+
24
+ }
25
+
26
+ message InitTransactionResponse {
27
+
28
+ }
29
+
30
+ message UpdateAutoRenewalStatusRequest {
31
+
32
+ }
33
+
34
+ message UpdateAutoRenewalStatusResponse {
35
+
36
+ }
37
+
38
+
39
+ message GetPlansResponse {}
40
+
41
+ message GetPlanByIdRequest {}
42
+ message GetPlanByIdResponse{}
43
+
44
+ message RefundRequest {}
45
+
46
+ message RefundResponse {}