@babacarthiamdev/contracts 1.0.9 → 1.0.11
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/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +2 -1
- package/gen/account.ts +194 -0
- package/gen/auth.ts +99 -1
- package/package.json +1 -1
- package/proto/account.proto +25 -0
- package/proto/auth.proto +10 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PROTO_PATHS = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
|
-
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto')
|
|
6
|
+
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
|
+
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto')
|
|
7
8
|
};
|
package/gen/account.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
10
|
+
import { Observable } from "rxjs";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "account.v1";
|
|
13
|
+
|
|
14
|
+
export enum Role {
|
|
15
|
+
USER = 0,
|
|
16
|
+
ADMIN = 1,
|
|
17
|
+
UNRECOGNIZED = -1,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface GetAccountRequest {
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface GetAccountResponse {
|
|
25
|
+
id: string;
|
|
26
|
+
phone: string;
|
|
27
|
+
email: string;
|
|
28
|
+
isPhoneVerified: string;
|
|
29
|
+
isEmailVerified: string;
|
|
30
|
+
role: Role;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
34
|
+
|
|
35
|
+
function createBaseGetAccountRequest(): GetAccountRequest {
|
|
36
|
+
return { id: "" };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const GetAccountRequest: MessageFns<GetAccountRequest> = {
|
|
40
|
+
encode(message: GetAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
41
|
+
if (message.id !== "") {
|
|
42
|
+
writer.uint32(10).string(message.id);
|
|
43
|
+
}
|
|
44
|
+
return writer;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountRequest {
|
|
48
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
49
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
50
|
+
const message = createBaseGetAccountRequest();
|
|
51
|
+
while (reader.pos < end) {
|
|
52
|
+
const tag = reader.uint32();
|
|
53
|
+
switch (tag >>> 3) {
|
|
54
|
+
case 1: {
|
|
55
|
+
if (tag !== 10) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message.id = reader.string();
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
reader.skip(tag & 7);
|
|
67
|
+
}
|
|
68
|
+
return message;
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
function createBaseGetAccountResponse(): GetAccountResponse {
|
|
73
|
+
return { id: "", phone: "", email: "", isPhoneVerified: "", isEmailVerified: "", role: 0 };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const GetAccountResponse: MessageFns<GetAccountResponse> = {
|
|
77
|
+
encode(message: GetAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
78
|
+
if (message.id !== "") {
|
|
79
|
+
writer.uint32(10).string(message.id);
|
|
80
|
+
}
|
|
81
|
+
if (message.phone !== "") {
|
|
82
|
+
writer.uint32(18).string(message.phone);
|
|
83
|
+
}
|
|
84
|
+
if (message.email !== "") {
|
|
85
|
+
writer.uint32(26).string(message.email);
|
|
86
|
+
}
|
|
87
|
+
if (message.isPhoneVerified !== "") {
|
|
88
|
+
writer.uint32(34).string(message.isPhoneVerified);
|
|
89
|
+
}
|
|
90
|
+
if (message.isEmailVerified !== "") {
|
|
91
|
+
writer.uint32(42).string(message.isEmailVerified);
|
|
92
|
+
}
|
|
93
|
+
if (message.role !== 0) {
|
|
94
|
+
writer.uint32(48).int32(message.role);
|
|
95
|
+
}
|
|
96
|
+
return writer;
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountResponse {
|
|
100
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
101
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
102
|
+
const message = createBaseGetAccountResponse();
|
|
103
|
+
while (reader.pos < end) {
|
|
104
|
+
const tag = reader.uint32();
|
|
105
|
+
switch (tag >>> 3) {
|
|
106
|
+
case 1: {
|
|
107
|
+
if (tag !== 10) {
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message.id = reader.string();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
case 2: {
|
|
115
|
+
if (tag !== 18) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
message.phone = reader.string();
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
case 3: {
|
|
123
|
+
if (tag !== 26) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message.email = reader.string();
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
case 4: {
|
|
131
|
+
if (tag !== 34) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
message.isPhoneVerified = reader.string();
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
case 5: {
|
|
139
|
+
if (tag !== 42) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
message.isEmailVerified = reader.string();
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
case 6: {
|
|
147
|
+
if (tag !== 48) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
message.role = reader.int32() as any;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
reader.skip(tag & 7);
|
|
159
|
+
}
|
|
160
|
+
return message;
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export interface AccountServiceClient {
|
|
165
|
+
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface AccountServiceController {
|
|
169
|
+
getAccount(
|
|
170
|
+
request: GetAccountRequest,
|
|
171
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function AccountServiceControllerMethods() {
|
|
175
|
+
return function (constructor: Function) {
|
|
176
|
+
const grpcMethods: string[] = ["getAccount"];
|
|
177
|
+
for (const method of grpcMethods) {
|
|
178
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
179
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
180
|
+
}
|
|
181
|
+
const grpcStreamMethods: string[] = [];
|
|
182
|
+
for (const method of grpcStreamMethods) {
|
|
183
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
184
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
|
190
|
+
|
|
191
|
+
export interface MessageFns<T> {
|
|
192
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
193
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
194
|
+
}
|
package/gen/auth.ts
CHANGED
|
@@ -31,6 +31,15 @@ export interface VerifyOptResponse {
|
|
|
31
31
|
refreshToken: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export interface RefreshRequest {
|
|
35
|
+
refreshToken: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface RefreshResponse {
|
|
39
|
+
accessToken: string;
|
|
40
|
+
refreshToken: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
35
44
|
|
|
36
45
|
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
@@ -225,21 +234,110 @@ export const VerifyOptResponse: MessageFns<VerifyOptResponse> = {
|
|
|
225
234
|
},
|
|
226
235
|
};
|
|
227
236
|
|
|
237
|
+
function createBaseRefreshRequest(): RefreshRequest {
|
|
238
|
+
return { refreshToken: "" };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export const RefreshRequest: MessageFns<RefreshRequest> = {
|
|
242
|
+
encode(message: RefreshRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
243
|
+
if (message.refreshToken !== "") {
|
|
244
|
+
writer.uint32(10).string(message.refreshToken);
|
|
245
|
+
}
|
|
246
|
+
return writer;
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
decode(input: BinaryReader | Uint8Array, length?: number): RefreshRequest {
|
|
250
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
251
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
252
|
+
const message = createBaseRefreshRequest();
|
|
253
|
+
while (reader.pos < end) {
|
|
254
|
+
const tag = reader.uint32();
|
|
255
|
+
switch (tag >>> 3) {
|
|
256
|
+
case 1: {
|
|
257
|
+
if (tag !== 10) {
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
message.refreshToken = reader.string();
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
reader.skip(tag & 7);
|
|
269
|
+
}
|
|
270
|
+
return message;
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
function createBaseRefreshResponse(): RefreshResponse {
|
|
275
|
+
return { accessToken: "", refreshToken: "" };
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export const RefreshResponse: MessageFns<RefreshResponse> = {
|
|
279
|
+
encode(message: RefreshResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
280
|
+
if (message.accessToken !== "") {
|
|
281
|
+
writer.uint32(10).string(message.accessToken);
|
|
282
|
+
}
|
|
283
|
+
if (message.refreshToken !== "") {
|
|
284
|
+
writer.uint32(18).string(message.refreshToken);
|
|
285
|
+
}
|
|
286
|
+
return writer;
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
decode(input: BinaryReader | Uint8Array, length?: number): RefreshResponse {
|
|
290
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
291
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
292
|
+
const message = createBaseRefreshResponse();
|
|
293
|
+
while (reader.pos < end) {
|
|
294
|
+
const tag = reader.uint32();
|
|
295
|
+
switch (tag >>> 3) {
|
|
296
|
+
case 1: {
|
|
297
|
+
if (tag !== 10) {
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
message.accessToken = reader.string();
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
case 2: {
|
|
305
|
+
if (tag !== 18) {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
message.refreshToken = reader.string();
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
reader.skip(tag & 7);
|
|
317
|
+
}
|
|
318
|
+
return message;
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
|
|
228
322
|
export interface AuthServiceClient {
|
|
229
323
|
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
230
324
|
|
|
231
325
|
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOptResponse>;
|
|
326
|
+
|
|
327
|
+
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
|
232
328
|
}
|
|
233
329
|
|
|
234
330
|
export interface AuthServiceController {
|
|
235
331
|
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
236
332
|
|
|
237
333
|
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOptResponse> | Observable<VerifyOptResponse> | VerifyOptResponse;
|
|
334
|
+
|
|
335
|
+
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
|
238
336
|
}
|
|
239
337
|
|
|
240
338
|
export function AuthServiceControllerMethods() {
|
|
241
339
|
return function (constructor: Function) {
|
|
242
|
-
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
|
340
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
|
|
243
341
|
for (const method of grpcMethods) {
|
|
244
342
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
245
343
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
service AccountService {
|
|
6
|
+
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message GetAccountRequest {
|
|
10
|
+
string id = 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message GetAccountResponse {
|
|
14
|
+
string id = 1;
|
|
15
|
+
string phone = 2;
|
|
16
|
+
string email = 3;
|
|
17
|
+
string is_phone_verified = 4;
|
|
18
|
+
string is_email_verified = 5;
|
|
19
|
+
Role role = 6;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
enum Role {
|
|
23
|
+
USER = 0;
|
|
24
|
+
ADMIN = 1;
|
|
25
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -5,6 +5,7 @@ package auth.v1;
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
7
7
|
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOptResponse);
|
|
8
|
+
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
message SendOtpRequest {
|
|
@@ -25,4 +26,13 @@ message VerifyOtpRequest {
|
|
|
25
26
|
message VerifyOptResponse{
|
|
26
27
|
string access_token = 1;
|
|
27
28
|
string refresh_token = 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message RefreshRequest {
|
|
32
|
+
string refresh_token = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message RefreshResponse {
|
|
36
|
+
string access_token = 1;
|
|
37
|
+
string refresh_token = 2;
|
|
28
38
|
}
|