@babacarthiamdev/contracts 1.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/gen/auth.ts +138 -0
- package/package.json +22 -0
- package/proto/auth.proto +16 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
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: auth.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 = "auth.v1";
|
|
13
|
+
|
|
14
|
+
export interface SendOtpRequest {
|
|
15
|
+
identifier: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface SendOtpResponse {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
24
|
+
|
|
25
|
+
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
26
|
+
return { identifier: "", type: "" };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SendOtpRequest: MessageFns<SendOtpRequest> = {
|
|
30
|
+
encode(message: SendOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
31
|
+
if (message.identifier !== "") {
|
|
32
|
+
writer.uint32(10).string(message.identifier);
|
|
33
|
+
}
|
|
34
|
+
if (message.type !== "") {
|
|
35
|
+
writer.uint32(18).string(message.type);
|
|
36
|
+
}
|
|
37
|
+
return writer;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SendOtpRequest {
|
|
41
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
42
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
43
|
+
const message = createBaseSendOtpRequest();
|
|
44
|
+
while (reader.pos < end) {
|
|
45
|
+
const tag = reader.uint32();
|
|
46
|
+
switch (tag >>> 3) {
|
|
47
|
+
case 1: {
|
|
48
|
+
if (tag !== 10) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
message.identifier = reader.string();
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
case 2: {
|
|
56
|
+
if (tag !== 18) {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message.type = reader.string();
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
reader.skip(tag & 7);
|
|
68
|
+
}
|
|
69
|
+
return message;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function createBaseSendOtpResponse(): SendOtpResponse {
|
|
74
|
+
return { ok: false };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const SendOtpResponse: MessageFns<SendOtpResponse> = {
|
|
78
|
+
encode(message: SendOtpResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
79
|
+
if (message.ok !== false) {
|
|
80
|
+
writer.uint32(8).bool(message.ok);
|
|
81
|
+
}
|
|
82
|
+
return writer;
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
decode(input: BinaryReader | Uint8Array, length?: number): SendOtpResponse {
|
|
86
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
87
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
88
|
+
const message = createBaseSendOtpResponse();
|
|
89
|
+
while (reader.pos < end) {
|
|
90
|
+
const tag = reader.uint32();
|
|
91
|
+
switch (tag >>> 3) {
|
|
92
|
+
case 1: {
|
|
93
|
+
if (tag !== 8) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
message.ok = reader.bool();
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
reader.skip(tag & 7);
|
|
105
|
+
}
|
|
106
|
+
return message;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export interface AuthServiceClient {
|
|
111
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface AuthServiceController {
|
|
115
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function AuthServiceControllerMethods() {
|
|
119
|
+
return function (constructor: Function) {
|
|
120
|
+
const grpcMethods: string[] = ["sendOtp"];
|
|
121
|
+
for (const method of grpcMethods) {
|
|
122
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
123
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
124
|
+
}
|
|
125
|
+
const grpcStreamMethods: string[] = [];
|
|
126
|
+
for (const method of grpcStreamMethods) {
|
|
127
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
128
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
|
134
|
+
|
|
135
|
+
export interface MessageFns<T> {
|
|
136
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
137
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
138
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@babacarthiamdev/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,outputServices=nest,outputClientImpl=false,package=omit,outputEncodeMethods=false,outputJsonMethods=false"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"proto",
|
|
10
|
+
"gen"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@bufbuild/protobuf": "^2.10.2",
|
|
17
|
+
"@nestjs/microservices": "^11.1.11",
|
|
18
|
+
"rxjs": "^7.8.2",
|
|
19
|
+
"ts-proto": "^2.10.1"
|
|
20
|
+
},
|
|
21
|
+
"license": "ISC"
|
|
22
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth.v1;
|
|
4
|
+
|
|
5
|
+
service AuthService {
|
|
6
|
+
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message SendOtpRequest {
|
|
10
|
+
string identifier = 1;
|
|
11
|
+
string type = 2;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
message SendOtpResponse {
|
|
15
|
+
bool ok = 1;
|
|
16
|
+
}
|