@meocinema/contracts 1.0.2
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 +203 -0
- package/package.json +20 -0
- package/proto/auth.proto +17 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v6.33.2
|
|
5
|
+
// source: auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "auth.v1";
|
|
11
|
+
|
|
12
|
+
export interface SendOtpRequest {
|
|
13
|
+
identifier: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SendOtpResponse {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
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
|
+
},
|
|
67
|
+
|
|
68
|
+
fromJSON(object: any): SendOtpRequest {
|
|
69
|
+
return {
|
|
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 };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const SendOtpResponse: MessageFns<SendOtpResponse> = {
|
|
102
|
+
encode(message: SendOtpResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
103
|
+
if (message.ok !== false) {
|
|
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
|
+
}
|
|
120
|
+
|
|
121
|
+
message.ok = reader.bool();
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
reader.skip(tag & 7);
|
|
129
|
+
}
|
|
130
|
+
return message;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
fromJSON(object: any): SendOtpResponse {
|
|
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;
|
|
141
|
+
}
|
|
142
|
+
return obj;
|
|
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
|
+
/** rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse); */
|
|
157
|
+
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export const AuthServiceServiceName = "auth.v1.AuthService";
|
|
161
|
+
export class AuthServiceClientImpl implements AuthService {
|
|
162
|
+
private readonly rpc: Rpc;
|
|
163
|
+
private readonly service: string;
|
|
164
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
165
|
+
this.service = opts?.service || AuthServiceServiceName;
|
|
166
|
+
this.rpc = rpc;
|
|
167
|
+
this.SendOtp = this.SendOtp.bind(this);
|
|
168
|
+
}
|
|
169
|
+
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse> {
|
|
170
|
+
const data = SendOtpRequest.encode(request).finish();
|
|
171
|
+
const promise = this.rpc.request(this.service, "SendOtp", data);
|
|
172
|
+
return promise.then((data) => SendOtpResponse.decode(new BinaryReader(data)));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface Rpc {
|
|
177
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
181
|
+
|
|
182
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
183
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
184
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
185
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
186
|
+
: Partial<T>;
|
|
187
|
+
|
|
188
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
189
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
190
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
191
|
+
|
|
192
|
+
function isSet(value: any): boolean {
|
|
193
|
+
return value !== null && value !== undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface MessageFns<T> {
|
|
197
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
198
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
199
|
+
fromJSON(object: any): T;
|
|
200
|
+
toJSON(message: T): unknown;
|
|
201
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
202
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
203
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meocinema/contracts",
|
|
3
|
+
"description": "Protobuf contracts for MeoCinema services",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"author": "meolex",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@bufbuild/protobuf": "^2.10.2",
|
|
8
|
+
"ts-proto": "^2.10.1"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"generate": "npx protoc -I ./proto/ ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJS=true,package=omit"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"proto",
|
|
15
|
+
"gen"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth.v1;
|
|
4
|
+
|
|
5
|
+
service AuthService {
|
|
6
|
+
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
7
|
+
// rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
message SendOtpRequest {
|
|
11
|
+
string identifier = 1;
|
|
12
|
+
string type = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message SendOtpResponse {
|
|
16
|
+
bool ok = 1;
|
|
17
|
+
}
|