@meocinema/contracts 1.0.8 → 1.0.9
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 +1 -0
- package/gen/account.ts +303 -0
- package/package.json +1 -1
- package/proto/account.proto +27 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
package/gen/account.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
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: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "account.v1";
|
|
11
|
+
|
|
12
|
+
export enum Role {
|
|
13
|
+
USER = 0,
|
|
14
|
+
ADMIN = 1,
|
|
15
|
+
UNRECOGNIZED = -1,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function roleFromJSON(object: any): Role {
|
|
19
|
+
switch (object) {
|
|
20
|
+
case 0:
|
|
21
|
+
case "USER":
|
|
22
|
+
return Role.USER;
|
|
23
|
+
case 1:
|
|
24
|
+
case "ADMIN":
|
|
25
|
+
return Role.ADMIN;
|
|
26
|
+
case -1:
|
|
27
|
+
case "UNRECOGNIZED":
|
|
28
|
+
default:
|
|
29
|
+
return Role.UNRECOGNIZED;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function roleToJSON(object: Role): string {
|
|
34
|
+
switch (object) {
|
|
35
|
+
case Role.USER:
|
|
36
|
+
return "USER";
|
|
37
|
+
case Role.ADMIN:
|
|
38
|
+
return "ADMIN";
|
|
39
|
+
case Role.UNRECOGNIZED:
|
|
40
|
+
default:
|
|
41
|
+
return "UNRECOGNIZED";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GetAccountRequest {
|
|
46
|
+
id: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface GetAccountResponse {
|
|
50
|
+
id: string;
|
|
51
|
+
phone: string;
|
|
52
|
+
email: string;
|
|
53
|
+
isPhoneVerified: boolean;
|
|
54
|
+
isEmailVerified: boolean;
|
|
55
|
+
role: Role;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createBaseGetAccountRequest(): GetAccountRequest {
|
|
59
|
+
return { id: "" };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const GetAccountRequest: MessageFns<GetAccountRequest> = {
|
|
63
|
+
encode(message: GetAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
64
|
+
if (message.id !== "") {
|
|
65
|
+
writer.uint32(10).string(message.id);
|
|
66
|
+
}
|
|
67
|
+
return writer;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountRequest {
|
|
71
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
72
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
73
|
+
const message = createBaseGetAccountRequest();
|
|
74
|
+
while (reader.pos < end) {
|
|
75
|
+
const tag = reader.uint32();
|
|
76
|
+
switch (tag >>> 3) {
|
|
77
|
+
case 1: {
|
|
78
|
+
if (tag !== 10) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message.id = reader.string();
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
reader.skip(tag & 7);
|
|
90
|
+
}
|
|
91
|
+
return message;
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
fromJSON(object: any): GetAccountRequest {
|
|
95
|
+
return { id: isSet(object.id) ? globalThis.String(object.id) : "" };
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
toJSON(message: GetAccountRequest): unknown {
|
|
99
|
+
const obj: any = {};
|
|
100
|
+
if (message.id !== "") {
|
|
101
|
+
obj.id = message.id;
|
|
102
|
+
}
|
|
103
|
+
return obj;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
create<I extends Exact<DeepPartial<GetAccountRequest>, I>>(base?: I): GetAccountRequest {
|
|
107
|
+
return GetAccountRequest.fromPartial(base ?? ({} as any));
|
|
108
|
+
},
|
|
109
|
+
fromPartial<I extends Exact<DeepPartial<GetAccountRequest>, I>>(object: I): GetAccountRequest {
|
|
110
|
+
const message = createBaseGetAccountRequest();
|
|
111
|
+
message.id = object.id ?? "";
|
|
112
|
+
return message;
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function createBaseGetAccountResponse(): GetAccountResponse {
|
|
117
|
+
return { id: "", phone: "", email: "", isPhoneVerified: false, isEmailVerified: false, role: 0 };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const GetAccountResponse: MessageFns<GetAccountResponse> = {
|
|
121
|
+
encode(message: GetAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
122
|
+
if (message.id !== "") {
|
|
123
|
+
writer.uint32(10).string(message.id);
|
|
124
|
+
}
|
|
125
|
+
if (message.phone !== "") {
|
|
126
|
+
writer.uint32(18).string(message.phone);
|
|
127
|
+
}
|
|
128
|
+
if (message.email !== "") {
|
|
129
|
+
writer.uint32(26).string(message.email);
|
|
130
|
+
}
|
|
131
|
+
if (message.isPhoneVerified !== false) {
|
|
132
|
+
writer.uint32(32).bool(message.isPhoneVerified);
|
|
133
|
+
}
|
|
134
|
+
if (message.isEmailVerified !== false) {
|
|
135
|
+
writer.uint32(40).bool(message.isEmailVerified);
|
|
136
|
+
}
|
|
137
|
+
if (message.role !== 0) {
|
|
138
|
+
writer.uint32(48).int32(message.role);
|
|
139
|
+
}
|
|
140
|
+
return writer;
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
decode(input: BinaryReader | Uint8Array, length?: number): GetAccountResponse {
|
|
144
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
145
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
146
|
+
const message = createBaseGetAccountResponse();
|
|
147
|
+
while (reader.pos < end) {
|
|
148
|
+
const tag = reader.uint32();
|
|
149
|
+
switch (tag >>> 3) {
|
|
150
|
+
case 1: {
|
|
151
|
+
if (tag !== 10) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
message.id = reader.string();
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
case 2: {
|
|
159
|
+
if (tag !== 18) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
message.phone = reader.string();
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
case 3: {
|
|
167
|
+
if (tag !== 26) {
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
message.email = reader.string();
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
case 4: {
|
|
175
|
+
if (tag !== 32) {
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
message.isPhoneVerified = reader.bool();
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
case 5: {
|
|
183
|
+
if (tag !== 40) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
message.isEmailVerified = reader.bool();
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
case 6: {
|
|
191
|
+
if (tag !== 48) {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
message.role = reader.int32() as any;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
reader.skip(tag & 7);
|
|
203
|
+
}
|
|
204
|
+
return message;
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
fromJSON(object: any): GetAccountResponse {
|
|
208
|
+
return {
|
|
209
|
+
id: isSet(object.id) ? globalThis.String(object.id) : "",
|
|
210
|
+
phone: isSet(object.phone) ? globalThis.String(object.phone) : "",
|
|
211
|
+
email: isSet(object.email) ? globalThis.String(object.email) : "",
|
|
212
|
+
isPhoneVerified: isSet(object.isPhoneVerified) ? globalThis.Boolean(object.isPhoneVerified) : false,
|
|
213
|
+
isEmailVerified: isSet(object.isEmailVerified) ? globalThis.Boolean(object.isEmailVerified) : false,
|
|
214
|
+
role: isSet(object.role) ? roleFromJSON(object.role) : 0,
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
toJSON(message: GetAccountResponse): unknown {
|
|
219
|
+
const obj: any = {};
|
|
220
|
+
if (message.id !== "") {
|
|
221
|
+
obj.id = message.id;
|
|
222
|
+
}
|
|
223
|
+
if (message.phone !== "") {
|
|
224
|
+
obj.phone = message.phone;
|
|
225
|
+
}
|
|
226
|
+
if (message.email !== "") {
|
|
227
|
+
obj.email = message.email;
|
|
228
|
+
}
|
|
229
|
+
if (message.isPhoneVerified !== false) {
|
|
230
|
+
obj.isPhoneVerified = message.isPhoneVerified;
|
|
231
|
+
}
|
|
232
|
+
if (message.isEmailVerified !== false) {
|
|
233
|
+
obj.isEmailVerified = message.isEmailVerified;
|
|
234
|
+
}
|
|
235
|
+
if (message.role !== 0) {
|
|
236
|
+
obj.role = roleToJSON(message.role);
|
|
237
|
+
}
|
|
238
|
+
return obj;
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
create<I extends Exact<DeepPartial<GetAccountResponse>, I>>(base?: I): GetAccountResponse {
|
|
242
|
+
return GetAccountResponse.fromPartial(base ?? ({} as any));
|
|
243
|
+
},
|
|
244
|
+
fromPartial<I extends Exact<DeepPartial<GetAccountResponse>, I>>(object: I): GetAccountResponse {
|
|
245
|
+
const message = createBaseGetAccountResponse();
|
|
246
|
+
message.id = object.id ?? "";
|
|
247
|
+
message.phone = object.phone ?? "";
|
|
248
|
+
message.email = object.email ?? "";
|
|
249
|
+
message.isPhoneVerified = object.isPhoneVerified ?? false;
|
|
250
|
+
message.isEmailVerified = object.isEmailVerified ?? false;
|
|
251
|
+
message.role = object.role ?? 0;
|
|
252
|
+
return message;
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export interface AccountService {
|
|
257
|
+
GetAccount(request: GetAccountRequest): Promise<GetAccountResponse>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const AccountServiceServiceName = "account.v1.AccountService";
|
|
261
|
+
export class AccountServiceClientImpl implements AccountService {
|
|
262
|
+
private readonly rpc: Rpc;
|
|
263
|
+
private readonly service: string;
|
|
264
|
+
constructor(rpc: Rpc, opts?: { service?: string }) {
|
|
265
|
+
this.service = opts?.service || AccountServiceServiceName;
|
|
266
|
+
this.rpc = rpc;
|
|
267
|
+
this.GetAccount = this.GetAccount.bind(this);
|
|
268
|
+
}
|
|
269
|
+
GetAccount(request: GetAccountRequest): Promise<GetAccountResponse> {
|
|
270
|
+
const data = GetAccountRequest.encode(request).finish();
|
|
271
|
+
const promise = this.rpc.request(this.service, "GetAccount", data);
|
|
272
|
+
return promise.then((data) => GetAccountResponse.decode(new BinaryReader(data)));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface Rpc {
|
|
277
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
281
|
+
|
|
282
|
+
export type DeepPartial<T> = T extends Builtin ? T
|
|
283
|
+
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
|
|
284
|
+
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
285
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
286
|
+
: Partial<T>;
|
|
287
|
+
|
|
288
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
289
|
+
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
290
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
291
|
+
|
|
292
|
+
function isSet(value: any): boolean {
|
|
293
|
+
return value !== null && value !== undefined;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface MessageFns<T> {
|
|
297
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
298
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
299
|
+
fromJSON(object: any): T;
|
|
300
|
+
toJSON(message: T): unknown;
|
|
301
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
302
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
303
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
18
|
+
bool is_phone_verified = 4;
|
|
19
|
+
bool is_email_verified = 5;
|
|
20
|
+
|
|
21
|
+
Role role = 6;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
enum Role {
|
|
25
|
+
USER = 0;
|
|
26
|
+
ADMIN = 1;
|
|
27
|
+
}
|