@my-teacinema/contracts 1.0.2 → 1.0.4
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 +20 -175
- package/package.json +3 -10
package/gen/auth.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
// source: auth.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
|
-
import {
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
9
10
|
|
|
10
11
|
export const protobufPackage = "auth.v1";
|
|
11
12
|
|
|
@@ -18,185 +19,29 @@ export interface SendOtpResponse {
|
|
|
18
19
|
ok: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
return { identifier: "", type: "" };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const SendOtpRequest: MessageFns<SendOtpRequest> = {
|
|
26
|
-
encode(message: SendOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
27
|
-
if (message.identifier !== "") {
|
|
28
|
-
writer.uint32(10).string(message.identifier);
|
|
29
|
-
}
|
|
30
|
-
if (message.type !== "") {
|
|
31
|
-
writer.uint32(18).string(message.type);
|
|
32
|
-
}
|
|
33
|
-
return writer;
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
decode(input: BinaryReader | Uint8Array, length?: number): SendOtpRequest {
|
|
37
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
38
|
-
const end = length === undefined ? reader.len : reader.pos + length;
|
|
39
|
-
const message = createBaseSendOtpRequest();
|
|
40
|
-
while (reader.pos < end) {
|
|
41
|
-
const tag = reader.uint32();
|
|
42
|
-
switch (tag >>> 3) {
|
|
43
|
-
case 1: {
|
|
44
|
-
if (tag !== 10) {
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
message.identifier = reader.string();
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
case 2: {
|
|
52
|
-
if (tag !== 18) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
message.type = reader.string();
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
reader.skip(tag & 7);
|
|
64
|
-
}
|
|
65
|
-
return message;
|
|
66
|
-
},
|
|
22
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
67
23
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
|
|
71
|
-
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
toJSON(message: SendOtpRequest): unknown {
|
|
76
|
-
const obj: any = {};
|
|
77
|
-
if (message.identifier !== "") {
|
|
78
|
-
obj.identifier = message.identifier;
|
|
79
|
-
}
|
|
80
|
-
if (message.type !== "") {
|
|
81
|
-
obj.type = message.type;
|
|
82
|
-
}
|
|
83
|
-
return obj;
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
create<I extends Exact<DeepPartial<SendOtpRequest>, I>>(base?: I): SendOtpRequest {
|
|
87
|
-
return SendOtpRequest.fromPartial(base ?? ({} as any));
|
|
88
|
-
},
|
|
89
|
-
fromPartial<I extends Exact<DeepPartial<SendOtpRequest>, I>>(object: I): SendOtpRequest {
|
|
90
|
-
const message = createBaseSendOtpRequest();
|
|
91
|
-
message.identifier = object.identifier ?? "";
|
|
92
|
-
message.type = object.type ?? "";
|
|
93
|
-
return message;
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
function createBaseSendOtpResponse(): SendOtpResponse {
|
|
98
|
-
return { ok: false };
|
|
24
|
+
export interface AuthServiceClient {
|
|
25
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
99
26
|
}
|
|
100
27
|
|
|
101
|
-
export
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
writer.uint32(8).bool(message.ok);
|
|
105
|
-
}
|
|
106
|
-
return writer;
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
decode(input: BinaryReader | Uint8Array, length?: number): SendOtpResponse {
|
|
110
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
111
|
-
const end = length === undefined ? reader.len : reader.pos + length;
|
|
112
|
-
const message = createBaseSendOtpResponse();
|
|
113
|
-
while (reader.pos < end) {
|
|
114
|
-
const tag = reader.uint32();
|
|
115
|
-
switch (tag >>> 3) {
|
|
116
|
-
case 1: {
|
|
117
|
-
if (tag !== 8) {
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
28
|
+
export interface AuthServiceController {
|
|
29
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
30
|
+
}
|
|
120
31
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
reader.skip(tag & 7);
|
|
32
|
+
export function AuthServiceControllerMethods() {
|
|
33
|
+
return function (constructor: Function) {
|
|
34
|
+
const grpcMethods: string[] = ["sendOtp"];
|
|
35
|
+
for (const method of grpcMethods) {
|
|
36
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
37
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
129
38
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return { ok: isSet(object.ok) ? globalThis.Boolean(object.ok) : false };
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
toJSON(message: SendOtpResponse): unknown {
|
|
138
|
-
const obj: any = {};
|
|
139
|
-
if (message.ok !== false) {
|
|
140
|
-
obj.ok = message.ok;
|
|
39
|
+
const grpcStreamMethods: string[] = [];
|
|
40
|
+
for (const method of grpcStreamMethods) {
|
|
41
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
42
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
141
43
|
}
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
create<I extends Exact<DeepPartial<SendOtpResponse>, I>>(base?: I): SendOtpResponse {
|
|
146
|
-
return SendOtpResponse.fromPartial(base ?? ({} as any));
|
|
147
|
-
},
|
|
148
|
-
fromPartial<I extends Exact<DeepPartial<SendOtpResponse>, I>>(object: I): SendOtpResponse {
|
|
149
|
-
const message = createBaseSendOtpResponse();
|
|
150
|
-
message.ok = object.ok ?? false;
|
|
151
|
-
return message;
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export interface AuthService {
|
|
156
|
-
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export const AuthServiceServiceName = "auth.v1.AuthService";
|
|
160
|
-
export class AuthServiceClientImpl implements AuthService {
|
|
161
|
-
private readonly rpc: Rpc;
|
|
162
|
-
private readonly service: string;
|
|
163
|
-
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
164
|
-
this.service = opts?.service || AuthServiceServiceName;
|
|
165
|
-
this.rpc = rpc;
|
|
166
|
-
this.SendOtp = this.SendOtp.bind(this);
|
|
167
|
-
}
|
|
168
|
-
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse> {
|
|
169
|
-
const data = SendOtpRequest.encode(request).finish();
|
|
170
|
-
const promise = this.rpc.request(this.service, "SendOtp", data);
|
|
171
|
-
return promise.then((data) => SendOtpResponse.decode(new BinaryReader(data)));
|
|
172
|
-
}
|
|
44
|
+
};
|
|
173
45
|
}
|
|
174
46
|
|
|
175
|
-
|
|
176
|
-
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
180
|
-
|
|
181
|
-
export type DeepPartial<T> = T extends Builtin ? T
|
|
182
|
-
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
183
|
-
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
184
|
-
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
185
|
-
: Partial<T>;
|
|
186
|
-
|
|
187
|
-
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
188
|
-
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
189
|
-
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
190
|
-
|
|
191
|
-
function isSet(value: any): boolean {
|
|
192
|
-
return value !== null && value !== undefined;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface MessageFns<T> {
|
|
196
|
-
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
197
|
-
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
198
|
-
fromJSON(object: any): T;
|
|
199
|
-
toJSON(message: T): unknown;
|
|
200
|
-
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
201
|
-
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
202
|
-
}
|
|
47
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@my-teacinema/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "generated type script types",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs,package=omit"
|
|
7
|
-
"build": "tsc"
|
|
6
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
8
7
|
},
|
|
9
8
|
"files": [
|
|
10
9
|
"proto",
|
|
@@ -17,11 +16,5 @@
|
|
|
17
16
|
"@nestjs/microservices": "^11.1.23",
|
|
18
17
|
"rxjs": "^7.8.2",
|
|
19
18
|
"ts-proto": "^2.11.8"
|
|
20
|
-
},
|
|
21
|
-
"exports": {
|
|
22
|
-
"./gen/auth": "./gen/auth.js"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"typescript": "^5.0.0"
|
|
26
19
|
}
|
|
27
|
-
}
|
|
20
|
+
}
|