@outlyapp/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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Odinaka Robert Nnamani
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # contracts
2
+ contracts shared between the outly microservices
@@ -0,0 +1,11 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v6.33.4
5
+ // source: auth/auth.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "";
10
+
11
+ export const _PACKAGE_NAME = "";
@@ -0,0 +1,3 @@
1
+ export * as auth from "./auth/auth";
2
+ export * as listings from "./listings/listings";
3
+ export * as users from "./users/users";
@@ -0,0 +1,11 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v6.33.4
5
+ // source: listings/listings.proto
6
+
7
+ /* eslint-disable */
8
+
9
+ export const protobufPackage = "";
10
+
11
+ export const _PACKAGE_NAME = "";
@@ -0,0 +1,364 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v1.181.2
4
+ // protoc v6.33.4
5
+ // source: users/users.proto
6
+
7
+ /* eslint-disable */
8
+ import type { handleUnaryCall, UntypedServiceImplementation } from "@grpc/grpc-js";
9
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
10
+ import _m0 from "protobufjs/minimal";
11
+ import { Observable } from "rxjs";
12
+
13
+ export const protobufPackage = "users";
14
+
15
+ export interface CreateProfileRequest {
16
+ id: string;
17
+ email: string;
18
+ username: string;
19
+ name: string;
20
+ }
21
+
22
+ export interface GetUserByIdRequest {
23
+ id: string;
24
+ }
25
+
26
+ export interface GetUserByUsernameRequest {
27
+ username: string;
28
+ }
29
+
30
+ export interface UserResponse {
31
+ id: string;
32
+ email: string;
33
+ username: string;
34
+ name: string;
35
+ avatarUrl: string;
36
+ hasSellerProfile: boolean;
37
+ ratingAvg: number;
38
+ ratingCount: number;
39
+ }
40
+
41
+ export const USERS_PACKAGE_NAME = "users";
42
+
43
+ function createBaseCreateProfileRequest(): CreateProfileRequest {
44
+ return { id: "", email: "", username: "", name: "" };
45
+ }
46
+
47
+ export const CreateProfileRequest = {
48
+ encode(message: CreateProfileRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
49
+ if (message.id !== "") {
50
+ writer.uint32(10).string(message.id);
51
+ }
52
+ if (message.email !== "") {
53
+ writer.uint32(18).string(message.email);
54
+ }
55
+ if (message.username !== "") {
56
+ writer.uint32(26).string(message.username);
57
+ }
58
+ if (message.name !== "") {
59
+ writer.uint32(34).string(message.name);
60
+ }
61
+ return writer;
62
+ },
63
+
64
+ decode(input: _m0.Reader | Uint8Array, length?: number): CreateProfileRequest {
65
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
66
+ let end = length === undefined ? reader.len : reader.pos + length;
67
+ const message = createBaseCreateProfileRequest();
68
+ while (reader.pos < end) {
69
+ const tag = reader.uint32();
70
+ switch (tag >>> 3) {
71
+ case 1:
72
+ if (tag !== 10) {
73
+ break;
74
+ }
75
+
76
+ message.id = reader.string();
77
+ continue;
78
+ case 2:
79
+ if (tag !== 18) {
80
+ break;
81
+ }
82
+
83
+ message.email = reader.string();
84
+ continue;
85
+ case 3:
86
+ if (tag !== 26) {
87
+ break;
88
+ }
89
+
90
+ message.username = reader.string();
91
+ continue;
92
+ case 4:
93
+ if (tag !== 34) {
94
+ break;
95
+ }
96
+
97
+ message.name = reader.string();
98
+ continue;
99
+ }
100
+ if ((tag & 7) === 4 || tag === 0) {
101
+ break;
102
+ }
103
+ reader.skipType(tag & 7);
104
+ }
105
+ return message;
106
+ },
107
+ };
108
+
109
+ function createBaseGetUserByIdRequest(): GetUserByIdRequest {
110
+ return { id: "" };
111
+ }
112
+
113
+ export const GetUserByIdRequest = {
114
+ encode(message: GetUserByIdRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
115
+ if (message.id !== "") {
116
+ writer.uint32(10).string(message.id);
117
+ }
118
+ return writer;
119
+ },
120
+
121
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByIdRequest {
122
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
123
+ let end = length === undefined ? reader.len : reader.pos + length;
124
+ const message = createBaseGetUserByIdRequest();
125
+ while (reader.pos < end) {
126
+ const tag = reader.uint32();
127
+ switch (tag >>> 3) {
128
+ case 1:
129
+ if (tag !== 10) {
130
+ break;
131
+ }
132
+
133
+ message.id = reader.string();
134
+ continue;
135
+ }
136
+ if ((tag & 7) === 4 || tag === 0) {
137
+ break;
138
+ }
139
+ reader.skipType(tag & 7);
140
+ }
141
+ return message;
142
+ },
143
+ };
144
+
145
+ function createBaseGetUserByUsernameRequest(): GetUserByUsernameRequest {
146
+ return { username: "" };
147
+ }
148
+
149
+ export const GetUserByUsernameRequest = {
150
+ encode(message: GetUserByUsernameRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
151
+ if (message.username !== "") {
152
+ writer.uint32(10).string(message.username);
153
+ }
154
+ return writer;
155
+ },
156
+
157
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetUserByUsernameRequest {
158
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
159
+ let end = length === undefined ? reader.len : reader.pos + length;
160
+ const message = createBaseGetUserByUsernameRequest();
161
+ while (reader.pos < end) {
162
+ const tag = reader.uint32();
163
+ switch (tag >>> 3) {
164
+ case 1:
165
+ if (tag !== 10) {
166
+ break;
167
+ }
168
+
169
+ message.username = reader.string();
170
+ continue;
171
+ }
172
+ if ((tag & 7) === 4 || tag === 0) {
173
+ break;
174
+ }
175
+ reader.skipType(tag & 7);
176
+ }
177
+ return message;
178
+ },
179
+ };
180
+
181
+ function createBaseUserResponse(): UserResponse {
182
+ return {
183
+ id: "",
184
+ email: "",
185
+ username: "",
186
+ name: "",
187
+ avatarUrl: "",
188
+ hasSellerProfile: false,
189
+ ratingAvg: 0,
190
+ ratingCount: 0,
191
+ };
192
+ }
193
+
194
+ export const UserResponse = {
195
+ encode(message: UserResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
196
+ if (message.id !== "") {
197
+ writer.uint32(10).string(message.id);
198
+ }
199
+ if (message.email !== "") {
200
+ writer.uint32(18).string(message.email);
201
+ }
202
+ if (message.username !== "") {
203
+ writer.uint32(26).string(message.username);
204
+ }
205
+ if (message.name !== "") {
206
+ writer.uint32(34).string(message.name);
207
+ }
208
+ if (message.avatarUrl !== "") {
209
+ writer.uint32(42).string(message.avatarUrl);
210
+ }
211
+ if (message.hasSellerProfile !== false) {
212
+ writer.uint32(48).bool(message.hasSellerProfile);
213
+ }
214
+ if (message.ratingAvg !== 0) {
215
+ writer.uint32(61).float(message.ratingAvg);
216
+ }
217
+ if (message.ratingCount !== 0) {
218
+ writer.uint32(64).int32(message.ratingCount);
219
+ }
220
+ return writer;
221
+ },
222
+
223
+ decode(input: _m0.Reader | Uint8Array, length?: number): UserResponse {
224
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
225
+ let end = length === undefined ? reader.len : reader.pos + length;
226
+ const message = createBaseUserResponse();
227
+ while (reader.pos < end) {
228
+ const tag = reader.uint32();
229
+ switch (tag >>> 3) {
230
+ case 1:
231
+ if (tag !== 10) {
232
+ break;
233
+ }
234
+
235
+ message.id = reader.string();
236
+ continue;
237
+ case 2:
238
+ if (tag !== 18) {
239
+ break;
240
+ }
241
+
242
+ message.email = reader.string();
243
+ continue;
244
+ case 3:
245
+ if (tag !== 26) {
246
+ break;
247
+ }
248
+
249
+ message.username = reader.string();
250
+ continue;
251
+ case 4:
252
+ if (tag !== 34) {
253
+ break;
254
+ }
255
+
256
+ message.name = reader.string();
257
+ continue;
258
+ case 5:
259
+ if (tag !== 42) {
260
+ break;
261
+ }
262
+
263
+ message.avatarUrl = reader.string();
264
+ continue;
265
+ case 6:
266
+ if (tag !== 48) {
267
+ break;
268
+ }
269
+
270
+ message.hasSellerProfile = reader.bool();
271
+ continue;
272
+ case 7:
273
+ if (tag !== 61) {
274
+ break;
275
+ }
276
+
277
+ message.ratingAvg = reader.float();
278
+ continue;
279
+ case 8:
280
+ if (tag !== 64) {
281
+ break;
282
+ }
283
+
284
+ message.ratingCount = reader.int32();
285
+ continue;
286
+ }
287
+ if ((tag & 7) === 4 || tag === 0) {
288
+ break;
289
+ }
290
+ reader.skipType(tag & 7);
291
+ }
292
+ return message;
293
+ },
294
+ };
295
+
296
+ export interface UsersServiceClient {
297
+ createProfile(request: CreateProfileRequest): Observable<UserResponse>;
298
+
299
+ getUserById(request: GetUserByIdRequest): Observable<UserResponse>;
300
+
301
+ getUserByUsername(request: GetUserByUsernameRequest): Observable<UserResponse>;
302
+ }
303
+
304
+ export interface UsersServiceController {
305
+ createProfile(request: CreateProfileRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
306
+
307
+ getUserById(request: GetUserByIdRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
308
+
309
+ getUserByUsername(request: GetUserByUsernameRequest): Promise<UserResponse> | Observable<UserResponse> | UserResponse;
310
+ }
311
+
312
+ export function UsersServiceControllerMethods() {
313
+ return function (constructor: Function) {
314
+ const grpcMethods: string[] = ["createProfile", "getUserById", "getUserByUsername"];
315
+ for (const method of grpcMethods) {
316
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
317
+ GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
318
+ }
319
+ const grpcStreamMethods: string[] = [];
320
+ for (const method of grpcStreamMethods) {
321
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
322
+ GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
323
+ }
324
+ };
325
+ }
326
+
327
+ export const USERS_SERVICE_NAME = "UsersService";
328
+
329
+ export type UsersServiceService = typeof UsersServiceService;
330
+ export const UsersServiceService = {
331
+ createProfile: {
332
+ path: "/users.UsersService/CreateProfile",
333
+ requestStream: false,
334
+ responseStream: false,
335
+ requestSerialize: (value: CreateProfileRequest) => Buffer.from(CreateProfileRequest.encode(value).finish()),
336
+ requestDeserialize: (value: Buffer) => CreateProfileRequest.decode(value),
337
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
338
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
339
+ },
340
+ getUserById: {
341
+ path: "/users.UsersService/GetUserById",
342
+ requestStream: false,
343
+ responseStream: false,
344
+ requestSerialize: (value: GetUserByIdRequest) => Buffer.from(GetUserByIdRequest.encode(value).finish()),
345
+ requestDeserialize: (value: Buffer) => GetUserByIdRequest.decode(value),
346
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
347
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
348
+ },
349
+ getUserByUsername: {
350
+ path: "/users.UsersService/GetUserByUsername",
351
+ requestStream: false,
352
+ responseStream: false,
353
+ requestSerialize: (value: GetUserByUsernameRequest) => Buffer.from(GetUserByUsernameRequest.encode(value).finish()),
354
+ requestDeserialize: (value: Buffer) => GetUserByUsernameRequest.decode(value),
355
+ responseSerialize: (value: UserResponse) => Buffer.from(UserResponse.encode(value).finish()),
356
+ responseDeserialize: (value: Buffer) => UserResponse.decode(value),
357
+ },
358
+ } as const;
359
+
360
+ export interface UsersServiceServer extends UntypedServiceImplementation {
361
+ createProfile: handleUnaryCall<CreateProfileRequest, UserResponse>;
362
+ getUserById: handleUnaryCall<GetUserByIdRequest, UserResponse>;
363
+ getUserByUsername: handleUnaryCall<GetUserByUsernameRequest, UserResponse>;
364
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@outlyapp/contracts",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "files": [
7
+ "generated"
8
+ ],
9
+ "main": "generated/index.js",
10
+ "types": "generated/index.d.ts",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "clean": "rm -rf generated",
16
+ "gen": "pnpm clean && node scripts/gen.js",
17
+ "publish:contracts": "pnpm gen && npm publish --access public ."
18
+ },
19
+ "devDependencies": {
20
+ "protobufjs": "^7.0.0",
21
+ "ts-proto": "^1.173.0",
22
+ "typescript": "^5.0.0"
23
+ },
24
+ "dependencies": {
25
+ "@grpc/grpc-js": "^1.14.3",
26
+ "@nestjs/microservices": "^11.1.14",
27
+ "rxjs": "^7.8.2"
28
+ }
29
+ }