@meocinema/contracts 1.0.4 → 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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/proto/index.d.ts +1 -0
- package/dist/proto/index.js +17 -0
- package/dist/proto/paths.d.ts +3 -0
- package/dist/proto/paths.js +7 -0
- package/gen/auth.ts +187 -1
- package/package.json +11 -3
- package/proto/auth.proto +12 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./proto";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./proto"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./paths";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./paths"), exports);
|
package/gen/auth.ts
CHANGED
|
@@ -18,6 +18,17 @@ export interface SendOtpResponse {
|
|
|
18
18
|
ok: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export interface VerifyOtpRequest {
|
|
22
|
+
identifier: string;
|
|
23
|
+
type: string;
|
|
24
|
+
code: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface VerifyOtpResponse {
|
|
28
|
+
accessToken: string;
|
|
29
|
+
refreshToken: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
22
33
|
return { identifier: "", type: "" };
|
|
23
34
|
}
|
|
@@ -152,9 +163,177 @@ export const SendOtpResponse: MessageFns<SendOtpResponse> = {
|
|
|
152
163
|
},
|
|
153
164
|
};
|
|
154
165
|
|
|
166
|
+
function createBaseVerifyOtpRequest(): VerifyOtpRequest {
|
|
167
|
+
return { identifier: "", type: "", code: "" };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const VerifyOtpRequest: MessageFns<VerifyOtpRequest> = {
|
|
171
|
+
encode(message: VerifyOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
172
|
+
if (message.identifier !== "") {
|
|
173
|
+
writer.uint32(10).string(message.identifier);
|
|
174
|
+
}
|
|
175
|
+
if (message.type !== "") {
|
|
176
|
+
writer.uint32(18).string(message.type);
|
|
177
|
+
}
|
|
178
|
+
if (message.code !== "") {
|
|
179
|
+
writer.uint32(26).string(message.code);
|
|
180
|
+
}
|
|
181
|
+
return writer;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
decode(input: BinaryReader | Uint8Array, length?: number): VerifyOtpRequest {
|
|
185
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
186
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
187
|
+
const message = createBaseVerifyOtpRequest();
|
|
188
|
+
while (reader.pos < end) {
|
|
189
|
+
const tag = reader.uint32();
|
|
190
|
+
switch (tag >>> 3) {
|
|
191
|
+
case 1: {
|
|
192
|
+
if (tag !== 10) {
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
message.identifier = reader.string();
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
case 2: {
|
|
200
|
+
if (tag !== 18) {
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
message.type = reader.string();
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
case 3: {
|
|
208
|
+
if (tag !== 26) {
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
message.code = reader.string();
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
reader.skip(tag & 7);
|
|
220
|
+
}
|
|
221
|
+
return message;
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
fromJSON(object: any): VerifyOtpRequest {
|
|
225
|
+
return {
|
|
226
|
+
identifier: isSet(object.identifier) ? globalThis.String(object.identifier) : "",
|
|
227
|
+
type: isSet(object.type) ? globalThis.String(object.type) : "",
|
|
228
|
+
code: isSet(object.code) ? globalThis.String(object.code) : "",
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
toJSON(message: VerifyOtpRequest): unknown {
|
|
233
|
+
const obj: any = {};
|
|
234
|
+
if (message.identifier !== "") {
|
|
235
|
+
obj.identifier = message.identifier;
|
|
236
|
+
}
|
|
237
|
+
if (message.type !== "") {
|
|
238
|
+
obj.type = message.type;
|
|
239
|
+
}
|
|
240
|
+
if (message.code !== "") {
|
|
241
|
+
obj.code = message.code;
|
|
242
|
+
}
|
|
243
|
+
return obj;
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
create<I extends Exact<DeepPartial<VerifyOtpRequest>, I>>(base?: I): VerifyOtpRequest {
|
|
247
|
+
return VerifyOtpRequest.fromPartial(base ?? ({} as any));
|
|
248
|
+
},
|
|
249
|
+
fromPartial<I extends Exact<DeepPartial<VerifyOtpRequest>, I>>(object: I): VerifyOtpRequest {
|
|
250
|
+
const message = createBaseVerifyOtpRequest();
|
|
251
|
+
message.identifier = object.identifier ?? "";
|
|
252
|
+
message.type = object.type ?? "";
|
|
253
|
+
message.code = object.code ?? "";
|
|
254
|
+
return message;
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
function createBaseVerifyOtpResponse(): VerifyOtpResponse {
|
|
259
|
+
return { accessToken: "", refreshToken: "" };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export const VerifyOtpResponse: MessageFns<VerifyOtpResponse> = {
|
|
263
|
+
encode(message: VerifyOtpResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
264
|
+
if (message.accessToken !== "") {
|
|
265
|
+
writer.uint32(10).string(message.accessToken);
|
|
266
|
+
}
|
|
267
|
+
if (message.refreshToken !== "") {
|
|
268
|
+
writer.uint32(18).string(message.refreshToken);
|
|
269
|
+
}
|
|
270
|
+
return writer;
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
decode(input: BinaryReader | Uint8Array, length?: number): VerifyOtpResponse {
|
|
274
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
275
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
276
|
+
const message = createBaseVerifyOtpResponse();
|
|
277
|
+
while (reader.pos < end) {
|
|
278
|
+
const tag = reader.uint32();
|
|
279
|
+
switch (tag >>> 3) {
|
|
280
|
+
case 1: {
|
|
281
|
+
if (tag !== 10) {
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
message.accessToken = reader.string();
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
case 2: {
|
|
289
|
+
if (tag !== 18) {
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
message.refreshToken = reader.string();
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
reader.skip(tag & 7);
|
|
301
|
+
}
|
|
302
|
+
return message;
|
|
303
|
+
},
|
|
304
|
+
|
|
305
|
+
fromJSON(object: any): VerifyOtpResponse {
|
|
306
|
+
return {
|
|
307
|
+
accessToken: isSet(object.accessToken) ? globalThis.String(object.accessToken) : "",
|
|
308
|
+
refreshToken: isSet(object.refreshToken) ? globalThis.String(object.refreshToken) : "",
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
toJSON(message: VerifyOtpResponse): unknown {
|
|
313
|
+
const obj: any = {};
|
|
314
|
+
if (message.accessToken !== "") {
|
|
315
|
+
obj.accessToken = message.accessToken;
|
|
316
|
+
}
|
|
317
|
+
if (message.refreshToken !== "") {
|
|
318
|
+
obj.refreshToken = message.refreshToken;
|
|
319
|
+
}
|
|
320
|
+
return obj;
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
create<I extends Exact<DeepPartial<VerifyOtpResponse>, I>>(base?: I): VerifyOtpResponse {
|
|
324
|
+
return VerifyOtpResponse.fromPartial(base ?? ({} as any));
|
|
325
|
+
},
|
|
326
|
+
fromPartial<I extends Exact<DeepPartial<VerifyOtpResponse>, I>>(object: I): VerifyOtpResponse {
|
|
327
|
+
const message = createBaseVerifyOtpResponse();
|
|
328
|
+
message.accessToken = object.accessToken ?? "";
|
|
329
|
+
message.refreshToken = object.refreshToken ?? "";
|
|
330
|
+
return message;
|
|
331
|
+
},
|
|
332
|
+
};
|
|
333
|
+
|
|
155
334
|
export interface AuthService {
|
|
156
|
-
/** rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse); */
|
|
157
335
|
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse>;
|
|
336
|
+
VerifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse>;
|
|
158
337
|
}
|
|
159
338
|
|
|
160
339
|
export const AuthServiceServiceName = "auth.v1.AuthService";
|
|
@@ -165,12 +344,19 @@ export class AuthServiceClientImpl implements AuthService {
|
|
|
165
344
|
this.service = opts?.service || AuthServiceServiceName;
|
|
166
345
|
this.rpc = rpc;
|
|
167
346
|
this.SendOtp = this.SendOtp.bind(this);
|
|
347
|
+
this.VerifyOtp = this.VerifyOtp.bind(this);
|
|
168
348
|
}
|
|
169
349
|
SendOtp(request: SendOtpRequest): Promise<SendOtpResponse> {
|
|
170
350
|
const data = SendOtpRequest.encode(request).finish();
|
|
171
351
|
const promise = this.rpc.request(this.service, "SendOtp", data);
|
|
172
352
|
return promise.then((data) => SendOtpResponse.decode(new BinaryReader(data)));
|
|
173
353
|
}
|
|
354
|
+
|
|
355
|
+
VerifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> {
|
|
356
|
+
const data = VerifyOtpRequest.encode(request).finish();
|
|
357
|
+
const promise = this.rpc.request(this.service, "VerifyOtp", data);
|
|
358
|
+
return promise.then((data) => VerifyOtpResponse.decode(new BinaryReader(data)));
|
|
359
|
+
}
|
|
174
360
|
}
|
|
175
361
|
|
|
176
362
|
interface Rpc {
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meocinema/contracts",
|
|
3
3
|
"description": "Protobuf contracts for MeoCinema services",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"author": "meolex",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
6
8
|
"dependencies": {
|
|
7
9
|
"@bufbuild/protobuf": "^2.10.2",
|
|
8
10
|
"ts-proto": "^2.10.1"
|
|
9
11
|
},
|
|
10
12
|
"scripts": {
|
|
11
|
-
"generate": "npx protoc -I ./proto/ ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJS=true,package=omit"
|
|
13
|
+
"generate": "npx protoc -I ./proto/ ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJS=true,package=omit",
|
|
14
|
+
"build": "tsc -p tsconfig.build.json"
|
|
12
15
|
},
|
|
13
16
|
"files": [
|
|
14
17
|
"proto",
|
|
15
|
-
"gen"
|
|
18
|
+
"gen",
|
|
19
|
+
"dist"
|
|
16
20
|
],
|
|
17
21
|
"publishConfig": {
|
|
18
22
|
"access": "public"
|
|
@@ -20,5 +24,9 @@
|
|
|
20
24
|
"repository": {
|
|
21
25
|
"type": "git",
|
|
22
26
|
"url": "https://github.com/meocinema/contracts"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^25.0.3",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
23
31
|
}
|
|
24
32
|
}
|
package/proto/auth.proto
CHANGED
|
@@ -4,7 +4,7 @@ package auth.v1;
|
|
|
4
4
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
7
|
-
|
|
7
|
+
rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
message SendOtpRequest {
|
|
@@ -14,4 +14,15 @@ message SendOtpRequest {
|
|
|
14
14
|
|
|
15
15
|
message SendOtpResponse {
|
|
16
16
|
bool ok = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message VerifyOtpRequest {
|
|
20
|
+
string identifier = 1;
|
|
21
|
+
string type = 2;
|
|
22
|
+
string code = 3;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message VerifyOtpResponse {
|
|
26
|
+
string access_token = 1;
|
|
27
|
+
string refresh_token = 2;
|
|
17
28
|
}
|