@nemma-training/contracts 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/gen/auth.ts +22 -343
  2. package/package.json +3 -3
package/gen/auth.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
2
  // versions:
3
3
  // protoc-gen-ts_proto v2.11.1
4
- // protoc v3.12.4
4
+ // protoc v3.21.12
5
5
  // source: auth.proto
6
6
 
7
7
  /* eslint-disable */
8
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
9
10
 
10
11
  export const protobufPackage = "auth.v1";
11
12
 
@@ -30,355 +31,33 @@ export interface VerifyOtpResponse {
30
31
  refreshToken: string;
31
32
  }
32
33
 
33
- function createBaseSendOtpRequest(): SendOtpRequest {
34
- return { identifier: "", type: "" };
35
- }
36
-
37
- export const SendOtpRequest: MessageFns<SendOtpRequest> = {
38
- encode(message: SendOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
39
- if (message.identifier !== "") {
40
- writer.uint32(10).string(message.identifier);
41
- }
42
- if (message.type !== "") {
43
- writer.uint32(18).string(message.type);
44
- }
45
- return writer;
46
- },
47
-
48
- decode(input: BinaryReader | Uint8Array, length?: number): SendOtpRequest {
49
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
50
- const end = length === undefined ? reader.len : reader.pos + length;
51
- const message = createBaseSendOtpRequest();
52
- while (reader.pos < end) {
53
- const tag = reader.uint32();
54
- switch (tag >>> 3) {
55
- case 1: {
56
- if (tag !== 10) {
57
- break;
58
- }
59
-
60
- message.identifier = reader.string();
61
- continue;
62
- }
63
- case 2: {
64
- if (tag !== 18) {
65
- break;
66
- }
67
-
68
- message.type = reader.string();
69
- continue;
70
- }
71
- }
72
- if ((tag & 7) === 4 || tag === 0) {
73
- break;
74
- }
75
- reader.skip(tag & 7);
76
- }
77
- return message;
78
- },
79
-
80
- fromJSON(object: any): SendOtpRequest {
81
- return {
82
- identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
83
- type: isSet(object.type) ? globalThis.String(object.type) : "",
84
- };
85
- },
34
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
86
35
 
87
- toJSON(message: SendOtpRequest): unknown {
88
- const obj: any = {};
89
- if (message.identifier !== "") {
90
- obj.identifier = message.identifier;
91
- }
92
- if (message.type !== "") {
93
- obj.type = message.type;
94
- }
95
- return obj;
96
- },
36
+ export interface AuthServiceClient {
37
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
97
38
 
98
- create<I extends Exact<DeepPartial<SendOtpRequest>, I>>(base?: I): SendOtpRequest {
99
- return SendOtpRequest.fromPartial(base ?? ({} as any));
100
- },
101
- fromPartial<I extends Exact<DeepPartial<SendOtpRequest>, I>>(object: I): SendOtpRequest {
102
- const message = createBaseSendOtpRequest();
103
- message.identifier = object.identifier ?? "";
104
- message.type = object.type ?? "";
105
- return message;
106
- },
107
- };
108
-
109
- function createBaseSendOtpResponse(): SendOtpResponse {
110
- return { ok: false, message: "" };
39
+ verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
111
40
  }
112
41
 
113
- export const SendOtpResponse: MessageFns<SendOtpResponse> = {
114
- encode(message: SendOtpResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
115
- if (message.ok !== false) {
116
- writer.uint32(8).bool(message.ok);
117
- }
118
- if (message.message !== "") {
119
- writer.uint32(18).string(message.message);
120
- }
121
- return writer;
122
- },
123
-
124
- decode(input: BinaryReader | Uint8Array, length?: number): SendOtpResponse {
125
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
126
- const end = length === undefined ? reader.len : reader.pos + length;
127
- const message = createBaseSendOtpResponse();
128
- while (reader.pos < end) {
129
- const tag = reader.uint32();
130
- switch (tag >>> 3) {
131
- case 1: {
132
- if (tag !== 8) {
133
- break;
134
- }
135
-
136
- message.ok = reader.bool();
137
- continue;
138
- }
139
- case 2: {
140
- if (tag !== 18) {
141
- break;
142
- }
143
-
144
- message.message = reader.string();
145
- continue;
146
- }
147
- }
148
- if ((tag & 7) === 4 || tag === 0) {
149
- break;
150
- }
151
- reader.skip(tag & 7);
152
- }
153
- return message;
154
- },
155
-
156
- fromJSON(object: any): SendOtpResponse {
157
- return {
158
- ok: isSet(object.ok) ? globalThis.Boolean(object.ok) : false,
159
- message: isSet(object.message) ? globalThis.String(object.message) : "",
160
- };
161
- },
162
-
163
- toJSON(message: SendOtpResponse): unknown {
164
- const obj: any = {};
165
- if (message.ok !== false) {
166
- obj.ok = message.ok;
167
- }
168
- if (message.message !== "") {
169
- obj.message = message.message;
170
- }
171
- return obj;
172
- },
173
-
174
- create<I extends Exact<DeepPartial<SendOtpResponse>, I>>(base?: I): SendOtpResponse {
175
- return SendOtpResponse.fromPartial(base ?? ({} as any));
176
- },
177
- fromPartial<I extends Exact<DeepPartial<SendOtpResponse>, I>>(object: I): SendOtpResponse {
178
- const message = createBaseSendOtpResponse();
179
- message.ok = object.ok ?? false;
180
- message.message = object.message ?? "";
181
- return message;
182
- },
183
- };
184
-
185
- function createBaseVerifyOtpRequest(): VerifyOtpRequest {
186
- return { identifier: "", type: "", code: "" };
187
- }
188
-
189
- export const VerifyOtpRequest: MessageFns<VerifyOtpRequest> = {
190
- encode(message: VerifyOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
191
- if (message.identifier !== "") {
192
- writer.uint32(10).string(message.identifier);
193
- }
194
- if (message.type !== "") {
195
- writer.uint32(18).string(message.type);
196
- }
197
- if (message.code !== "") {
198
- writer.uint32(26).string(message.code);
199
- }
200
- return writer;
201
- },
202
-
203
- decode(input: BinaryReader | Uint8Array, length?: number): VerifyOtpRequest {
204
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
205
- const end = length === undefined ? reader.len : reader.pos + length;
206
- const message = createBaseVerifyOtpRequest();
207
- while (reader.pos < end) {
208
- const tag = reader.uint32();
209
- switch (tag >>> 3) {
210
- case 1: {
211
- if (tag !== 10) {
212
- break;
213
- }
214
-
215
- message.identifier = reader.string();
216
- continue;
217
- }
218
- case 2: {
219
- if (tag !== 18) {
220
- break;
221
- }
222
-
223
- message.type = reader.string();
224
- continue;
225
- }
226
- case 3: {
227
- if (tag !== 26) {
228
- break;
229
- }
230
-
231
- message.code = reader.string();
232
- continue;
233
- }
234
- }
235
- if ((tag & 7) === 4 || tag === 0) {
236
- break;
237
- }
238
- reader.skip(tag & 7);
239
- }
240
- return message;
241
- },
242
-
243
- fromJSON(object: any): VerifyOtpRequest {
244
- return {
245
- identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
246
- type: isSet(object.type) ? globalThis.String(object.type) : "",
247
- code: isSet(object.code) ? globalThis.String(object.code) : "",
248
- };
249
- },
42
+ export interface AuthServiceController {
43
+ sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
250
44
 
251
- toJSON(message: VerifyOtpRequest): unknown {
252
- const obj: any = {};
253
- if (message.identifier !== "") {
254
- obj.identifier = message.identifier;
255
- }
256
- if (message.type !== "") {
257
- obj.type = message.type;
258
- }
259
- if (message.code !== "") {
260
- obj.code = message.code;
261
- }
262
- return obj;
263
- },
264
-
265
- create<I extends Exact<DeepPartial<VerifyOtpRequest>, I>>(base?: I): VerifyOtpRequest {
266
- return VerifyOtpRequest.fromPartial(base ?? ({} as any));
267
- },
268
- fromPartial<I extends Exact<DeepPartial<VerifyOtpRequest>, I>>(object: I): VerifyOtpRequest {
269
- const message = createBaseVerifyOtpRequest();
270
- message.identifier = object.identifier ?? "";
271
- message.type = object.type ?? "";
272
- message.code = object.code ?? "";
273
- return message;
274
- },
275
- };
276
-
277
- function createBaseVerifyOtpResponse(): VerifyOtpResponse {
278
- return { accessToken: "", refreshToken: "" };
45
+ verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
279
46
  }
280
47
 
281
- export const VerifyOtpResponse: MessageFns<VerifyOtpResponse> = {
282
- encode(message: VerifyOtpResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
283
- if (message.accessToken !== "") {
284
- writer.uint32(10).string(message.accessToken);
48
+ export function AuthServiceControllerMethods() {
49
+ return function (constructor: Function) {
50
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
51
+ for (const method of grpcMethods) {
52
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
53
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
285
54
  }
286
- if (message.refreshToken !== "") {
287
- writer.uint32(18).string(message.refreshToken);
55
+ const grpcStreamMethods: string[] = [];
56
+ for (const method of grpcStreamMethods) {
57
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
58
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
288
59
  }
289
- return writer;
290
- },
291
-
292
- decode(input: BinaryReader | Uint8Array, length?: number): VerifyOtpResponse {
293
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
294
- const end = length === undefined ? reader.len : reader.pos + length;
295
- const message = createBaseVerifyOtpResponse();
296
- while (reader.pos < end) {
297
- const tag = reader.uint32();
298
- switch (tag >>> 3) {
299
- case 1: {
300
- if (tag !== 10) {
301
- break;
302
- }
303
-
304
- message.accessToken = reader.string();
305
- continue;
306
- }
307
- case 2: {
308
- if (tag !== 18) {
309
- break;
310
- }
311
-
312
- message.refreshToken = reader.string();
313
- continue;
314
- }
315
- }
316
- if ((tag & 7) === 4 || tag === 0) {
317
- break;
318
- }
319
- reader.skip(tag & 7);
320
- }
321
- return message;
322
- },
323
-
324
- fromJSON(object: any): VerifyOtpResponse {
325
- return {
326
- accessToken: isSet(object.accessToken)
327
- ? globalThis.String(object.accessToken)
328
- : isSet(object.access_token)
329
- ? globalThis.String(object.access_token)
330
- : "",
331
- refreshToken: isSet(object.refreshToken)
332
- ? globalThis.String(object.refreshToken)
333
- : isSet(object.refresh_token)
334
- ? globalThis.String(object.refresh_token)
335
- : "",
336
- };
337
- },
338
-
339
- toJSON(message: VerifyOtpResponse): unknown {
340
- const obj: any = {};
341
- if (message.accessToken !== "") {
342
- obj.accessToken = message.accessToken;
343
- }
344
- if (message.refreshToken !== "") {
345
- obj.refreshToken = message.refreshToken;
346
- }
347
- return obj;
348
- },
349
-
350
- create<I extends Exact<DeepPartial<VerifyOtpResponse>, I>>(base?: I): VerifyOtpResponse {
351
- return VerifyOtpResponse.fromPartial(base ?? ({} as any));
352
- },
353
- fromPartial<I extends Exact<DeepPartial<VerifyOtpResponse>, I>>(object: I): VerifyOtpResponse {
354
- const message = createBaseVerifyOtpResponse();
355
- message.accessToken = object.accessToken ?? "";
356
- message.refreshToken = object.refreshToken ?? "";
357
- return message;
358
- },
359
- };
360
-
361
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
362
-
363
- export type DeepPartial<T> = T extends Builtin ? T
364
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
365
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
366
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
367
- : Partial<T>;
368
-
369
- type KeysOfUnion<T> = T extends T ? keyof T : never;
370
- export type Exact<P, I extends P> = P extends Builtin ? P
371
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
372
-
373
- function isSet(value: any): boolean {
374
- return value !== null && value !== undefined;
60
+ };
375
61
  }
376
62
 
377
- export interface MessageFns<T> {
378
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
379
- decode(input: BinaryReader | Uint8Array, length?: number): T;
380
- fromJSON(object: any): T;
381
- toJSON(message: T): unknown;
382
- create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
383
- fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
384
- }
63
+ export const AUTH_SERVICE_NAME = "AuthService";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@nemma-training/contracts",
3
- "version": "1.0.5",
4
- "description": "Protobuf contract definitions for Nemma microservices ecosystem",
3
+ "version": "1.0.6",
4
+ "description": "Protobuf contract definitions for Nemma microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "scripts": {
8
- "generate": "mkdir -p gen && protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestjs=true,outputServices=observables,addGrpcMetadata=true,addNestjsRestParameter=true",
8
+ "generate": "mkdir -p gen && protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
9
9
  "build": "tsc -p tsconfig.build.json"
10
10
  },
11
11
  "files": [