@conduitplatform/grpc-sdk 0.15.17 → 0.15.19
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/classes/ConduitActiveSchema.js +25 -43
- package/dist/classes/ConduitActiveSchema.js.map +1 -1
- package/dist/classes/ConduitAuthorizedResource.js +5 -6
- package/dist/classes/ConduitAuthorizedResource.js.map +1 -1
- package/dist/classes/ConduitModule.js +44 -138
- package/dist/classes/ConduitModule.js.map +1 -1
- package/dist/classes/ConduitSchema.js +3 -4
- package/dist/classes/ConduitSchema.js.map +1 -1
- package/dist/classes/ConduitServiceModule.js +39 -98
- package/dist/classes/ConduitServiceModule.js.map +1 -1
- package/dist/classes/ConfigController.js +10 -17
- package/dist/classes/ConfigController.js.map +1 -1
- package/dist/classes/Error.js +17 -40
- package/dist/classes/Error.js.map +1 -1
- package/dist/classes/GrpcServer.js +88 -172
- package/dist/classes/GrpcServer.js.map +1 -1
- package/dist/classes/HealthCheck.js +26 -72
- package/dist/classes/HealthCheck.js.map +1 -1
- package/dist/classes/ManagedModule.js +93 -245
- package/dist/classes/ManagedModule.js.map +1 -1
- package/dist/classes/ModuleManager.js +51 -149
- package/dist/classes/ModuleManager.js.map +1 -1
- package/dist/helpers/GrpcHelper.js +11 -11
- package/dist/helpers/GrpcHelper.js.map +1 -1
- package/dist/helpers/TypeHelpers.js +57 -119
- package/dist/helpers/TypeHelpers.js.map +1 -1
- package/dist/helpers/wrapGrpcFunctions.js +14 -15
- package/dist/helpers/wrapGrpcFunctions.js.map +1 -1
- package/dist/index.js +299 -467
- package/dist/index.js.map +1 -1
- package/dist/interceptors/grpcSignedToken.js +7 -79
- package/dist/interceptors/grpcSignedToken.js.map +1 -1
- package/dist/interceptors/moduleName.js +7 -79
- package/dist/interceptors/moduleName.js.map +1 -1
- package/dist/metrics/MetricsServer.js +25 -70
- package/dist/metrics/MetricsServer.js.map +1 -1
- package/dist/metrics/clientMiddleware.js +76 -217
- package/dist/metrics/clientMiddleware.js.map +1 -1
- package/dist/metrics/config/defaults.js +1 -1
- package/dist/metrics/config/defaults.js.map +1 -1
- package/dist/metrics/index.js +53 -89
- package/dist/metrics/index.js.map +1 -1
- package/dist/modules/admin/index.js +16 -34
- package/dist/modules/admin/index.js.map +1 -1
- package/dist/modules/authentication/index.js +20 -39
- package/dist/modules/authentication/index.js.map +1 -1
- package/dist/modules/authorization/index.js +29 -47
- package/dist/modules/authorization/index.js.map +1 -1
- package/dist/modules/chat/index.js +16 -34
- package/dist/modules/chat/index.js.map +1 -1
- package/dist/modules/config/index.js +70 -175
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/core/index.js +8 -26
- package/dist/modules/core/index.js.map +1 -1
- package/dist/modules/database/index.js +80 -122
- package/dist/modules/database/index.js.map +1 -1
- package/dist/modules/email/index.js +15 -33
- package/dist/modules/email/index.js.map +1 -1
- package/dist/modules/forms/index.js +8 -26
- package/dist/modules/forms/index.js.map +1 -1
- package/dist/modules/functions/index.js +8 -26
- package/dist/modules/functions/index.js.map +1 -1
- package/dist/modules/pushNotifications/index.js +38 -56
- package/dist/modules/pushNotifications/index.js.map +1 -1
- package/dist/modules/router/index.js +18 -36
- package/dist/modules/router/index.js.map +1 -1
- package/dist/modules/sms/index.js +17 -35
- package/dist/modules/sms/index.js.map +1 -1
- package/dist/modules/storage/index.js +17 -36
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/protoUtils/authentication.d.ts +1 -1
- package/dist/protoUtils/authentication.js +188 -169
- package/dist/protoUtils/authentication.js.map +1 -1
- package/dist/protoUtils/authorization.d.ts +1 -1
- package/dist/protoUtils/authorization.js +332 -391
- package/dist/protoUtils/authorization.js.map +1 -1
- package/dist/protoUtils/chat.d.ts +1 -1
- package/dist/protoUtils/chat.js +176 -212
- package/dist/protoUtils/chat.js.map +1 -1
- package/dist/protoUtils/core.d.ts +1 -1
- package/dist/protoUtils/core.js +643 -605
- package/dist/protoUtils/core.js.map +1 -1
- package/dist/protoUtils/database.d.ts +1 -1
- package/dist/protoUtils/database.js +563 -554
- package/dist/protoUtils/database.js.map +1 -1
- package/dist/protoUtils/email.d.ts +1 -1
- package/dist/protoUtils/email.js +180 -208
- package/dist/protoUtils/email.js.map +1 -1
- package/dist/protoUtils/forms.d.ts +1 -1
- package/dist/protoUtils/forms.js +37 -35
- package/dist/protoUtils/forms.js.map +1 -1
- package/dist/protoUtils/functions.d.ts +1 -1
- package/dist/protoUtils/functions.js +37 -35
- package/dist/protoUtils/functions.js.map +1 -1
- package/dist/protoUtils/grpc_health_check.d.ts +1 -1
- package/dist/protoUtils/grpc_health_check.js +36 -34
- package/dist/protoUtils/grpc_health_check.js.map +1 -1
- package/dist/protoUtils/push-notifications.d.ts +1 -1
- package/dist/protoUtils/push-notifications.js +252 -272
- package/dist/protoUtils/push-notifications.js.map +1 -1
- package/dist/protoUtils/router.d.ts +1 -1
- package/dist/protoUtils/router.js +381 -387
- package/dist/protoUtils/router.js.map +1 -1
- package/dist/protoUtils/sms.d.ts +1 -1
- package/dist/protoUtils/sms.js +155 -143
- package/dist/protoUtils/sms.js.map +1 -1
- package/dist/protoUtils/storage.d.ts +1 -1
- package/dist/protoUtils/storage.js +190 -164
- package/dist/protoUtils/storage.js.map +1 -1
- package/dist/routing/ConduitRouteReturn.js +9 -18
- package/dist/routing/ConduitRouteReturn.js.map +1 -1
- package/dist/routing/ProxyRouteBuilder.js +21 -24
- package/dist/routing/ProxyRouteBuilder.js.map +1 -1
- package/dist/routing/RouteBuilder.js +31 -34
- package/dist/routing/RouteBuilder.js.map +1 -1
- package/dist/routing/RoutingManager.js +65 -115
- package/dist/routing/RoutingManager.js.map +1 -1
- package/dist/routing/RoutingUtilities.js +3 -3
- package/dist/routing/RoutingUtilities.js.map +1 -1
- package/dist/routing/wrapRouterFunctions.js +25 -34
- package/dist/routing/wrapRouterFunctions.js.map +1 -1
- package/dist/types/index.js +6 -24
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/EventBus.js +16 -17
- package/dist/utilities/EventBus.js.map +1 -1
- package/dist/utilities/Logger.js +80 -180
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/RedisManager.js +11 -21
- package/dist/utilities/RedisManager.js.map +1 -1
- package/dist/utilities/StateManager.js +13 -14
- package/dist/utilities/StateManager.js.map +1 -1
- package/dist/utilities/linearBackoffTimeout.js +28 -92
- package/dist/utilities/linearBackoffTimeout.js.map +1 -1
- package/dist/utilities/merge.js +2 -2
- package/dist/utilities/merge.js.map +1 -1
- package/dist/utilities/sleep.js +1 -1
- package/dist/utilities/sleep.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,47 +1,29 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.initializeClient(core_1.AdminDefinition);
|
|
27
|
-
return _this;
|
|
4
|
+
const ConduitModule_1 = require("../../classes/ConduitModule");
|
|
5
|
+
const core_1 = require("../../protoUtils/core");
|
|
6
|
+
class Admin extends ConduitModule_1.ConduitModule {
|
|
7
|
+
constructor(moduleName, url, grpcToken) {
|
|
8
|
+
super(moduleName, 'admin', url, grpcToken);
|
|
9
|
+
this.moduleName = moduleName;
|
|
10
|
+
this.initializeClient(core_1.AdminDefinition);
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
moduleName
|
|
32
|
-
routes: routes.map(
|
|
12
|
+
generateProtoFile(moduleName, routes) {
|
|
13
|
+
const request = {
|
|
14
|
+
moduleName,
|
|
15
|
+
routes: routes.map(r => JSON.stringify(r)),
|
|
33
16
|
};
|
|
34
17
|
return this.client.generateProto(request);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
}
|
|
19
|
+
register(paths, protoFile, serverUrl) {
|
|
20
|
+
const request = {
|
|
38
21
|
routes: paths,
|
|
39
22
|
protoFile: protoFile,
|
|
40
23
|
routerUrl: serverUrl,
|
|
41
24
|
};
|
|
42
25
|
return this.client.registerAdminRoute(request);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}(ConduitModule_1.ConduitModule));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
46
28
|
exports.Admin = Admin;
|
|
47
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/admin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/admin/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,gDAK+B;AAO/B,MAAa,KAAM,SAAQ,6BAAqC;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,sBAAe,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB,CACf,UAAkB,EAClB,MAA4E;QAE5E,MAAM,OAAO,GAAyB;YACpC,UAAU;YACV,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC3C,CAAC;QACF,OAAO,IAAI,CAAC,MAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,QAAQ,CACN,KAAiD,EACjD,SAAiB,EACjB,SAAkB;QAElB,MAAM,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;CACF;AA9BD,sBA8BC"}
|
|
@@ -1,45 +1,26 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.initializeClient(authentication_1.AuthenticationDefinition);
|
|
27
|
-
return _this;
|
|
4
|
+
const ConduitModule_1 = require("../../classes/ConduitModule");
|
|
5
|
+
const authentication_1 = require("../../protoUtils/authentication");
|
|
6
|
+
class Authentication extends ConduitModule_1.ConduitModule {
|
|
7
|
+
constructor(moduleName, url, grpcToken) {
|
|
8
|
+
super(moduleName, 'authentication', url, grpcToken);
|
|
9
|
+
this.moduleName = moduleName;
|
|
10
|
+
this.initializeClient(authentication_1.AuthenticationDefinition);
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
return this.client.userLogin({ userId
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return this.client.userDelete({ userId
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return Authentication;
|
|
43
|
-
}(ConduitModule_1.ConduitModule));
|
|
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
|
+
}
|
|
44
25
|
exports.Authentication = Authentication;
|
|
45
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authentication/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authentication/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,oEAKyC;AAEzC,MAAa,cAAe,SAAQ,6BAA8C;IAChF,YAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAC9E,KAAK,CAAC,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QADzB,eAAU,GAAV,UAAU,CAAQ;QAE7C,IAAI,CAAC,gBAAgB,CAAC,yCAAwB,CAAC,CAAC;IAClD,CAAC;IAED,SAAS,CAAC,MAAc,EAAE,QAAgB;QACxC,OAAO,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;CACF;AAzBD,wCAyBC"}
|
|
@@ -1,62 +1,44 @@
|
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
Authorization.prototype.defineResource = function (data) {
|
|
4
|
+
const ConduitModule_1 = require("../../classes/ConduitModule");
|
|
5
|
+
const authorization_1 = require("../../protoUtils/authorization");
|
|
6
|
+
class Authorization extends ConduitModule_1.ConduitModule {
|
|
7
|
+
constructor(moduleName, url, grpcToken) {
|
|
8
|
+
super(moduleName, 'authorization', url, grpcToken);
|
|
9
|
+
this.moduleName = moduleName;
|
|
10
|
+
this.initializeClient(authorization_1.AuthorizationDefinition);
|
|
11
|
+
}
|
|
12
|
+
defineResource(data) {
|
|
30
13
|
return this.client.defineResource(data);
|
|
31
|
-
}
|
|
32
|
-
|
|
14
|
+
}
|
|
15
|
+
updateResource(data) {
|
|
33
16
|
return this.client.updateResource(data);
|
|
34
|
-
}
|
|
35
|
-
|
|
17
|
+
}
|
|
18
|
+
deleteResource(data) {
|
|
36
19
|
return this.client.deleteResource(data);
|
|
37
|
-
}
|
|
38
|
-
|
|
20
|
+
}
|
|
21
|
+
deleteRelation(data) {
|
|
39
22
|
return this.client.deleteRelation(data);
|
|
40
|
-
}
|
|
41
|
-
|
|
23
|
+
}
|
|
24
|
+
deleteAllRelations(data) {
|
|
42
25
|
return this.client.deleteAllRelations(data);
|
|
43
|
-
}
|
|
44
|
-
|
|
26
|
+
}
|
|
27
|
+
createRelation(data) {
|
|
45
28
|
return this.client.createRelation(data);
|
|
46
|
-
}
|
|
47
|
-
|
|
29
|
+
}
|
|
30
|
+
findRelation(data) {
|
|
48
31
|
return this.client.findRelation(data);
|
|
49
|
-
}
|
|
50
|
-
|
|
32
|
+
}
|
|
33
|
+
can(data) {
|
|
51
34
|
return this.client.can(data);
|
|
52
|
-
}
|
|
53
|
-
|
|
35
|
+
}
|
|
36
|
+
grantPermission(data) {
|
|
54
37
|
return this.client.grantPermission(data);
|
|
55
|
-
}
|
|
56
|
-
|
|
38
|
+
}
|
|
39
|
+
removePermission(data) {
|
|
57
40
|
return this.client.removePermission(data);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
}(ConduitModule_1.ConduitModule));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
61
43
|
exports.Authorization = Authorization;
|
|
62
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authorization/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authorization/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,kEAWwC;AAExC,MAAa,aAAc,SAAQ,6BAA6C;IAC9E,YAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAC9E,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QADxB,eAAU,GAAV,UAAU,CAAQ;QAE7C,IAAI,CAAC,gBAAgB,CAAC,uCAAuB,CAAC,CAAC;IACjD,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,kBAAkB,CAAC,IAA+B;QAChD,OAAO,IAAI,CAAC,MAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IAED,cAAc,CAAC,IAAc;QAC3B,OAAO,IAAI,CAAC,MAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,YAAY,CAAC,IAAyB;QACpC,OAAO,IAAI,CAAC,MAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,GAAG,CAAC,IAAqB;QACvB,OAAO,IAAI,CAAC,MAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,eAAe,CAAC,IAAuB;QACrC,OAAO,IAAI,CAAC,MAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,gBAAgB,CAAC,IAAuB;QACtC,OAAO,IAAI,CAAC,MAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AA7CD,sCA6CC"}
|
|
@@ -1,41 +1,23 @@
|
|
|
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.Chat = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
12
|
+
sendMessage(messageData) {
|
|
30
13
|
return this.client.sendMessage(messageData);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return this.client.createRoom({ name
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return this.client.deleteRoom({ id
|
|
37
|
-
}
|
|
38
|
-
|
|
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 });
|
|
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":"
|
|
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,YAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAC9E,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QADf,eAAU,GAAV,UAAU,CAAQ;QAE7C,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,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAjBD,oBAiBC"}
|
|
@@ -1,155 +1,94 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
54
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
55
|
-
var m = o[Symbol.asyncIterator], i;
|
|
56
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
57
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
58
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
59
|
-
};
|
|
60
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
61
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
62
4
|
};
|
|
63
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
6
|
exports.Config = void 0;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
_this._serviceHealthStatusGetter = serviceHealthStatusGetter;
|
|
78
|
-
return _this;
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const ConduitModule_1 = require("../../classes/ConduitModule");
|
|
9
|
+
const core_1 = require("../../protoUtils/core");
|
|
10
|
+
const index_1 = __importDefault(require("../../index"));
|
|
11
|
+
class Config extends ConduitModule_1.ConduitModule {
|
|
12
|
+
constructor(moduleName, url, serviceHealthStatusGetter, grpcToken) {
|
|
13
|
+
super(moduleName, 'config', url, grpcToken);
|
|
14
|
+
this.url = url;
|
|
15
|
+
this.emitter = new events_1.EventEmitter();
|
|
16
|
+
this.coreLive = false;
|
|
17
|
+
this.initializeClient(core_1.ConfigDefinition);
|
|
18
|
+
this._serviceHealthStatusGetter = serviceHealthStatusGetter;
|
|
79
19
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return this.client.getServerConfig(request).then(
|
|
20
|
+
getServerConfig() {
|
|
21
|
+
const request = {};
|
|
22
|
+
return this.client.getServerConfig(request).then(res => {
|
|
83
23
|
return JSON.parse(res.data);
|
|
84
24
|
});
|
|
85
|
-
}
|
|
86
|
-
|
|
25
|
+
}
|
|
26
|
+
getModuleUrlByName(name) {
|
|
87
27
|
if (name === 'core')
|
|
88
28
|
return Promise.resolve({ url: this.url });
|
|
89
|
-
return this.client.getModuleUrlByName({ name: name }).then(
|
|
29
|
+
return this.client.getModuleUrlByName({ name: name }).then(res => {
|
|
90
30
|
return { url: res.moduleUrl };
|
|
91
31
|
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
32
|
+
}
|
|
33
|
+
get(name) {
|
|
34
|
+
const request = {
|
|
95
35
|
key: name,
|
|
96
36
|
};
|
|
97
|
-
return this.client.get(request).then(
|
|
37
|
+
return this.client.get(request).then(res => {
|
|
98
38
|
return JSON.parse(res.data);
|
|
99
39
|
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
40
|
+
}
|
|
41
|
+
configure(config, schema, override) {
|
|
42
|
+
const request = {
|
|
103
43
|
config: JSON.stringify(config),
|
|
104
44
|
schema: JSON.stringify(schema),
|
|
105
|
-
override
|
|
45
|
+
override,
|
|
106
46
|
};
|
|
107
|
-
return this.client.configure(request).then(
|
|
47
|
+
return this.client.configure(request).then(res => {
|
|
108
48
|
return JSON.parse(res.result);
|
|
109
49
|
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
50
|
+
}
|
|
51
|
+
moduleExists(name) {
|
|
52
|
+
const request = {
|
|
113
53
|
moduleName: name,
|
|
114
54
|
};
|
|
115
55
|
return this.client.moduleExists(request);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var request = {};
|
|
56
|
+
}
|
|
57
|
+
moduleList() {
|
|
58
|
+
const request = {};
|
|
120
59
|
return this.client.moduleList(request)
|
|
121
|
-
.then(
|
|
122
|
-
.catch(
|
|
123
|
-
if (
|
|
60
|
+
.then(res => res.modules)
|
|
61
|
+
.catch(err => {
|
|
62
|
+
if (this._clientName === 'core')
|
|
124
63
|
return [];
|
|
125
64
|
throw err;
|
|
126
65
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
66
|
+
}
|
|
67
|
+
getRedisDetails() {
|
|
68
|
+
const request = {};
|
|
130
69
|
return this.client.getRedisDetails(request);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
70
|
+
}
|
|
71
|
+
registerModule(name, url, healthStatus) {
|
|
72
|
+
const request = {
|
|
134
73
|
moduleName: name.toString(),
|
|
135
74
|
url: url.toString(),
|
|
136
75
|
healthStatus: healthStatus,
|
|
137
76
|
};
|
|
138
|
-
|
|
139
|
-
return this.client.registerModule(request).then(
|
|
77
|
+
const self = this;
|
|
78
|
+
return this.client.registerModule(request).then(res => {
|
|
140
79
|
self.coreLive = true;
|
|
141
80
|
return res.result;
|
|
142
81
|
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
82
|
+
}
|
|
83
|
+
moduleHealthProbe(name, url) {
|
|
84
|
+
const request = {
|
|
146
85
|
moduleName: name.toString(),
|
|
147
|
-
url
|
|
86
|
+
url,
|
|
148
87
|
status: this._serviceHealthStatusGetter(),
|
|
149
88
|
};
|
|
150
|
-
|
|
89
|
+
const self = this;
|
|
151
90
|
this.client.moduleHealthProbe(request)
|
|
152
|
-
.then(
|
|
91
|
+
.then(res => {
|
|
153
92
|
if (!res && self.coreLive) {
|
|
154
93
|
index_1.default.Logger.warn('Core unhealthy');
|
|
155
94
|
self.coreLive = false;
|
|
@@ -160,75 +99,31 @@ var Config = /** @class */ (function (_super) {
|
|
|
160
99
|
self.watchModules();
|
|
161
100
|
}
|
|
162
101
|
})
|
|
163
|
-
.catch(
|
|
102
|
+
.catch(e => {
|
|
164
103
|
if (self.coreLive) {
|
|
165
104
|
index_1.default.Logger.warn('Core unhealthy');
|
|
166
105
|
self.coreLive = false;
|
|
167
106
|
}
|
|
168
107
|
});
|
|
169
|
-
}
|
|
170
|
-
|
|
108
|
+
}
|
|
109
|
+
getModuleWatcher() {
|
|
171
110
|
return this.emitter;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
_e.trys.push([2, 15, , 16]);
|
|
190
|
-
call = this.client.watchModules({});
|
|
191
|
-
_e.label = 3;
|
|
192
|
-
case 3:
|
|
193
|
-
_e.trys.push([3, 8, 9, 14]);
|
|
194
|
-
call_1 = __asyncValues(call);
|
|
195
|
-
_e.label = 4;
|
|
196
|
-
case 4: return [4 /*yield*/, call_1.next()];
|
|
197
|
-
case 5:
|
|
198
|
-
if (!(call_1_1 = _e.sent(), !call_1_1.done)) return [3 /*break*/, 7];
|
|
199
|
-
data = call_1_1.value;
|
|
200
|
-
self.emitter.emit('serving-modules-update', data.modules);
|
|
201
|
-
_e.label = 6;
|
|
202
|
-
case 6: return [3 /*break*/, 4];
|
|
203
|
-
case 7: return [3 /*break*/, 14];
|
|
204
|
-
case 8:
|
|
205
|
-
e_1_1 = _e.sent();
|
|
206
|
-
e_1 = { error: e_1_1 };
|
|
207
|
-
return [3 /*break*/, 14];
|
|
208
|
-
case 9:
|
|
209
|
-
_e.trys.push([9, , 12, 13]);
|
|
210
|
-
if (!(call_1_1 && !call_1_1.done && (_a = call_1.return))) return [3 /*break*/, 11];
|
|
211
|
-
return [4 /*yield*/, _a.call(call_1)];
|
|
212
|
-
case 10:
|
|
213
|
-
_e.sent();
|
|
214
|
-
_e.label = 11;
|
|
215
|
-
case 11: return [3 /*break*/, 13];
|
|
216
|
-
case 12:
|
|
217
|
-
if (e_1) throw e_1.error;
|
|
218
|
-
return [7 /*endfinally*/];
|
|
219
|
-
case 13: return [7 /*endfinally*/];
|
|
220
|
-
case 14: return [3 /*break*/, 16];
|
|
221
|
-
case 15:
|
|
222
|
-
error_1 = _e.sent();
|
|
223
|
-
self.coreLive = false;
|
|
224
|
-
index_1.default.Logger.warn('Core unhealthy');
|
|
225
|
-
return [3 /*break*/, 16];
|
|
226
|
-
case 16: return [2 /*return*/];
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
|
-
return Config;
|
|
232
|
-
}(ConduitModule_1.ConduitModule));
|
|
111
|
+
}
|
|
112
|
+
async watchModules() {
|
|
113
|
+
const self = this;
|
|
114
|
+
this.emitter.setMaxListeners(150);
|
|
115
|
+
self.emitter.emit('serving-modules-update', await self.moduleList().catch());
|
|
116
|
+
try {
|
|
117
|
+
const call = this.client.watchModules({});
|
|
118
|
+
for await (const data of call) {
|
|
119
|
+
self.emitter.emit('serving-modules-update', data.modules);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
self.coreLive = false;
|
|
124
|
+
index_1.default.Logger.warn('Core unhealthy');
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
233
128
|
exports.Config = Config;
|
|
234
129
|
//# sourceMappingURL=index.js.map
|