@conduitplatform/grpc-sdk 0.16.0-alpha.8 → 0.16.0-rc.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.
Files changed (123) hide show
  1. package/dist/classes/ConduitAuthorizedResource.js +5 -6
  2. package/dist/classes/ConduitAuthorizedResource.js.map +1 -1
  3. package/dist/classes/ConduitModule.js +59 -162
  4. package/dist/classes/ConduitModule.js.map +1 -1
  5. package/dist/classes/ConduitSchema.js +3 -4
  6. package/dist/classes/ConduitSchema.js.map +1 -1
  7. package/dist/classes/Error.js +17 -40
  8. package/dist/classes/Error.js.map +1 -1
  9. package/dist/classes/HealthCheck.js +28 -96
  10. package/dist/classes/HealthCheck.js.map +1 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +300 -462
  13. package/dist/index.js.map +1 -1
  14. package/dist/interceptors/grpcSignedToken.d.ts +1 -1
  15. package/dist/interceptors/grpcSignedToken.js +7 -79
  16. package/dist/interceptors/grpcSignedToken.js.map +1 -1
  17. package/dist/interceptors/moduleName.d.ts +1 -1
  18. package/dist/interceptors/moduleName.js +7 -79
  19. package/dist/interceptors/moduleName.js.map +1 -1
  20. package/dist/interfaces/ConduitRouteReturn.d.ts +3 -3
  21. package/dist/interfaces/ConduitRouteReturn.js +9 -18
  22. package/dist/interfaces/ConduitRouteReturn.js.map +1 -1
  23. package/dist/interfaces/GrpcCallback.d.ts +1 -1
  24. package/dist/interfaces/Indexable.d.ts +7 -7
  25. package/dist/interfaces/Model.d.ts +66 -13
  26. package/dist/interfaces/Model.js.map +1 -1
  27. package/dist/interfaces/Params.d.ts +3 -3
  28. package/dist/interfaces/RawQuery.d.ts +2 -2
  29. package/dist/interfaces/Route.d.ts +30 -19
  30. package/dist/interfaces/Route.js +1 -10
  31. package/dist/interfaces/Route.js.map +1 -1
  32. package/dist/interfaces/Socket.d.ts +1 -1
  33. package/dist/interfaces/UntypedArray.d.ts +1 -1
  34. package/dist/interfaces/types.d.ts +6 -6
  35. package/dist/module.proto +58 -0
  36. package/dist/modules/admin/index.d.ts +3 -3
  37. package/dist/modules/admin/index.js +18 -37
  38. package/dist/modules/admin/index.js.map +1 -1
  39. package/dist/modules/authentication/index.d.ts +6 -2
  40. package/dist/modules/authentication/index.js +33 -40
  41. package/dist/modules/authentication/index.js.map +1 -1
  42. package/dist/modules/authorization/index.d.ts +4 -1
  43. package/dist/modules/authorization/index.js +38 -47
  44. package/dist/modules/authorization/index.js.map +1 -1
  45. package/dist/modules/chat/index.js +16 -34
  46. package/dist/modules/chat/index.js.map +1 -1
  47. package/dist/modules/config/index.d.ts +10 -1
  48. package/dist/modules/config/index.js +82 -177
  49. package/dist/modules/config/index.js.map +1 -1
  50. package/dist/modules/core/index.js +8 -26
  51. package/dist/modules/core/index.js.map +1 -1
  52. package/dist/modules/database/index.d.ts +19 -10
  53. package/dist/modules/database/index.js +184 -125
  54. package/dist/modules/database/index.js.map +1 -1
  55. package/dist/modules/email/index.js +15 -33
  56. package/dist/modules/email/index.js.map +1 -1
  57. package/dist/modules/pushNotifications/index.d.ts +4 -4
  58. package/dist/modules/pushNotifications/index.js +38 -60
  59. package/dist/modules/pushNotifications/index.js.map +1 -1
  60. package/dist/modules/router/index.d.ts +3 -3
  61. package/dist/modules/router/index.js +20 -39
  62. package/dist/modules/router/index.js.map +1 -1
  63. package/dist/modules/sms/index.js +17 -35
  64. package/dist/modules/sms/index.js.map +1 -1
  65. package/dist/modules/storage/index.d.ts +7 -7
  66. package/dist/modules/storage/index.js +64 -55
  67. package/dist/modules/storage/index.js.map +1 -1
  68. package/dist/protoUtils/authentication.d.ts +200 -4
  69. package/dist/protoUtils/authentication.js +789 -194
  70. package/dist/protoUtils/authentication.js.map +1 -1
  71. package/dist/protoUtils/authorization.d.ts +155 -5
  72. package/dist/protoUtils/authorization.js +860 -447
  73. package/dist/protoUtils/authorization.js.map +1 -1
  74. package/dist/protoUtils/chat.d.ts +18 -7
  75. package/dist/protoUtils/chat.js +210 -227
  76. package/dist/protoUtils/chat.js.map +1 -1
  77. package/dist/protoUtils/core.d.ts +86 -49
  78. package/dist/protoUtils/core.js +1057 -852
  79. package/dist/protoUtils/core.js.map +1 -1
  80. package/dist/protoUtils/database.d.ts +262 -16
  81. package/dist/protoUtils/database.js +1489 -832
  82. package/dist/protoUtils/database.js.map +1 -1
  83. package/dist/protoUtils/email.d.ts +13 -4
  84. package/dist/protoUtils/email.js +242 -253
  85. package/dist/protoUtils/email.js.map +1 -1
  86. package/dist/protoUtils/google/protobuf/empty.d.ts +6 -3
  87. package/dist/protoUtils/google/protobuf/empty.js +21 -38
  88. package/dist/protoUtils/google/protobuf/empty.js.map +1 -1
  89. package/dist/protoUtils/grpc_health_check.d.ts +10 -4
  90. package/dist/protoUtils/grpc_health_check.js +72 -83
  91. package/dist/protoUtils/grpc_health_check.js.map +1 -1
  92. package/dist/protoUtils/module.d.ts +202 -4
  93. package/dist/protoUtils/module.js +810 -72
  94. package/dist/protoUtils/module.js.map +1 -1
  95. package/dist/protoUtils/push-notifications.d.ts +26 -6
  96. package/dist/protoUtils/push-notifications.js +381 -317
  97. package/dist/protoUtils/push-notifications.js.map +1 -1
  98. package/dist/protoUtils/router.d.ts +50 -48
  99. package/dist/protoUtils/router.js +529 -498
  100. package/dist/protoUtils/router.js.map +1 -1
  101. package/dist/protoUtils/sms.d.ts +16 -4
  102. package/dist/protoUtils/sms.js +199 -175
  103. package/dist/protoUtils/sms.js.map +1 -1
  104. package/dist/protoUtils/storage.d.ts +39 -4
  105. package/dist/protoUtils/storage.js +641 -345
  106. package/dist/protoUtils/storage.js.map +1 -1
  107. package/dist/types/db.d.ts +13 -11
  108. package/dist/types/index.d.ts +2 -2
  109. package/dist/types/index.js +6 -24
  110. package/dist/types/index.js.map +1 -1
  111. package/dist/utilities/EventBus.d.ts +3 -1
  112. package/dist/utilities/EventBus.js +38 -17
  113. package/dist/utilities/EventBus.js.map +1 -1
  114. package/dist/utilities/RedisManager.js +11 -21
  115. package/dist/utilities/RedisManager.js.map +1 -1
  116. package/dist/utilities/StateManager.d.ts +9 -0
  117. package/dist/utilities/StateManager.js +58 -15
  118. package/dist/utilities/StateManager.js.map +1 -1
  119. package/dist/utilities/env.js +4 -4
  120. package/dist/utilities/env.js.map +1 -1
  121. package/dist/utilities/sleep.js +1 -1
  122. package/dist/utilities/sleep.js.map +1 -1
  123. package/package.json +26 -19
