@sorokchat-messenger/microservices 1.0.1

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 (54) hide show
  1. package/LICENSE +21 -0
  2. package/dist/client/client.factory.d.ts +11 -0
  3. package/dist/client/client.factory.d.ts.map +1 -0
  4. package/dist/client/client.factory.js +25 -0
  5. package/dist/client/client.factory.js.map +1 -0
  6. package/dist/client/index.d.ts +2 -0
  7. package/dist/client/index.d.ts.map +1 -0
  8. package/dist/client/index.js +2 -0
  9. package/dist/client/index.js.map +1 -0
  10. package/dist/common/index.d.ts +3 -0
  11. package/dist/common/index.d.ts.map +1 -0
  12. package/dist/common/index.js +3 -0
  13. package/dist/common/index.js.map +1 -0
  14. package/dist/common/loader.option.d.ts +3 -0
  15. package/dist/common/loader.option.d.ts.map +1 -0
  16. package/dist/common/loader.option.js +7 -0
  17. package/dist/common/loader.option.js.map +1 -0
  18. package/dist/common/path.d.ts +2 -0
  19. package/dist/common/path.d.ts.map +1 -0
  20. package/dist/common/path.js +4 -0
  21. package/dist/common/path.js.map +1 -0
  22. package/dist/common/services/authorization.service.d.ts +11 -0
  23. package/dist/common/services/authorization.service.d.ts.map +1 -0
  24. package/dist/common/services/authorization.service.js +26 -0
  25. package/dist/common/services/authorization.service.js.map +1 -0
  26. package/dist/common/services/index.d.ts +2 -0
  27. package/dist/common/services/index.d.ts.map +1 -0
  28. package/dist/common/services/index.js +2 -0
  29. package/dist/common/services/index.js.map +1 -0
  30. package/dist/generated/authorization.d.ts +57 -0
  31. package/dist/generated/authorization.d.ts.map +1 -0
  32. package/dist/generated/authorization.js +35 -0
  33. package/dist/generated/authorization.js.map +1 -0
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +6 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/server/index.d.ts +2 -0
  39. package/dist/server/index.d.ts.map +1 -0
  40. package/dist/server/index.js +2 -0
  41. package/dist/server/index.js.map +1 -0
  42. package/dist/server/server.factory.d.ts +5 -0
  43. package/dist/server/server.factory.d.ts.map +1 -0
  44. package/dist/server/server.factory.js +17 -0
  45. package/dist/server/server.factory.js.map +1 -0
  46. package/dist/types/index.d.ts +2 -0
  47. package/dist/types/index.d.ts.map +1 -0
  48. package/dist/types/index.js +2 -0
  49. package/dist/types/index.js.map +1 -0
  50. package/dist/types/service.type.d.ts +15 -0
  51. package/dist/types/service.type.d.ts.map +1 -0
  52. package/dist/types/service.type.js +2 -0
  53. package/dist/types/service.type.js.map +1 -0
  54. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present Sorokovsky Andrey <Sorokovsky0809@gmail.com>
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.
@@ -0,0 +1,11 @@
1
+ import { ClientsModule } from "@nestjs/microservices";
2
+ import type { Service } from "../types/index.js";
3
+ import type { DynamicModule, ForwardReference, Type } from "@nestjs/common";
4
+ type Options = {
5
+ inject?: any[];
6
+ imports?: (Type<any> | DynamicModule | Promise<DynamicModule> | ForwardReference<any>)[];
7
+ urlFactory: (...args: any[]) => string;
8
+ };
9
+ export declare function createClientModule(services: (Omit<Service, "url"> & Options)[]): ClientsModule;
10
+ export {};
11
+ //# sourceMappingURL=client.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.factory.d.ts","sourceRoot":"","sources":["../../src/client/client.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAG5E,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,CACR,IAAI,CAAC,GAAG,CAAC,GAAG,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAC3E,EAAE,CAAC;IACJ,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC;CACxC,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,EAAE,GAC3C,aAAa,CA8Bf"}
@@ -0,0 +1,25 @@
1
+ import { ClientsModule, Transport, } from "@nestjs/microservices";
2
+ import { LOADER_OPTIONS } from "../common/index.js";
3
+ export function createClientModule(services) {
4
+ return ClientsModule.registerAsync({
5
+ isGlobal: true,
6
+ clients: services.map(({ name, package: packageName, path, urlFactory, imports, inject, }) => ({
7
+ name,
8
+ imports: imports || [],
9
+ inject: inject || [],
10
+ useFactory(...args) {
11
+ const url = urlFactory(...args);
12
+ return {
13
+ transport: Transport.GRPC,
14
+ options: {
15
+ package: packageName,
16
+ loader: LOADER_OPTIONS,
17
+ url,
18
+ protoPath: path,
19
+ },
20
+ };
21
+ },
22
+ })),
23
+ });
24
+ }
25
+ //# sourceMappingURL=client.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.factory.js","sourceRoot":"","sources":["../../src/client/client.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,SAAS,GAEV,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUpD,MAAM,UAAU,kBAAkB,CAChC,QAA4C;IAE5C,OAAO,aAAa,CAAC,aAAa,CAAC;QACjC,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,QAAQ,CAAC,GAAG,CACnB,CAAC,EACC,IAAI,EACJ,OAAO,EAAE,WAAW,EACpB,IAAI,EACJ,UAAU,EACV,OAAO,EACP,MAAM,GACP,EAA+B,EAAE,CAAC,CAAC;YAClC,IAAI;YACJ,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,UAAU,CAAC,GAAG,IAAI;gBAChB,MAAM,GAAG,GAAW,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;gBACxC,OAAO;oBACL,SAAS,EAAE,SAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,WAAW;wBACpB,MAAM,EAAE,cAAc;wBACtB,GAAG;wBACH,SAAS,EAAE,IAAI;qBAChB;iBACF,CAAC;YACJ,CAAC;SACF,CAAC,CACH;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./client.factory.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./client.factory.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./loader.option.js";
2
+ export * from "./services/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./loader.option.js";
2
+ export * from "./services/index.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { GrpcOptions } from "@nestjs/microservices";
2
+ export declare const LOADER_OPTIONS: NonNullable<GrpcOptions["options"]["loader"]>;
3
+ //# sourceMappingURL=loader.option.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.option.d.ts","sourceRoot":"","sources":["../../src/common/loader.option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAKxE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export const LOADER_OPTIONS = {
2
+ keepCase: false,
3
+ longs: String,
4
+ enums: String,
5
+ oneofs: true,
6
+ };
7
+ //# sourceMappingURL=loader.option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.option.js","sourceRoot":"","sources":["../../src/common/loader.option.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAkD;IAC3E,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,IAAI;CACb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PROTO_PATH: string;
2
+ //# sourceMappingURL=path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/common/path.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { dirname, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ export const PROTO_PATH = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "proto");
4
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/common/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAW,OAAO,CACvC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EACvC,IAAI,EACJ,IAAI,EACJ,OAAO,CACR,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Service } from "../../types/index.js";
2
+ export declare const AUTHORIZATION_SERVICE: {
3
+ readonly NAME: string;
4
+ readonly REGISTER: "Register";
5
+ readonly LOGIN: "Login";
6
+ readonly REFRESH_TOKENS: "RefreshTokens";
7
+ readonly PROFILE: "Profile";
8
+ };
9
+ export declare const AUTHORIZATION_CLIENT: Omit<Service, "url">;
10
+ export declare function createAuthorizationService(url: string): Service;
11
+ //# sourceMappingURL=authorization.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.service.d.ts","sourceRoot":"","sources":["../../../src/common/services/authorization.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAOpD,eAAO,MAAM,qBAAqB;aAChC,IAAI;aACJ,QAAQ,EAAE,UAAU;aACpB,KAAK,EAAE,OAAO;aACd,cAAc,EAAE,eAAe;aAC/B,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,eAAO,MAAM,oBAAoB,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAIrD,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO/D"}
@@ -0,0 +1,26 @@
1
+ import { join } from "path";
2
+ import { PROTO_PATH } from "../path.js";
3
+ const name = "AuthorizationService";
4
+ const packageName = "authorization.v1";
5
+ const path = join(PROTO_PATH, "authorization.proto");
6
+ export const AUTHORIZATION_SERVICE = {
7
+ NAME: name,
8
+ REGISTER: "Register",
9
+ LOGIN: "Login",
10
+ REFRESH_TOKENS: "RefreshTokens",
11
+ PROFILE: "Profile",
12
+ };
13
+ export const AUTHORIZATION_CLIENT = {
14
+ name,
15
+ package: packageName,
16
+ path,
17
+ };
18
+ export function createAuthorizationService(url) {
19
+ return {
20
+ name,
21
+ package: packageName,
22
+ path,
23
+ url,
24
+ };
25
+ }
26
+ //# sourceMappingURL=authorization.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.service.js","sourceRoot":"","sources":["../../../src/common/services/authorization.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,IAAI,GAAW,sBAAsB,CAAC;AAC5C,MAAM,WAAW,GAAW,kBAAkB,CAAC;AAC/C,MAAM,IAAI,GAAW,IAAI,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,eAAe;IAC/B,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAyB;IACxD,IAAI;IACJ,OAAO,EAAE,WAAW;IACpB,IAAI;CACL,CAAC;AAEF,MAAM,UAAU,0BAA0B,CAAC,GAAW;IACpD,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,WAAW;QACpB,IAAI;QACJ,GAAG;KACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./authorization.service.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./authorization.service.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "authorization.v1";
3
+ export declare enum Role {
4
+ USER = "USER",
5
+ PRO = "PRO",
6
+ ADMIN = "ADMIN",
7
+ UNRECOGNIZED = "UNRECOGNIZED"
8
+ }
9
+ export interface RegisterRequest {
10
+ login: string;
11
+ password: string;
12
+ displayName?: string | undefined;
13
+ }
14
+ export interface RegisterResponse {
15
+ accessToken: string;
16
+ refreshToken: string;
17
+ }
18
+ export interface LoginRequest {
19
+ login: string;
20
+ password: string;
21
+ }
22
+ export interface LoginResponse {
23
+ accessToken: string;
24
+ refreshToken: string;
25
+ }
26
+ export interface RefreshTokensRequest {
27
+ refreshToken: string;
28
+ }
29
+ export interface RefreshTokensResponse {
30
+ accessToken: string;
31
+ refreshToken: string;
32
+ }
33
+ export interface ProfileRequest {
34
+ accessToken: string;
35
+ }
36
+ export interface ProfileResponse {
37
+ login: string;
38
+ password: string;
39
+ displayName?: string | undefined;
40
+ role: Role;
41
+ }
42
+ export declare const AUTHORIZATION_V1_PACKAGE_NAME = "authorization.v1";
43
+ export interface AuthorizationServiceClient {
44
+ register(request: RegisterRequest): Observable<RegisterResponse>;
45
+ login(request: LoginRequest): Observable<LoginResponse>;
46
+ refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
47
+ profile(request: ProfileRequest): Observable<ProfileResponse>;
48
+ }
49
+ export interface AuthorizationServiceController {
50
+ register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
51
+ login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
52
+ refreshTokens(request: RefreshTokensRequest): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
53
+ profile(request: ProfileRequest): Promise<ProfileResponse> | Observable<ProfileResponse> | ProfileResponse;
54
+ }
55
+ export declare function AuthorizationServiceControllerMethods(): (constructor: Function) => void;
56
+ export declare const AUTHORIZATION_SERVICE_NAME = "AuthorizationService";
57
+ //# sourceMappingURL=authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src/generated/authorization.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAElD,oBAAY,IAAI;IACd,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,YAAY,iBAAiB;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAEhE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAEjE,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAExD,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAEhF,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC;IAEhH,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;IAEjG,aAAa,CACX,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,GAAG,UAAU,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,CAAC;IAE9F,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;CAC5G;AAED,wBAAgB,qCAAqC,kBACrB,QAAQ,UAcvC;AAED,eAAO,MAAM,0BAA0B,yBAAyB,CAAC"}
@@ -0,0 +1,35 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.3
4
+ // protoc v5.28.3
5
+ // source: authorization.proto
6
+ /* eslint-disable */
7
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
8
+ import { Observable } from "rxjs";
9
+ export const protobufPackage = "authorization.v1";
10
+ export var Role;
11
+ (function (Role) {
12
+ Role["USER"] = "USER";
13
+ Role["PRO"] = "PRO";
14
+ Role["ADMIN"] = "ADMIN";
15
+ Role["UNRECOGNIZED"] = "UNRECOGNIZED";
16
+ })(Role || (Role = {}));
17
+ export const AUTHORIZATION_V1_PACKAGE_NAME = "authorization.v1";
18
+ export function AuthorizationServiceControllerMethods() {
19
+ return function (constructor) {
20
+ const grpcMethods = ["register", "login", "refreshTokens", "profile"];
21
+ for (const method of grpcMethods) {
22
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
23
+ GrpcMethod("AuthorizationService", method)(constructor.prototype[method], method, descriptor);
24
+ Object.defineProperty(constructor.prototype, method, descriptor);
25
+ }
26
+ const grpcStreamMethods = [];
27
+ for (const method of grpcStreamMethods) {
28
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
29
+ GrpcStreamMethod("AuthorizationService", method)(constructor.prototype[method], method, descriptor);
30
+ Object.defineProperty(constructor.prototype, method, descriptor);
31
+ }
32
+ };
33
+ }
34
+ export const AUTHORIZATION_SERVICE_NAME = "AuthorizationService";
35
+ //# sourceMappingURL=authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src/generated/authorization.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,iCAAiC;AACjC,iCAAiC;AACjC,8BAA8B;AAE9B,oBAAoB;AACpB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD,MAAM,CAAN,IAAY,IAKX;AALD,WAAY,IAAI;IACd,qBAAa,CAAA;IACb,mBAAW,CAAA;IACX,uBAAe,CAAA;IACf,qCAA6B,CAAA;AAC/B,CAAC,EALW,IAAI,KAAJ,IAAI,QAKf;AA2CD,MAAM,CAAC,MAAM,6BAA6B,GAAG,kBAAkB,CAAC;AAwBhE,MAAM,UAAU,qCAAqC;IACnD,OAAO,UAAU,WAAqB;QACpC,MAAM,WAAW,GAAa,CAAC,UAAU,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;QAChF,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,UAAU,GAAQ,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACxF,UAAU,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YAC9F,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACnE,CAAC;QACD,MAAM,iBAAiB,GAAa,EAAE,CAAC;QACvC,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE,CAAC;YACvC,MAAM,UAAU,GAAQ,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACxF,gBAAgB,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;YACpG,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./types/index.js";
2
+ export * from "./common/index.js";
3
+ export * from "./server/index.js";
4
+ export * from "./client/index.js";
5
+ export * from "./generated/authorization.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./types/index.js";
2
+ export * from "./common/index.js";
3
+ export * from "./server/index.js";
4
+ export * from "./client/index.js";
5
+ export * from "./generated/authorization.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./server.factory.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./server.factory.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type INestMicroservice } from "@nestjs/common";
2
+ import { type IEntryNestModule } from "@nestjs/core";
3
+ import type { Service } from "../types/index.js";
4
+ export declare function createServer(entryModule: IEntryNestModule, service: Service): Promise<INestMicroservice>;
5
+ //# sourceMappingURL=server.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.factory.d.ts","sourceRoot":"","sources":["../../src/server/server.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD,wBAAsB,YAAY,CAChC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,iBAAiB,CAAC,CAc5B"}
@@ -0,0 +1,17 @@
1
+ import {} from "@nestjs/common";
2
+ import { NestFactory } from "@nestjs/core";
3
+ import { Transport } from "@nestjs/microservices";
4
+ import { LOADER_OPTIONS } from "../common/index.js";
5
+ export async function createServer(entryModule, service) {
6
+ const application = await NestFactory.createMicroservice(entryModule, {
7
+ transport: Transport.GRPC,
8
+ options: {
9
+ package: service.package,
10
+ protoPath: service.path,
11
+ loader: LOADER_OPTIONS,
12
+ url: service.url,
13
+ },
14
+ });
15
+ return application;
16
+ }
17
+ //# sourceMappingURL=server.factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.factory.js","sourceRoot":"","sources":["../../src/server/server.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,SAAS,EAAoB,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAA6B,EAC7B,OAAgB;IAEhB,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,kBAAkB,CACtD,WAAW,EACX;QACE,SAAS,EAAE,SAAS,CAAC,IAAI;QACzB,OAAO,EAAE;YACP,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,MAAM,EAAE,cAAc;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB;KACF,CACF,CAAC;IACF,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./service.type.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./service.type.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ type BasicService = {
2
+ name: string;
3
+ url: string;
4
+ };
5
+ type StringService = {
6
+ path: string;
7
+ package: string;
8
+ };
9
+ type ArrayService = {
10
+ path: string[];
11
+ package: string[];
12
+ };
13
+ export type Service = BasicService & (StringService | ArrayService);
14
+ export {};
15
+ //# sourceMappingURL=service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.type.d.ts","sourceRoot":"","sources":["../../src/types/service.type.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,YAAY,GAAG,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=service.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.type.js","sourceRoot":"","sources":["../../src/types/service.type.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@sorokchat-messenger/microservices",
3
+ "version": "1.0.1",
4
+ "description": "Microservices contracts for sorokchat backend",
5
+ "keywords": [
6
+ "sorokchat",
7
+ "backend",
8
+ "microservices"
9
+ ],
10
+ "homepage": "https://github.com/sorokchat-messenger/microservices#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/sorokchat-messenger/microservices/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+ssh://git@github.com/sorokchat-messenger/microservices.git"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "license": "MIT",
22
+ "author": "Sorokovsky Andrey <Sorokovsky0809@gmail.com>",
23
+ "type": "module",
24
+ "main": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "scripts": {
27
+ "build": "npm run proto:generate && tsc",
28
+ "proto:generate": "rm -rf src/generated && mkdir -p src/generated && protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated --ts_proto_opt=nestJs=true,snakeToCamel=true,forceLong=string,stringEnums=true,oneof=unions -I ./proto ./proto/*.proto"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "import": "./dist/index.js",
33
+ "types": "./dist/index.d.ts"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "generated"
39
+ ],
40
+ "devDependencies": {
41
+ "@sorokchat-messenger/core": "^1.0.0",
42
+ "@types/node": "^22.20.2",
43
+ "prettier": "^3.9.6",
44
+ "ts-proto": "^2.12.3",
45
+ "typescript": "^7.0.2"
46
+ },
47
+ "peerDependencies": {
48
+ "@nestjs/common": "^12.0.1",
49
+ "@nestjs/core": "^12.0.1",
50
+ "@nestjs/microservices": "^12.0.1"
51
+ }
52
+ }