@babacarthiamdev/contracts 1.0.19 → 1.0.21
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/media.ts +358 -0
- package/gen/users.ts +12 -0
- package/package.json +1 -1
- package/proto/media.proto +38 -0
- package/proto/users.proto +1 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -5,5 +5,6 @@ const node_path_1 = require("node:path");
|
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
6
|
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto'),
|
|
8
|
-
USERS: (0, node_path_1.join)(__dirname, '../../proto/users.proto')
|
|
8
|
+
USERS: (0, node_path_1.join)(__dirname, '../../proto/users.proto'),
|
|
9
|
+
MEDIA: (0, node_path_1.join)(__dirname, '../../proto/media.proto'),
|
|
9
10
|
};
|
package/gen/media.ts
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
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: media.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 = "media.v1";
|
|
13
|
+
|
|
14
|
+
export interface UploadRequest {
|
|
15
|
+
fileName: string;
|
|
16
|
+
folder: string;
|
|
17
|
+
contentType: string;
|
|
18
|
+
data: Uint8Array;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface UploadResponse {
|
|
22
|
+
key: string;
|
|
23
|
+
url: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FetchRequest {
|
|
27
|
+
key: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FetchResponse {
|
|
31
|
+
data: string;
|
|
32
|
+
contentType: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DeleteRequest {
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DeleteResponse {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
44
|
+
|
|
45
|
+
function createBaseUploadRequest(): UploadRequest {
|
|
46
|
+
return { fileName: "", folder: "", contentType: "", data: new Uint8Array(0) };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const UploadRequest: MessageFns<UploadRequest> = {
|
|
50
|
+
encode(message: UploadRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
51
|
+
if (message.fileName !== "") {
|
|
52
|
+
writer.uint32(10).string(message.fileName);
|
|
53
|
+
}
|
|
54
|
+
if (message.folder !== "") {
|
|
55
|
+
writer.uint32(18).string(message.folder);
|
|
56
|
+
}
|
|
57
|
+
if (message.contentType !== "") {
|
|
58
|
+
writer.uint32(26).string(message.contentType);
|
|
59
|
+
}
|
|
60
|
+
if (message.data.length !== 0) {
|
|
61
|
+
writer.uint32(34).bytes(message.data);
|
|
62
|
+
}
|
|
63
|
+
return writer;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
decode(input: BinaryReader | Uint8Array, length?: number): UploadRequest {
|
|
67
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
68
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
69
|
+
const message = createBaseUploadRequest();
|
|
70
|
+
while (reader.pos < end) {
|
|
71
|
+
const tag = reader.uint32();
|
|
72
|
+
switch (tag >>> 3) {
|
|
73
|
+
case 1: {
|
|
74
|
+
if (tag !== 10) {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message.fileName = reader.string();
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
case 2: {
|
|
82
|
+
if (tag !== 18) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
message.folder = reader.string();
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
case 3: {
|
|
90
|
+
if (tag !== 26) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
message.contentType = reader.string();
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
case 4: {
|
|
98
|
+
if (tag !== 34) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
message.data = reader.bytes();
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
reader.skip(tag & 7);
|
|
110
|
+
}
|
|
111
|
+
return message;
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function createBaseUploadResponse(): UploadResponse {
|
|
116
|
+
return { key: "", url: "" };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const UploadResponse: MessageFns<UploadResponse> = {
|
|
120
|
+
encode(message: UploadResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
121
|
+
if (message.key !== "") {
|
|
122
|
+
writer.uint32(10).string(message.key);
|
|
123
|
+
}
|
|
124
|
+
if (message.url !== "") {
|
|
125
|
+
writer.uint32(18).string(message.url);
|
|
126
|
+
}
|
|
127
|
+
return writer;
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
decode(input: BinaryReader | Uint8Array, length?: number): UploadResponse {
|
|
131
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
132
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
133
|
+
const message = createBaseUploadResponse();
|
|
134
|
+
while (reader.pos < end) {
|
|
135
|
+
const tag = reader.uint32();
|
|
136
|
+
switch (tag >>> 3) {
|
|
137
|
+
case 1: {
|
|
138
|
+
if (tag !== 10) {
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
message.key = reader.string();
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
case 2: {
|
|
146
|
+
if (tag !== 18) {
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
message.url = reader.string();
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
reader.skip(tag & 7);
|
|
158
|
+
}
|
|
159
|
+
return message;
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
function createBaseFetchRequest(): FetchRequest {
|
|
164
|
+
return { key: "" };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const FetchRequest: MessageFns<FetchRequest> = {
|
|
168
|
+
encode(message: FetchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
169
|
+
if (message.key !== "") {
|
|
170
|
+
writer.uint32(10).string(message.key);
|
|
171
|
+
}
|
|
172
|
+
return writer;
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
decode(input: BinaryReader | Uint8Array, length?: number): FetchRequest {
|
|
176
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
177
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
178
|
+
const message = createBaseFetchRequest();
|
|
179
|
+
while (reader.pos < end) {
|
|
180
|
+
const tag = reader.uint32();
|
|
181
|
+
switch (tag >>> 3) {
|
|
182
|
+
case 1: {
|
|
183
|
+
if (tag !== 10) {
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
message.key = reader.string();
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
reader.skip(tag & 7);
|
|
195
|
+
}
|
|
196
|
+
return message;
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
function createBaseFetchResponse(): FetchResponse {
|
|
201
|
+
return { data: "", contentType: "" };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export const FetchResponse: MessageFns<FetchResponse> = {
|
|
205
|
+
encode(message: FetchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
206
|
+
if (message.data !== "") {
|
|
207
|
+
writer.uint32(10).string(message.data);
|
|
208
|
+
}
|
|
209
|
+
if (message.contentType !== "") {
|
|
210
|
+
writer.uint32(18).string(message.contentType);
|
|
211
|
+
}
|
|
212
|
+
return writer;
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
decode(input: BinaryReader | Uint8Array, length?: number): FetchResponse {
|
|
216
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
217
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
218
|
+
const message = createBaseFetchResponse();
|
|
219
|
+
while (reader.pos < end) {
|
|
220
|
+
const tag = reader.uint32();
|
|
221
|
+
switch (tag >>> 3) {
|
|
222
|
+
case 1: {
|
|
223
|
+
if (tag !== 10) {
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
message.data = reader.string();
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
case 2: {
|
|
231
|
+
if (tag !== 18) {
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
message.contentType = reader.string();
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
reader.skip(tag & 7);
|
|
243
|
+
}
|
|
244
|
+
return message;
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
function createBaseDeleteRequest(): DeleteRequest {
|
|
249
|
+
return { key: "" };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export const DeleteRequest: MessageFns<DeleteRequest> = {
|
|
253
|
+
encode(message: DeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
254
|
+
if (message.key !== "") {
|
|
255
|
+
writer.uint32(10).string(message.key);
|
|
256
|
+
}
|
|
257
|
+
return writer;
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
decode(input: BinaryReader | Uint8Array, length?: number): DeleteRequest {
|
|
261
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
262
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
263
|
+
const message = createBaseDeleteRequest();
|
|
264
|
+
while (reader.pos < end) {
|
|
265
|
+
const tag = reader.uint32();
|
|
266
|
+
switch (tag >>> 3) {
|
|
267
|
+
case 1: {
|
|
268
|
+
if (tag !== 10) {
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
message.key = reader.string();
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
reader.skip(tag & 7);
|
|
280
|
+
}
|
|
281
|
+
return message;
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
function createBaseDeleteResponse(): DeleteResponse {
|
|
286
|
+
return { ok: false };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export const DeleteResponse: MessageFns<DeleteResponse> = {
|
|
290
|
+
encode(message: DeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
291
|
+
if (message.ok !== false) {
|
|
292
|
+
writer.uint32(8).bool(message.ok);
|
|
293
|
+
}
|
|
294
|
+
return writer;
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
decode(input: BinaryReader | Uint8Array, length?: number): DeleteResponse {
|
|
298
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
299
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
300
|
+
const message = createBaseDeleteResponse();
|
|
301
|
+
while (reader.pos < end) {
|
|
302
|
+
const tag = reader.uint32();
|
|
303
|
+
switch (tag >>> 3) {
|
|
304
|
+
case 1: {
|
|
305
|
+
if (tag !== 8) {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
message.ok = reader.bool();
|
|
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
|
+
|
|
322
|
+
export interface MediaServiceClient {
|
|
323
|
+
upload(request: UploadRequest): Observable<UploadResponse>;
|
|
324
|
+
|
|
325
|
+
fetch(request: FetchRequest): Observable<FetchResponse>;
|
|
326
|
+
|
|
327
|
+
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface MediaServiceController {
|
|
331
|
+
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
|
332
|
+
|
|
333
|
+
fetch(request: FetchRequest): Promise<FetchResponse> | Observable<FetchResponse> | FetchResponse;
|
|
334
|
+
|
|
335
|
+
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export function MediaServiceControllerMethods() {
|
|
339
|
+
return function (constructor: Function) {
|
|
340
|
+
const grpcMethods: string[] = ["upload", "fetch", "delete"];
|
|
341
|
+
for (const method of grpcMethods) {
|
|
342
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
343
|
+
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
344
|
+
}
|
|
345
|
+
const grpcStreamMethods: string[] = [];
|
|
346
|
+
for (const method of grpcStreamMethods) {
|
|
347
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
348
|
+
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export const MEDIA_SERVICE_NAME = "MediaService";
|
|
354
|
+
|
|
355
|
+
export interface MessageFns<T> {
|
|
356
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
357
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
358
|
+
}
|
package/gen/users.ts
CHANGED
|
@@ -30,6 +30,7 @@ export interface CreateUserResponse {
|
|
|
30
30
|
export interface PatchUserRequest {
|
|
31
31
|
userId: string;
|
|
32
32
|
name?: string | undefined;
|
|
33
|
+
avatar?: string | undefined;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface PatchUserResponse {
|
|
@@ -206,6 +207,9 @@ export const PatchUserRequest: MessageFns<PatchUserRequest> = {
|
|
|
206
207
|
if (message.name !== undefined) {
|
|
207
208
|
writer.uint32(18).string(message.name);
|
|
208
209
|
}
|
|
210
|
+
if (message.avatar !== undefined) {
|
|
211
|
+
writer.uint32(26).string(message.avatar);
|
|
212
|
+
}
|
|
209
213
|
return writer;
|
|
210
214
|
},
|
|
211
215
|
|
|
@@ -232,6 +236,14 @@ export const PatchUserRequest: MessageFns<PatchUserRequest> = {
|
|
|
232
236
|
message.name = reader.string();
|
|
233
237
|
continue;
|
|
234
238
|
}
|
|
239
|
+
case 3: {
|
|
240
|
+
if (tag !== 26) {
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
message.avatar = reader.string();
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
235
247
|
}
|
|
236
248
|
if ((tag & 7) === 4 || tag === 0) {
|
|
237
249
|
break;
|
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package media.v1;
|
|
4
|
+
|
|
5
|
+
service MediaService {
|
|
6
|
+
rpc Upload (UploadRequest) returns (UploadResponse);
|
|
7
|
+
rpc Fetch (FetchRequest) returns (FetchResponse);
|
|
8
|
+
rpc Delete (DeleteRequest) returns (DeleteResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message UploadRequest {
|
|
12
|
+
string file_name = 1;
|
|
13
|
+
string folder = 2;
|
|
14
|
+
string content_type = 3;
|
|
15
|
+
bytes data = 4;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message UploadResponse {
|
|
19
|
+
string key = 1;
|
|
20
|
+
string url = 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message FetchRequest {
|
|
24
|
+
string key = 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message FetchResponse {
|
|
28
|
+
string data = 1;
|
|
29
|
+
string content_type = 2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message DeleteRequest {
|
|
33
|
+
string key = 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message DeleteResponse {
|
|
37
|
+
bool ok = 1;
|
|
38
|
+
}
|