@@ -1,6 +1,6 @@
1
1
  import { Context, Cookies, Indexable, Params } from './Indexable';
2
2
  import { GrpcRequest } from '../types';
3
- export declare type ParsedRouterRequest = GrpcRequest<{
3
+ export type ParsedRouterRequest = GrpcRequest<{
4
4
  params: Params;
5
5
  urlParams: Params;
6
6
  queryParams: Params;
@@ -12,26 +12,26 @@ export declare type ParsedRouterRequest = GrpcRequest<{
12
12
  context: Context;
13
13
  cookies: Cookies;
14
14
  }>;
15
- export declare type UnparsedRouterResponse = {
15
+ export type UnparsedRouterResponse = {
16
16
  result?: Indexable;
17
17
  redirect?: string;
18
18
  setCookies: Cookies[];
19
19
  removeCookies: Cookies[];
20
20
  } | Indexable | string;
21
- export declare type ParsedSocketRequest = GrpcRequest<{
21
+ export type ParsedSocketRequest = GrpcRequest<{
22
22
  event: string;
23
23
  socketId: string;
24
24
  params: string[];
25
25
  context: Context;
26
26
  cookies: Cookies;
27
27
  }>;
28
- declare type EventResponse = {
28
+ type EventResponse = {
29
29
  event: string;
30
30
  data: Indexable;
31
31
  receivers?: string[];
32
32
  };
33
- export declare type UnparsedSocketResponse = EventResponse | JoinRoomResponse;
34
- declare type JoinRoomResponse = {
33
+ export type UnparsedSocketResponse = EventResponse | JoinRoomResponse;
34
+ type JoinRoomResponse = {
35
35
  rooms: string[];
36
36
  };
37
37
  export {};
package/dist/module.proto CHANGED
@@ -12,3 +12,61 @@ message SetConfigResponse {
12
12
  service ConduitModule {
13
13
  rpc SetConfig(SetConfigRequest) returns (SetConfigResponse);
14
14
  }
15
+
16
+ service ClientRouter {
17
+ rpc Route(Request) returns (Response);
18
+ rpc SocketRoute(SocketRequest) returns (SocketResponse);
19
+ }
20
+ service AdminRouter {
21
+ rpc Route(Request) returns (Response);
22
+ rpc SocketRoute(SocketRequest) returns (SocketResponse);
23
+ }
24
+
25
+ message Request {
26
+ string params = 1;
27
+ string path = 2;
28
+ string headers = 3;
29
+ string context = 4;
30
+ string cookies = 5;
31
+ string bodyParams = 6;
32
+ string urlParams = 7;
33
+ string queryParams = 8;
34
+ string functionName = 9;
35
+ }
36
+
37
+ message Response {
38
+ string result = 1;
39
+ string redirect = 2;
40
+ repeated Cookie setCookies = 3;
41
+ repeated Cookie removeCookies = 4;
42
+ }
43
+ message Cookie {
44
+ string name = 1;
45
+ optional string value = 2;
46
+ CookieOptions options = 3;
47
+ }
48
+
49
+ message CookieOptions {
50
+ bool httpOnly = 1;
51
+ bool secure = 2;
52
+ bool signed = 3;
53
+ int32 maxAge = 4;
54
+ string path = 5;
55
+ string domain = 6;
56
+ string sameSite = 7;
57
+
58
+ }
59
+ message SocketRequest {
60
+ string event = 1;
61
+ string socketId = 2;
62
+ string params = 3;
63
+ string context = 4;
64
+ string functionName = 5;
65
+ }
66
+
67
+ message SocketResponse {
68
+ string event = 1;
69
+ string data = 2;
70
+ repeated string receivers = 3;
71
+ repeated string rooms = 4;
72
+ }
@@ -1,9 +1,9 @@
1
1
  import { ConduitModule } from '../../classes';
2
2
  import { AdminDefinition, RegisterAdminRouteRequest_PathDefinition } from '../../protoUtils';
3
- import { ConduitProxyObject, ConduitRouteObject, SocketProtoDescription } from '../../interfaces';
3
+ import { ConduitRouteActions } from '../../interfaces';
4
4
  export declare class Admin extends ConduitModule<typeof AdminDefinition> {
5
5
  readonly moduleName: string;
6
6
  constructor(moduleName: string, url: string, grpcToken?: string);
7
- generateProtoFile(moduleName: string, routes: (ConduitRouteObject | SocketProtoDescription | ConduitProxyObject)[]): Promise<import("../../protoUtils").GenerateAdminProtoResponse>;
8
- register(paths: RegisterAdminRouteRequest_PathDefinition[], protoFile: string, serverUrl?: string): Promise<any>;
7
+ register(paths: RegisterAdminRouteRequest_PathDefinition[], serverUrl?: string): Promise<any>;
8
+ patchRouteMiddlewares(path: string, action: ConduitRouteActions, middlewares: string[]): Promise<import("../../protoUtils/google/protobuf/empty").Empty>;
9
9
  }
@@ -1,47 +1,28 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Admin = void 0;
19
- var classes_1 = require("../../classes");
20
- var protoUtils_1 = require("../../protoUtils");
21
- var Admin = /** @class */ (function (_super) {
22
- __extends(Admin, _super);
23
- function Admin(moduleName, url, grpcToken) {
24
- var _this = _super.call(this, moduleName, 'admin', url, grpcToken) || this;
25
- _this.moduleName = moduleName;
26
- _this.initializeClient(protoUtils_1.AdminDefinition);
27
- return _this;
4
+ const classes_1 = require("../../classes");
5
+ const protoUtils_1 = require("../../protoUtils");
6
+ class Admin extends classes_1.ConduitModule {
7
+ constructor(moduleName, url, grpcToken) {
8
+ super(moduleName, 'admin', url, grpcToken);
9
+ this.moduleName = moduleName;
10
+ this.initializeClient(protoUtils_1.AdminDefinition);
28
11
  }
29
- Admin.prototype.generateProtoFile = function (moduleName, routes) {
30
- var request = {
31
- moduleName: moduleName,
32
- routes: routes.map(function (r) { return JSON.stringify(r); }),
33
- };
34
- return this.client.generateAdminProto(request);
35
- };
36
- Admin.prototype.register = function (paths, protoFile, serverUrl) {
37
- var request = {
12
+ register(paths, serverUrl) {
13
+ const request = {
38
14
  routes: paths,
39
- protoFile: protoFile,
40
15
  routerUrl: serverUrl,
41
16
  };
42
17
  return this.client.registerAdminRoute(request);
43
- };
44
- return Admin;
45
- }(classes_1.ConduitModule));
18
+ }
19
+ patchRouteMiddlewares(path, action, middlewares) {
20
+ return this.client.patchRouteMiddlewares({
21
+ path: path,
22
+ action: action,
23
+ middlewares: middlewares,
24
+ });
25
+ }
26
+ }
46
27
  exports.Admin = Admin;
47
28
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/admin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA8C;AAC9C,+CAK0B;AAO1B;IAA2B,yBAAqC;IAC9D,eAAqB,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAAxE,YACE,kBAAM,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,SAE3C;QAHoB,gBAAU,GAAV,UAAU,CAAQ;QAErC,KAAI,CAAC,gBAAgB,CAAC,4BAAe,CAAC,CAAC;;IACzC,CAAC;IAED,iCAAiB,GAAjB,UACE,UAAkB,EAClB,MAA4E;QAE5E,IAAM,OAAO,GAA8B;YACzC,UAAU,YAAA;YACV,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAjB,CAAiB,CAAC;SAC3C,CAAC;QACF,OAAO,IAAI,CAAC,MAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,wBAAQ,GAAR,UACE,KAAiD,EACjD,SAAiB,EACjB,SAAkB;QAElB,IAAM,OAAO,GAA8B;YACzC,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,SAAS;SACrB,CAAC;QAEF,OAAO,IAAI,CAAC,MAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IACH,YAAC;AAAD,CAAC,AA9BD,CAA2B,uBAAa,GA8BvC;AA9BY,sBAAK"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/admin/index.ts"],"names":[],"mappings":";;;AAAA,2CAA8C;AAC9C,iDAI0B;AAG1B,MAAa,KAAM,SAAQ,uBAAqC;IAC9D,YAAqB,UAAkB,EAAE,GAAW,EAAE,SAAkB;QACtE,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QADxB,eAAU,GAAV,UAAU,CAAQ;QAErC,IAAI,CAAC,gBAAgB,CAAC,4BAAe,CAAC,CAAC;IACzC,CAAC;IAED,QAAQ,CACN,KAAiD,EACjD,SAAkB;QAElB,MAAM,OAAO,GAA8B;YACzC,MAAM,EAAE,KAAK;YACb,SAAS,EAAE,SAAS;SACrB,CAAC;QAEF,OAAO,IAAI,CAAC,MAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED,qBAAqB,CACnB,IAAY,EACZ,MAA2B,EAC3B,WAAqB;QAErB,OAAO,IAAI,CAAC,MAAO,CAAC,qBAAqB,CAAC;YACxC,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM;YACd,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;IACL,CAAC;CACF;AA7BD,sBA6BC"}
@@ -1,5 +1,5 @@
1
- import { ConduitModule } from '../../classes/ConduitModule';
2
- import { AuthenticationDefinition, UserCreateResponse, UserDeleteResponse, UserLoginResponse } from '../../protoUtils/authentication';
1
+ import { ConduitModule } from '../../classes';
2
+ import { AuthenticationDefinition, TeamDeleteResponse, UserCreateResponse, UserDeleteResponse, UserLoginResponse, Team, ValidateAccessTokenResponse } from '../../protoUtils';
3
3
  export declare class Authentication extends ConduitModule<typeof AuthenticationDefinition> {
4
4
  private readonly moduleName;
5
5
  constructor(moduleName: string, url: string, grpcToken?: string);
@@ -7,4 +7,8 @@ export declare class Authentication extends ConduitModule<typeof AuthenticationD
7
7
  userDelete(userId: string): Promise<UserDeleteResponse>;
8
8
  userCreate(email: string, verify?: boolean, password?: string): Promise<UserCreateResponse>;
9
9
  changePass(email: string, password?: string): Promise<UserCreateResponse>;
10
+ getTeam(teamId: string): Promise<Team>;
11
+ createTeam(name: string, parentTeam?: string, isDefault?: boolean): Promise<Team>;
12
+ teamDelete(teamId: string): Promise<TeamDeleteResponse>;
13
+ validateAccessToken(accessToken: string, path?: string): Promise<ValidateAccessTokenResponse>;
10
14
  }
@@ -1,45 +1,38 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Authentication = void 0;
19
- var ConduitModule_1 = require("../../classes/ConduitModule");
20
- var authentication_1 = require("../../protoUtils/authentication");
21
- var Authentication = /** @class */ (function (_super) {
22
- __extends(Authentication, _super);
23
- function Authentication(moduleName, url, grpcToken) {
24
- var _this = _super.call(this, moduleName, 'authentication', url, grpcToken) || this;
25
- _this.moduleName = moduleName;
26
- _this.initializeClient(authentication_1.AuthenticationDefinition);
27
- return _this;
28
- }
29
- Authentication.prototype.userLogin = function (userId, clientId) {
30
- return this.client.userLogin({ userId: userId, clientId: clientId });
31
- };
32
- Authentication.prototype.userDelete = function (userId) {
33
- return this.client.userDelete({ userId: userId });
34
- };
35
- Authentication.prototype.userCreate = function (email, verify, password) {
36
- if (verify === void 0) { verify = false; }
37
- return this.client.userCreate({ email: email, verify: verify, password: password });
38
- };
39
- Authentication.prototype.changePass = function (email, password) {
40
- return this.client.changePass({ email: email, password: password });
41
- };
42
- return Authentication;
43
- }(ConduitModule_1.ConduitModule));
4
+ const classes_1 = require("../../classes");
5
+ const protoUtils_1 = require("../../protoUtils");
6
+ class Authentication extends classes_1.ConduitModule {
7
+ constructor(moduleName, url, grpcToken) {
8
+ super(moduleName, 'authentication', url, grpcToken);
9
+ this.moduleName = moduleName;
10
+ this.initializeClient(protoUtils_1.AuthenticationDefinition);
11
+ }
12
+ userLogin(userId, clientId) {
13
+ return this.client.userLogin({ userId, clientId });
14
+ }
15
+ userDelete(userId) {
16
+ return this.client.userDelete({ userId });
17
+ }
18
+ userCreate(email, verify = false, password) {
19
+ return this.client.userCreate({ email, verify, password });
20
+ }
21
+ changePass(email, password) {
22
+ return this.client.changePass({ email, password });
23
+ }
24
+ getTeam(teamId) {
25
+ return this.client.getTeam({ teamId });
26
+ }
27
+ createTeam(name, parentTeam, isDefault = false) {
28
+ return this.client.createTeam({ name, parentTeam, isDefault });
29
+ }
30
+ teamDelete(teamId) {
31
+ return this.client.teamDelete({ teamId });
32
+ }
33
+ validateAccessToken(accessToken, path) {
34
+ return this.client.validateAccessToken({ accessToken, path });
35
+ }
36
+ }
44
37
  exports.Authentication = Authentication;
45
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6DAA4D;AAC5D,kEAKyC;AAEzC;IAAoC,kCAA8C;IAChF,wBAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAAhF,YACE,kBAAM,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,CAAC,SAEpD;QAH4B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AO,IAAI,CAAC,MAAO,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,UAAU,CACR,KAAa,EACb,SAAkB,KAAK,EACvB,QAAiB;QAEjB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,QAAiB;QACzC,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,CAAC,MAAc;QACpB,OAAO,IAAI,CAAC,MAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,UAAU,CAAC,IAAY,EAAE,UAAmB,EAAE,YAAqB,KAAK;QACtE,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,UAAU,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,mBAAmB,CACjB,WAAmB,EACnB,IAAa;QAEb,OAAO,IAAI,CAAC,MAAO,CAAC,mBAAmB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;AA5CD,wCA4CC"}
@@ -1,5 +1,5 @@
1
1
  import { ConduitModule } from '../../classes';
2
- import { AuthorizationDefinition, Decision, DeleteAllRelationsRequest, FindRelationRequest, FindRelationResponse, PermissionCheck, PermissionRequest, Relation, Resource } from '../../protoUtils';
2
+ import { AllowedResourcesRequest, AllowedResourcesResponse, AuthorizationDefinition, Decision, DeleteAllRelationsRequest, FindRelationRequest, FindRelationResponse, PermissionCheck, PermissionRequest, Relation, Resource, ResourceAccessListRequest } from '../../protoUtils';
3
3
  import { Empty } from '../../protoUtils/google/protobuf/empty';
4
4
  export declare class Authorization extends ConduitModule<typeof AuthorizationDefinition> {
5
5
  private readonly moduleName;
@@ -10,8 +10,11 @@ export declare class Authorization extends ConduitModule<typeof AuthorizationDef
10
10
  deleteRelation(data: Relation): Promise<Empty>;
11
11
  deleteAllRelations(data: DeleteAllRelationsRequest): Promise<Empty>;
12
12
  createRelation(data: Relation): Promise<Empty>;
13
+ createRelations(subject: string, relation: string, resources: string[]): Promise<Empty>;
13
14
  findRelation(data: FindRelationRequest): Promise<FindRelationResponse>;
14
15
  can(data: PermissionCheck): Promise<Decision>;
15
16
  grantPermission(data: PermissionRequest): Promise<Empty>;
16
17
  removePermission(data: PermissionRequest): Promise<Empty>;
18
+ getAllowedResources(data: AllowedResourcesRequest): Promise<AllowedResourcesResponse>;
19
+ createResourceAccessList(data: ResourceAccessListRequest): Promise<Empty>;
17
20
  }
@@ -1,62 +1,53 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Authorization = void 0;
19
- var classes_1 = require("../../classes");
20
- var protoUtils_1 = require("../../protoUtils");
21
- var Authorization = /** @class */ (function (_super) {
22
- __extends(Authorization, _super);
23
- function Authorization(moduleName, url, grpcToken) {
24
- var _this = _super.call(this, moduleName, 'authorization', url, grpcToken) || this;
25
- _this.moduleName = moduleName;
26
- _this.initializeClient(protoUtils_1.AuthorizationDefinition);
27
- return _this;
28
- }
29
- Authorization.prototype.defineResource = function (data) {
4
+ const classes_1 = require("../../classes");
5
+ const protoUtils_1 = require("../../protoUtils");
6
+ class Authorization extends classes_1.ConduitModule {
7
+ constructor(moduleName, url, grpcToken) {
8
+ super(moduleName, 'authorization', url, grpcToken);
9
+ this.moduleName = moduleName;
10
+ this.initializeClient(protoUtils_1.AuthorizationDefinition);
11
+ }
12
+ defineResource(data) {
30
13
  return this.client.defineResource(data);
31
- };
32
- Authorization.prototype.updateResource = function (data) {
14
+ }
15
+ updateResource(data) {
33
16
  return this.client.updateResource(data);
34
- };
35
- Authorization.prototype.deleteResource = function (data) {
17
+ }
18
+ deleteResource(data) {
36
19
  return this.client.deleteResource(data);
37
- };
38
- Authorization.prototype.deleteRelation = function (data) {
20
+ }
21
+ deleteRelation(data) {
39
22
  return this.client.deleteRelation(data);
40
- };
41
- Authorization.prototype.deleteAllRelations = function (data) {
23
+ }
24
+ deleteAllRelations(data) {
42
25
  return this.client.deleteAllRelations(data);
43
- };
44
- Authorization.prototype.createRelation = function (data) {
26
+ }
27
+ createRelation(data) {
45
28
  return this.client.createRelation(data);
46
- };
47
- Authorization.prototype.findRelation = function (data) {
29
+ }
30
+ createRelations(subject, relation, resources) {
31
+ return this.client.createRelations({ subject, relation, resources });
32
+ }
33
+ findRelation(data) {
48
34
  return this.client.findRelation(data);
49
- };
50
- Authorization.prototype.can = function (data) {
35
+ }
36
+ can(data) {
51
37
  return this.client.can(data);
52
- };
53
- Authorization.prototype.grantPermission = function (data) {
38
+ }
39
+ grantPermission(data) {
54
40
  return this.client.grantPermission(data);
55
- };
56
- Authorization.prototype.removePermission = function (data) {
41
+ }
42
+ removePermission(data) {
57
43
  return this.client.removePermission(data);
58
- };
59
- return Authorization;
60
- }(classes_1.ConduitModule));
44
+ }
45
+ getAllowedResources(data) {
46
+ return this.client.getAllowedResources(data);
47
+ }
48
+ createResourceAccessList(data) {
49
+ return this.client.createResourceAccessList(data);
50
+ }
51
+ }
61
52
  exports.Authorization = Authorization;
62
53
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authorization/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,yCAA8C;AAC9C,+CAU0B;AAG1B;IAAmC,iCAA6C;IAC9E,uBAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAAhF,YACE,kBAAM,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS,CAAC,SAEnD;QAH4B,gBAAU,GAAV,UAAU,CAAQ;QAE7C,KAAI,CAAC,gBAAgB,CAAC,oCAAuB,CAAC,CAAC;;IACjD,CAAC;IAED,sCAAc,GAAd,UAAe,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,sCAAc,GAAd,UAAe,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,sCAAc,GAAd,UAAe,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,sCAAc,GAAd,UAAe,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,0CAAkB,GAAlB,UAAmB,IAA+B;QAChD,OAAO,IAAI,CAAC,MAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,sCAAc,GAAd,UAAe,IAAc;QAC3B,OAAO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d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Chat = void 0;
19
- var ConduitModule_1 = require("../../classes/ConduitModule");
20
- var chat_1 = require("../../protoUtils/chat");
21
- var Chat = /** @class */ (function (_super) {
22
- __extends(Chat, _super);
23
- function Chat(moduleName, url, grpcToken) {
24
- var _this = _super.call(this, moduleName, 'chat', url, grpcToken) || this;
25
- _this.moduleName = moduleName;
26
- _this.initializeClient(chat_1.ChatDefinition);
27
- return _this;
4
+ const ConduitModule_1 = require("../../classes/ConduitModule");
5
+ const chat_1 = require("../../protoUtils/chat");
6
+ class Chat extends ConduitModule_1.ConduitModule {
7
+ constructor(moduleName, url, grpcToken) {
8
+ super(moduleName, 'chat', url, grpcToken);
9
+ this.moduleName = moduleName;
10
+ this.initializeClient(chat_1.ChatDefinition);
28
11
  }
29
- Chat.prototype.sendMessage = function (messageData) {
12
+ sendMessage(messageData) {
30
13
  return this.client.sendMessage(messageData);
31
- };
32
- Chat.prototype.createRoom = function (name, participants) {
33
- return this.client.createRoom({ name: name, participants: participants });
34
- };
35
- Chat.prototype.deleteRoom = function (id) {
36
- return this.client.deleteRoom({ id: id });
37
- };
38
- return Chat;
39
- }(ConduitModule_1.ConduitModule));
14
+ }
15
+ createRoom(name, participants) {
16
+ return this.client.createRoom({ name, participants });
17
+ }
18
+ deleteRoom(id) {
19
+ return this.client.deleteRoom({ _id: id });
20
+ }
21
+ }
40
22
  exports.Chat = Chat;
41
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/chat/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6DAA4D;AAC5D,8CAAiF;AAEjF;IAA0B,wBAAoC;IAC5D,cAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAAhF,YACE,kBAAM,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,SAE1C;QAH4B,gBAAU,GAAV,UAAU,CAAQ;QAE7C,KAAI,CAAC,gBAAgB,CAAC,qBAAc,CAAC,CAAC;;IACxC,CAAC;IAED,0BAAW,GAAX,UAAY,WAA+B;QACzC,OAAO,IAAI,CAAC,MAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED,yBAAU,GAAV,UAAW,IAAY,EAAE,YAAsB;QAC7C,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,IAAI,MAAA,EAAE,YAAY,cAAA,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,yBAAU,GAAV,UAAW,EAAU;QACnB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,EAAE,IAAA,EAAE,CAAC,CAAC;IACzC,CAAC;IACH,WAAC;AAAD,CAAC,AAjBD,CAA0B,6BAAa,GAiBtC;AAjBY,oBAAI"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/chat/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,gDAAiF;AAEjF,MAAa,IAAK,SAAQ,6BAAoC;IAC5D,YACmB,UAAkB,EACnC,GAAW,EACX,SAAkB;QAElB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QAJzB,eAAU,GAAV,UAAU,CAAQ;QAKnC,IAAI,CAAC,gBAAgB,CAAC,qBAAc,CAAC,CAAC;IACxC,CAAC;IAED,WAAW,CAAC,WAA+B;QACzC,OAAO,IAAI,CAAC,MAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU,CAAC,IAAY,EAAE,YAAsB;QAC7C,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF;AArBD,oBAqBC"}
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
3
3
  import { ConduitModule } from '../../classes';
4
4
  import { HealthCheckStatus } from '../../types';
5
5
  import { ConfigDefinition } from '../../protoUtils/core';
6
+ import { ClusterOptions, RedisOptions } from 'ioredis';
6
7
  export declare class Config extends ConduitModule<typeof ConfigDefinition> {
7
8
  readonly url: string;
8
9
  private readonly emitter;
@@ -17,7 +18,15 @@ export declare class Config extends ConduitModule<typeof ConfigDefinition> {
17
18
  configure(config: any, schema: any, override: boolean): Promise<any>;
18
19
  moduleExists(name: string): Promise<import("../../index").ModuleExistsResponse>;
19
20
  moduleList(): Promise<any[]>;
20
- getRedisDetails(): Promise<import("../../index").GetRedisDetailsResponse>;
21
+ getRedisDetails(): Promise<{
22
+ standalone?: RedisOptions;
23
+ cluster?: ClusterOptions;
24
+ redisHost?: string;
25
+ redisPort?: number;
26
+ redisUsername?: string;
27
+ redisPassword?: string;
28
+ redisConfig?: string;
29
+ }>;
21
30
  registerModule(name: string, url: string, healthStatus: Omit<HealthCheckStatus, HealthCheckStatus.SERVICE_UNKNOWN>): Promise<boolean>;
22
31
  moduleHealthProbe(name: string, url: string): void;
23
32
  getModuleWatcher(): EventEmitter;