@conduitplatform/grpc-sdk 0.16.0-alpha.0 → 0.16.0-alpha.10
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/README.mdx +1 -7
- package/dist/classes/ConduitModule.d.ts +9 -6
- package/dist/classes/ConduitModule.js +85 -48
- package/dist/classes/ConduitModule.js.map +1 -1
- package/dist/classes/ConduitSchema.js.map +1 -1
- package/dist/classes/HealthCheck.js +36 -9
- package/dist/classes/HealthCheck.js.map +1 -1
- package/dist/classes/index.d.ts +2 -6
- package/dist/classes/index.js +2 -6
- package/dist/classes/index.js.map +1 -1
- package/dist/index.d.ts +33 -31
- package/dist/index.js +155 -176
- package/dist/index.js.map +1 -1
- package/dist/interceptors/grpcSignedToken.d.ts +1 -1
- package/dist/interceptors/grpcSignedToken.js +2 -2
- package/dist/interceptors/moduleName.d.ts +1 -1
- package/dist/interceptors/moduleName.js +2 -2
- package/dist/interfaces/ConduitMiddleware.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/ConduitRoute.d.ts +2 -3
- package/dist/interfaces/ConduitRoute.js.map +1 -0
- package/dist/{routing → interfaces}/ConduitRouteReturn.d.ts +3 -3
- package/dist/interfaces/ConduitRouteReturn.js.map +1 -0
- package/dist/interfaces/ConduitSchemaExtension.d.ts +1 -1
- package/dist/interfaces/GrpcCallback.d.ts +1 -1
- package/dist/{utilities/Logger.d.ts → interfaces/IConduitLogger.d.ts} +4 -7
- package/dist/interfaces/{ConduitService.js → IConduitLogger.js} +1 -1
- package/dist/interfaces/IConduitLogger.js.map +1 -0
- package/dist/{metrics/index.d.ts → interfaces/IConduitMetrics.d.ts} +5 -11
- package/dist/interfaces/IConduitMetrics.js +3 -0
- package/dist/interfaces/IConduitMetrics.js.map +1 -0
- package/dist/interfaces/Indexable.d.ts +7 -8
- package/dist/interfaces/Model.d.ts +77 -12
- package/dist/interfaces/Model.js +15 -1
- package/dist/interfaces/Model.js.map +1 -1
- package/dist/interfaces/Params.d.ts +8 -0
- package/dist/interfaces/Params.js +3 -0
- package/dist/interfaces/Params.js.map +1 -0
- package/dist/interfaces/ProxyRoute.js.map +1 -0
- package/dist/interfaces/RawQuery.d.ts +2 -2
- package/dist/interfaces/Route.d.ts +61 -0
- package/dist/interfaces/Route.js +12 -0
- package/dist/interfaces/Route.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/Socket.d.ts +4 -5
- package/dist/interfaces/Socket.js.map +1 -0
- package/dist/interfaces/UntypedArray.d.ts +1 -0
- package/dist/interfaces/UntypedArray.js +3 -0
- package/dist/interfaces/UntypedArray.js.map +1 -0
- package/dist/interfaces/index.d.ts +11 -2
- package/dist/interfaces/index.js +11 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/{routing/interfaces → interfaces}/types.d.ts +11 -9
- package/dist/{routing/interfaces → interfaces}/types.js.map +1 -1
- package/dist/module.proto +14 -0
- package/dist/modules/admin/index.d.ts +5 -4
- package/dist/modules/admin/index.js +12 -5
- package/dist/modules/admin/index.js.map +1 -1
- package/dist/modules/authorization/index.d.ts +3 -2
- package/dist/modules/authorization/index.js +4 -4
- package/dist/modules/authorization/index.js.map +1 -1
- package/dist/modules/config/index.d.ts +5 -5
- package/dist/modules/config/index.js +39 -29
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/database/index.d.ts +8 -6
- package/dist/modules/database/index.js +18 -15
- package/dist/modules/database/index.js.map +1 -1
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +0 -2
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/router/index.d.ts +4 -3
- package/dist/modules/router/index.js +9 -2
- package/dist/modules/router/index.js.map +1 -1
- package/dist/modules/storage/index.d.ts +6 -2
- package/dist/modules/storage/index.js +22 -2
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/protoUtils/authentication.d.ts +3 -48
- package/dist/protoUtils/authentication.js +84 -142
- package/dist/protoUtils/authentication.js.map +1 -1
- package/dist/protoUtils/authorization.d.ts +33 -82
- package/dist/protoUtils/authorization.js +233 -219
- package/dist/protoUtils/authorization.js.map +1 -1
- package/dist/protoUtils/chat.d.ts +7 -61
- package/dist/protoUtils/chat.js +68 -170
- package/dist/protoUtils/chat.js.map +1 -1
- package/dist/protoUtils/core.d.ts +115 -90
- package/dist/protoUtils/core.js +485 -205
- package/dist/protoUtils/core.js.map +1 -1
- package/dist/protoUtils/database.d.ts +50 -15
- package/dist/protoUtils/database.js +455 -157
- package/dist/protoUtils/database.js.map +1 -1
- package/dist/protoUtils/email.d.ts +3 -48
- package/dist/protoUtils/email.js +82 -136
- package/dist/protoUtils/email.js.map +1 -1
- package/dist/protoUtils/google/protobuf/empty.d.ts +25 -0
- package/dist/protoUtils/google/protobuf/empty.js +47 -0
- package/dist/protoUtils/google/protobuf/empty.js.map +1 -0
- package/dist/protoUtils/grpc_health_check.d.ts +3 -4
- package/dist/protoUtils/grpc_health_check.js +19 -12
- package/dist/protoUtils/grpc_health_check.js.map +1 -1
- package/dist/protoUtils/index.d.ts +12 -0
- package/dist/{routing/interfaces → protoUtils}/index.js +12 -6
- package/dist/protoUtils/index.js.map +1 -0
- package/dist/protoUtils/{forms.d.ts → module.d.ts} +6 -7
- package/dist/protoUtils/{forms.js → module.js} +23 -16
- package/dist/protoUtils/module.js.map +1 -0
- package/dist/protoUtils/push-notifications.d.ts +3 -48
- package/dist/protoUtils/push-notifications.js +121 -154
- package/dist/protoUtils/push-notifications.js.map +1 -1
- package/dist/protoUtils/router.d.ts +45 -64
- package/dist/protoUtils/router.js +318 -221
- package/dist/protoUtils/router.js.map +1 -1
- package/dist/protoUtils/sms.d.ts +3 -48
- package/dist/protoUtils/sms.js +63 -134
- package/dist/protoUtils/sms.js.map +1 -1
- package/dist/protoUtils/storage.d.ts +134 -62
- package/dist/protoUtils/storage.js +521 -199
- package/dist/protoUtils/storage.js.map +1 -1
- package/dist/types/db.d.ts +11 -11
- package/dist/types/index.d.ts +3 -10
- package/dist/types/index.js +15 -0
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/RedisManager.js.map +1 -1
- package/dist/utilities/env.d.ts +1 -0
- package/dist/utilities/env.js +37 -0
- package/dist/utilities/env.js.map +1 -0
- package/dist/utilities/index.d.ts +4 -2
- package/dist/utilities/index.js +4 -2
- package/dist/utilities/index.js.map +1 -1
- package/package.json +24 -25
- package/dist/classes/ConduitActiveSchema.d.ts +0 -19
- package/dist/classes/ConduitActiveSchema.js +0 -57
- package/dist/classes/ConduitActiveSchema.js.map +0 -1
- package/dist/classes/ConduitServiceModule.d.ts +0 -26
- package/dist/classes/ConduitServiceModule.js +0 -166
- package/dist/classes/ConduitServiceModule.js.map +0 -1
- package/dist/classes/ConfigController.d.ts +0 -7
- package/dist/classes/ConfigController.js +0 -27
- package/dist/classes/ConfigController.js.map +0 -1
- package/dist/classes/GrpcServer.d.ts +0 -22
- package/dist/classes/GrpcServer.js +0 -207
- package/dist/classes/GrpcServer.js.map +0 -1
- package/dist/classes/ManagedModule.d.ts +0 -74
- package/dist/classes/ManagedModule.js +0 -333
- package/dist/classes/ManagedModule.js.map +0 -1
- package/dist/classes/ModuleManager.d.ts +0 -11
- package/dist/classes/ModuleManager.js +0 -205
- package/dist/classes/ModuleManager.js.map +0 -1
- package/dist/helpers/GrpcHelper.d.ts +0 -8
- package/dist/helpers/GrpcHelper.js +0 -44
- package/dist/helpers/GrpcHelper.js.map +0 -1
- package/dist/helpers/TypeHelpers.d.ts +0 -44
- package/dist/helpers/TypeHelpers.js +0 -144
- package/dist/helpers/TypeHelpers.js.map +0 -1
- package/dist/helpers/index.d.ts +0 -3
- package/dist/helpers/index.js +0 -20
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/wrapGrpcFunctions.d.ts +0 -5
- package/dist/helpers/wrapGrpcFunctions.js +0 -56
- package/dist/helpers/wrapGrpcFunctions.js.map +0 -1
- package/dist/interfaces/ConduitService.d.ts +0 -8
- package/dist/interfaces/ConduitService.js.map +0 -1
- package/dist/metrics/MetricsServer.d.ts +0 -9
- package/dist/metrics/MetricsServer.js +0 -94
- package/dist/metrics/MetricsServer.js.map +0 -1
- package/dist/metrics/clientMiddleware.d.ts +0 -2
- package/dist/metrics/clientMiddleware.js +0 -265
- package/dist/metrics/clientMiddleware.js.map +0 -1
- package/dist/metrics/config/defaults.d.ts +0 -61
- package/dist/metrics/config/defaults.js +0 -63
- package/dist/metrics/config/defaults.js.map +0 -1
- package/dist/metrics/index.js +0 -152
- package/dist/metrics/index.js.map +0 -1
- package/dist/modules/forms/index.d.ts +0 -6
- package/dist/modules/forms/index.js +0 -32
- package/dist/modules/forms/index.js.map +0 -1
- package/dist/modules/functions/index.d.ts +0 -6
- package/dist/modules/functions/index.js +0 -32
- package/dist/modules/functions/index.js.map +0 -1
- package/dist/protoUtils/forms.js.map +0 -1
- package/dist/protoUtils/functions.d.ts +0 -58
- package/dist/protoUtils/functions.js +0 -119
- package/dist/protoUtils/functions.js.map +0 -1
- package/dist/routing/ConduitRouteReturn.js.map +0 -1
- package/dist/routing/ProxyRouteBuilder.d.ts +0 -21
- package/dist/routing/ProxyRouteBuilder.js +0 -81
- package/dist/routing/ProxyRouteBuilder.js.map +0 -1
- package/dist/routing/RouteBuilder.d.ts +0 -24
- package/dist/routing/RouteBuilder.js +0 -107
- package/dist/routing/RouteBuilder.js.map +0 -1
- package/dist/routing/RoutingManager.d.ts +0 -33
- package/dist/routing/RoutingManager.js +0 -201
- package/dist/routing/RoutingManager.js.map +0 -1
- package/dist/routing/RoutingUtilities.d.ts +0 -7
- package/dist/routing/RoutingUtilities.js +0 -13
- package/dist/routing/RoutingUtilities.js.map +0 -1
- package/dist/routing/index.d.ts +0 -7
- package/dist/routing/index.js +0 -24
- package/dist/routing/index.js.map +0 -1
- package/dist/routing/interfaces/ConduitMiddleware.js.map +0 -1
- package/dist/routing/interfaces/ConduitRoute.js.map +0 -1
- package/dist/routing/interfaces/ProxyRoute.js.map +0 -1
- package/dist/routing/interfaces/Route.d.ts +0 -66
- package/dist/routing/interfaces/Route.js +0 -21
- package/dist/routing/interfaces/Route.js.map +0 -1
- package/dist/routing/interfaces/Socket.js.map +0 -1
- package/dist/routing/interfaces/index.d.ts +0 -6
- package/dist/routing/interfaces/index.js.map +0 -1
- package/dist/routing/wrapRouterFunctions.d.ts +0 -8
- package/dist/routing/wrapRouterFunctions.js +0 -131
- package/dist/routing/wrapRouterFunctions.js.map +0 -1
- package/dist/utilities/Logger.js +0 -255
- package/dist/utilities/Logger.js.map +0 -1
- package/dist/utilities/linearBackoffTimeout.d.ts +0 -10
- package/dist/utilities/linearBackoffTimeout.js +0 -119
- package/dist/utilities/linearBackoffTimeout.js.map +0 -1
- package/dist/utilities/merge.d.ts +0 -1
- package/dist/utilities/merge.js +0 -15
- package/dist/utilities/merge.js.map +0 -1
- /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.d.ts +0 -0
- /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/ConduitRoute.js +0 -0
- /package/dist/{routing → interfaces}/ConduitRouteReturn.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/ProxyRoute.d.ts +0 -0
- /package/dist/{routing/interfaces → interfaces}/ProxyRoute.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/Socket.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/types.js +0 -0
|
@@ -1,166 +0,0 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
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;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
-
};
|
|
64
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.ConduitServiceModule = void 0;
|
|
66
|
-
var __1 = __importStar(require(".."));
|
|
67
|
-
var path_1 = __importDefault(require("path"));
|
|
68
|
-
var events_1 = require("events");
|
|
69
|
-
var lodash_1 = require("lodash");
|
|
70
|
-
var ConduitServiceModule = /** @class */ (function () {
|
|
71
|
-
function ConduitServiceModule(moduleName) {
|
|
72
|
-
this._serviceHealthState = __1.HealthCheckStatus.SERVING; // default for health-agnostic modules
|
|
73
|
-
this.events = new events_1.EventEmitter();
|
|
74
|
-
this._moduleName = (0, lodash_1.camelCase)(moduleName);
|
|
75
|
-
}
|
|
76
|
-
Object.defineProperty(ConduitServiceModule.prototype, "healthState", {
|
|
77
|
-
get: function () {
|
|
78
|
-
return this._serviceHealthState;
|
|
79
|
-
},
|
|
80
|
-
enumerable: false,
|
|
81
|
-
configurable: true
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(ConduitServiceModule.prototype, "grpcSdk", {
|
|
84
|
-
get: function () {
|
|
85
|
-
if (!this._grpcSdk)
|
|
86
|
-
throw new Error('grpcSdk not defined yet');
|
|
87
|
-
return this._grpcSdk;
|
|
88
|
-
},
|
|
89
|
-
set: function (grpcSdk) {
|
|
90
|
-
if (this._grpcSdk)
|
|
91
|
-
throw new Error('grpcSdk already defined');
|
|
92
|
-
this._grpcSdk = grpcSdk;
|
|
93
|
-
},
|
|
94
|
-
enumerable: false,
|
|
95
|
-
configurable: true
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(ConduitServiceModule.prototype, "port", {
|
|
98
|
-
get: function () {
|
|
99
|
-
return this._port;
|
|
100
|
-
},
|
|
101
|
-
enumerable: false,
|
|
102
|
-
configurable: true
|
|
103
|
-
});
|
|
104
|
-
ConduitServiceModule.prototype.addHealthCheckService = function () {
|
|
105
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
return __generator(this, function (_a) {
|
|
107
|
-
switch (_a.label) {
|
|
108
|
-
case 0: return [4 /*yield*/, this.grpcServer.addService(path_1.default.resolve(__dirname, '../grpc_health_check.proto'), 'grpc.health.v1.Health', {
|
|
109
|
-
Check: this.healthCheck.bind(this),
|
|
110
|
-
Watch: this.healthWatch.bind(this),
|
|
111
|
-
})];
|
|
112
|
-
case 1:
|
|
113
|
-
_a.sent();
|
|
114
|
-
return [2 /*return*/];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
ConduitServiceModule.prototype.updateHealth = function (state, init) {
|
|
120
|
-
var _a, _b;
|
|
121
|
-
if (init === void 0) { init = false; }
|
|
122
|
-
if ((state === __1.HealthCheckStatus.UNKNOWN && !init) ||
|
|
123
|
-
state === __1.HealthCheckStatus.SERVICE_UNKNOWN) {
|
|
124
|
-
throw new Error("Cannot explicitly set gRPC health state to ".concat(__1.HealthCheckStatus[state]));
|
|
125
|
-
}
|
|
126
|
-
if (!init) {
|
|
127
|
-
(_a = __1.default.Metrics) === null || _a === void 0 ? void 0 : _a.set('module_health_state', state === __1.HealthCheckStatus.SERVING ? 1 : 0);
|
|
128
|
-
}
|
|
129
|
-
if (this._serviceHealthState !== state) {
|
|
130
|
-
this._serviceHealthState = state;
|
|
131
|
-
this.events.emit("grpc-health-change:".concat(this._serviceName), state);
|
|
132
|
-
(_b = this._grpcSdk) === null || _b === void 0 ? void 0 : _b.config.moduleHealthProbe(this._moduleName, this._address);
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
ConduitServiceModule.prototype.healthCheck = function (call, callback) {
|
|
136
|
-
var service = call.request.service.substring(call.request.service.indexOf('.') + 1);
|
|
137
|
-
if (service && service !== this._serviceName) {
|
|
138
|
-
callback(null, {
|
|
139
|
-
status: __1.HealthCheckStatus.SERVICE_UNKNOWN,
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
callback(null, {
|
|
144
|
-
status: this._serviceHealthState,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
ConduitServiceModule.prototype.healthWatch = function (call) {
|
|
149
|
-
var service = call.request.service.substring(call.request.service.indexOf('.') + 1);
|
|
150
|
-
if (service && service !== this._serviceName) {
|
|
151
|
-
call.write({
|
|
152
|
-
status: __1.HealthCheckStatus.SERVICE_UNKNOWN,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this.events.on("grpc-health-change:".concat(this._serviceName), function (status) {
|
|
157
|
-
call.write({
|
|
158
|
-
status: status,
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
return ConduitServiceModule;
|
|
164
|
-
}());
|
|
165
|
-
exports.ConduitServiceModule = ConduitServiceModule;
|
|
166
|
-
//# sourceMappingURL=ConduitServiceModule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConduitServiceModule.js","sourceRoot":"","sources":["../../src/classes/ConduitServiceModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAmE;AACnE,8CAAwB;AACxB,iCAAsC;AACtC,iCAAmC;AAUnC;IAUE,8BAAsB,UAAkB;QAHhC,wBAAmB,GAAsB,qBAAiB,CAAC,OAAO,CAAC,CAAC,sCAAsC;QAC/F,WAAM,GAAiB,IAAI,qBAAY,EAAE,CAAC;QAG3D,IAAI,CAAC,WAAW,GAAG,IAAA,kBAAS,EAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,sBAAI,6CAAW;aAAf;YACE,OAAO,IAAI,CAAC,mBAAmB,CAAC;QAClC,CAAC;;;OAAA;IAED,sBAAW,yCAAO;aAKlB;YACE,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;aARD,UAAmB,OAAuB;YACxC,IAAI,IAAI,CAAC,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC9D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAC1B,CAAC;;;OAAA;IAOD,sBAAI,sCAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAEe,oDAAqB,GAArC;;;;4B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O,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACtF,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,YAAY,EAAE;YAC5C,QAAQ,CAAC,IAAI,EAAE;gBACb,MAAM,EACJ,qBAAiB,CAAC,eAA+D;aACpF,CAAC,CAAC;SACJ;aAAM;YACL,QAAQ,CAAC,IAAI,EAAE;gBACb,MAAM,EAAE,IAAI,CAAC,mBAAmE;aACjF,CAAC,CAAC;SACJ;IACH,CAAC;IAED,0CAAW,GAAX,UAAY,IAAmE;QAC7E,IAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACtF,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,YAAY,EAAE;YAC5C,IAAI,CAAC,KAAK,CAAC;gBACT,MAAM,EACJ,qBAAiB,CAAC,eAA+D;aACpF,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,EAAE,CACZ,6BAAsB,IAAI,CAAC,YAAY,CAAE,EACzC,UAAC,MAAyB;gBACxB,IAAI,CAAC,KAAK,CAAC;oBACT,MAAM,EAAE,MAAsD;iBAC/D,CAAC,CAAC;YACL,CAAC,CACF,CAAC;SACH;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AApGD,IAoGC;AApGqB,oDAAoB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigController = void 0;
|
|
4
|
-
var ConfigController = /** @class */ (function () {
|
|
5
|
-
function ConfigController() {
|
|
6
|
-
}
|
|
7
|
-
Object.defineProperty(ConfigController.prototype, "config", {
|
|
8
|
-
get: function () {
|
|
9
|
-
// return copy of config and not the original object;
|
|
10
|
-
return Object.assign({}, this._config);
|
|
11
|
-
},
|
|
12
|
-
set: function (config) {
|
|
13
|
-
this._config = config;
|
|
14
|
-
},
|
|
15
|
-
enumerable: false,
|
|
16
|
-
configurable: true
|
|
17
|
-
});
|
|
18
|
-
ConfigController.getInstance = function () {
|
|
19
|
-
if (!ConfigController.instance) {
|
|
20
|
-
ConfigController.instance = new ConfigController();
|
|
21
|
-
}
|
|
22
|
-
return ConfigController.instance;
|
|
23
|
-
};
|
|
24
|
-
return ConfigController;
|
|
25
|
-
}());
|
|
26
|
-
exports.ConfigController = ConfigController;
|
|
27
|
-
//# sourceMappingURL=ConfigController.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigController.js","sourceRoot":"","sources":["../../src/classes/ConfigController.ts"],"names":[],"mappings":";;;AAAA;IAAA;IAoBA,CAAC;IAfC,sBAAI,oCAAM;aAAV;YACE,qDAAqD;YACrD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;aAED,UAAW,MAAW;YACpB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,CAAC;;;OAJA;IAMM,4BAAW,GAAlB;QACE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE;YAC9B,gBAAgB,CAAC,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;SACpD;QACD,OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACnC,CAAC;IACH,uBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,4CAAgB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare class GrpcServer {
|
|
2
|
-
private grpcServer?;
|
|
3
|
-
private started;
|
|
4
|
-
private startedOnce;
|
|
5
|
-
private _serviceNames;
|
|
6
|
-
private scheduledRestart;
|
|
7
|
-
private _postponeRequests;
|
|
8
|
-
private _useForce?;
|
|
9
|
-
private _services;
|
|
10
|
-
constructor(port?: string);
|
|
11
|
-
private postponeRestart;
|
|
12
|
-
private _url;
|
|
13
|
-
get url(): string;
|
|
14
|
-
createNewServer(useForce?: boolean): Promise<number>;
|
|
15
|
-
addService(protoPath: string, protoDescription: string, functions: {
|
|
16
|
-
[name: string]: Function;
|
|
17
|
-
}): Promise<GrpcServer>;
|
|
18
|
-
wait(time: number): Promise<void>;
|
|
19
|
-
refresh(): Promise<void>;
|
|
20
|
-
scheduleRefresh(): void;
|
|
21
|
-
start(): void;
|
|
22
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.GrpcServer = void 0;
|
|
43
|
-
var helpers_1 = require("../helpers");
|
|
44
|
-
var lodash_1 = require("lodash");
|
|
45
|
-
var index_1 = __importDefault(require("../index"));
|
|
46
|
-
var GrpcServer = /** @class */ (function () {
|
|
47
|
-
function GrpcServer(port) {
|
|
48
|
-
this.started = false;
|
|
49
|
-
this.startedOnce = false;
|
|
50
|
-
this._serviceNames = [];
|
|
51
|
-
this._postponeRequests = 0;
|
|
52
|
-
this._services = [];
|
|
53
|
-
this._url = "0.0.0.0:".concat(port !== null && port !== void 0 ? port : '5000');
|
|
54
|
-
}
|
|
55
|
-
GrpcServer.prototype.postponeRestart = function () {
|
|
56
|
-
if (!this.scheduledRestart || this._postponeRequests > 5)
|
|
57
|
-
return;
|
|
58
|
-
this._postponeRequests++;
|
|
59
|
-
this.scheduleRefresh();
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(GrpcServer.prototype, "url", {
|
|
62
|
-
get: function () {
|
|
63
|
-
return this._url;
|
|
64
|
-
},
|
|
65
|
-
enumerable: false,
|
|
66
|
-
configurable: true
|
|
67
|
-
});
|
|
68
|
-
GrpcServer.prototype.createNewServer = function (useForce) {
|
|
69
|
-
if (useForce === void 0) { useForce = false; }
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var serverResult;
|
|
72
|
-
return __generator(this, function (_a) {
|
|
73
|
-
switch (_a.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
if ((0, lodash_1.isNil)(this._useForce)) {
|
|
76
|
-
this._useForce = useForce;
|
|
77
|
-
}
|
|
78
|
-
return [4 /*yield*/, (0, helpers_1.createServer)(this._url)];
|
|
79
|
-
case 1:
|
|
80
|
-
serverResult = _a.sent();
|
|
81
|
-
this.grpcServer = serverResult.server;
|
|
82
|
-
this._url = this._url.split(':')[0] + ':' + serverResult.port.toString();
|
|
83
|
-
return [2 /*return*/, serverResult.port];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
GrpcServer.prototype.addService = function (protoPath, protoDescription, functions) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
-
return __generator(this, function (_a) {
|
|
91
|
-
switch (_a.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
functions = (0, helpers_1.wrapGrpcFunctions)(functions, this.postponeRestart.bind(this));
|
|
94
|
-
if (!(this._serviceNames.indexOf(protoDescription) !== -1)) return [3 /*break*/, 1];
|
|
95
|
-
index_1.default.Logger.log('Service already exists, performing replace');
|
|
96
|
-
this._services[this._serviceNames.indexOf(protoDescription)] = {
|
|
97
|
-
protoPath: protoPath,
|
|
98
|
-
protoDescription: protoDescription,
|
|
99
|
-
functions: functions,
|
|
100
|
-
};
|
|
101
|
-
this.scheduleRefresh();
|
|
102
|
-
return [2 /*return*/, this];
|
|
103
|
-
case 1:
|
|
104
|
-
this._services.push({ protoPath: protoPath, protoDescription: protoDescription, functions: functions });
|
|
105
|
-
this._serviceNames.push(protoDescription);
|
|
106
|
-
if (!this.started) return [3 /*break*/, 2];
|
|
107
|
-
index_1.default.Logger.log('Server already started, scheduling refresh..');
|
|
108
|
-
this.scheduleRefresh();
|
|
109
|
-
return [2 /*return*/, this];
|
|
110
|
-
case 2:
|
|
111
|
-
if (!!this.grpcServer) return [3 /*break*/, 4];
|
|
112
|
-
return [4 /*yield*/, this.wait(1000)];
|
|
113
|
-
case 3:
|
|
114
|
-
_a.sent();
|
|
115
|
-
_a.label = 4;
|
|
116
|
-
case 4:
|
|
117
|
-
(0, helpers_1.addServiceToServer)(this.grpcServer, protoPath, protoDescription, functions);
|
|
118
|
-
return [2 /*return*/, this];
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
GrpcServer.prototype.wait = function (time) {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
-
return __generator(this, function (_a) {
|
|
126
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
127
|
-
var timeout = setTimeout(function () {
|
|
128
|
-
clearTimeout(timeout);
|
|
129
|
-
resolve();
|
|
130
|
-
}, time);
|
|
131
|
-
})];
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
GrpcServer.prototype.refresh = function () {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
-
var _this = this;
|
|
138
|
-
return __generator(this, function (_a) {
|
|
139
|
-
switch (_a.label) {
|
|
140
|
-
case 0:
|
|
141
|
-
if (!this.started) return [3 /*break*/, 3];
|
|
142
|
-
this.started = false;
|
|
143
|
-
if (!this._useForce) return [3 /*break*/, 1];
|
|
144
|
-
this.grpcServer.forceShutdown();
|
|
145
|
-
return [3 /*break*/, 3];
|
|
146
|
-
case 1:
|
|
147
|
-
//gracefully shutdown so that there are no service disruption
|
|
148
|
-
return [4 /*yield*/, new Promise(function (resolve) { return _this.grpcServer.tryShutdown(function () { return resolve(); }); })];
|
|
149
|
-
case 2:
|
|
150
|
-
//gracefully shutdown so that there are no service disruption
|
|
151
|
-
_a.sent();
|
|
152
|
-
_a.label = 3;
|
|
153
|
-
case 3: return [4 /*yield*/, this.createNewServer()];
|
|
154
|
-
case 4:
|
|
155
|
-
_a.sent();
|
|
156
|
-
this._services.forEach(function (service) {
|
|
157
|
-
(0, helpers_1.addServiceToServer)(_this.grpcServer, service.protoPath, service.protoDescription, service.functions);
|
|
158
|
-
});
|
|
159
|
-
if (!this.started && this.startedOnce) {
|
|
160
|
-
this.grpcServer.start();
|
|
161
|
-
this.started = true;
|
|
162
|
-
}
|
|
163
|
-
return [2 /*return*/];
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
GrpcServer.prototype.scheduleRefresh = function () {
|
|
169
|
-
var _this = this;
|
|
170
|
-
if (this.scheduledRestart) {
|
|
171
|
-
clearTimeout(this.scheduledRestart);
|
|
172
|
-
}
|
|
173
|
-
var self = this;
|
|
174
|
-
this.scheduledRestart = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
175
|
-
return __generator(this, function (_a) {
|
|
176
|
-
switch (_a.label) {
|
|
177
|
-
case 0:
|
|
178
|
-
index_1.default.Logger.log('Begin refresh');
|
|
179
|
-
return [4 /*yield*/, self.refresh()];
|
|
180
|
-
case 1:
|
|
181
|
-
_a.sent();
|
|
182
|
-
index_1.default.Logger.log('Refresh complete');
|
|
183
|
-
clearTimeout(self.scheduledRestart);
|
|
184
|
-
self.scheduledRestart = undefined;
|
|
185
|
-
self._postponeRequests = 0;
|
|
186
|
-
return [2 /*return*/];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}); }, 2000);
|
|
190
|
-
};
|
|
191
|
-
GrpcServer.prototype.start = function () {
|
|
192
|
-
var _a;
|
|
193
|
-
if (this.started) {
|
|
194
|
-
index_1.default.Logger.error('gRPC server is already running!');
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
else if (!this.started && this.startedOnce) {
|
|
198
|
-
index_1.default.Logger.error('gRPC server is down for refresh!');
|
|
199
|
-
}
|
|
200
|
-
this.started = true;
|
|
201
|
-
this.startedOnce = true;
|
|
202
|
-
(_a = this.grpcServer) === null || _a === void 0 ? void 0 : _a.start();
|
|
203
|
-
};
|
|
204
|
-
return GrpcServer;
|
|
205
|
-
}());
|
|
206
|
-
exports.GrpcServer = GrpcServer;
|
|
207
|
-
//# sourceMappingURL=GrpcServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GrpcServer.js","sourceRoot":"","sources":["../../src/classes/GrpcServer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAiF;AAEjF,iCAA+B;AAC/B,mDAAsC;AAEtC;IAcE,oBAAY,IAAa;QAZjB,YAAO,GAAY,KAAK,CAAC;QACzB,gBAAW,GAAY,KAAK,CAAC;QAC7B,kBAAa,GAAa,EAAE,CAAC;QAE7B,sBAAiB,GAAG,CAAC,CAAC;QAEtB,cAAS,GAIX,EAAE,CAAC;QAGP,IAAI,CAAC,IAAI,GAAG,kBAAW,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM,CAAE,CAAC;IAC1C,CAAC;IAEO,oCAAe,GAAvB;QACE,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,iBAAiB,GAAG,CAAC;YAAE,OAAO;QACjE,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IA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C/D,OAAO;SACR;aAAM,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE;YAC5C,eAAc,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACjE;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;IACH,iBAAC;AAAD,CAAC,AApID,IAoIC;AApIY,gCAAU"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import ConduitGrpcSdk, { ConduitService, SetConfigRequest, SetConfigResponse } from '..';
|
|
2
|
-
import { ConduitServiceModule } from './ConduitServiceModule';
|
|
3
|
-
import convict from 'convict';
|
|
4
|
-
export declare abstract class ManagedModule<T> extends ConduitServiceModule {
|
|
5
|
-
protected abstract readonly configSchema?: object;
|
|
6
|
-
protected abstract readonly metricsSchema?: object;
|
|
7
|
-
readonly config?: convict.Config<T>;
|
|
8
|
-
configOverride: boolean;
|
|
9
|
-
service?: ConduitService;
|
|
10
|
-
protected constructor(moduleName: string);
|
|
11
|
-
get name(): string;
|
|
12
|
-
get address(): string;
|
|
13
|
-
/**
|
|
14
|
-
* This is the first function triggered on module spin up.
|
|
15
|
-
* @param grpcSdk {ConduitGrpcSdk}
|
|
16
|
-
* @param address {string} external address:port of service (LoadBalancer)
|
|
17
|
-
* @param port {string} port to bring up gRPC service
|
|
18
|
-
*/
|
|
19
|
-
initialize(grpcSdk: ConduitGrpcSdk, address: string, port: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* This is triggered before spinning up the Grpc Server
|
|
22
|
-
* of the module. On this stage, the redis bus and state have
|
|
23
|
-
* not yet been initialized, and only communications with Conduit core
|
|
24
|
-
* have been established.
|
|
25
|
-
*/
|
|
26
|
-
preServerStart(): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* This is triggered right after Grpc Server start.
|
|
29
|
-
* At this stage the core module will communicate with your service
|
|
30
|
-
* for health checks, and the Bus and State management mechanics
|
|
31
|
-
* are online and available.
|
|
32
|
-
*/
|
|
33
|
-
onServerStart(): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Triggers right before registering the module with Conduit Core.
|
|
36
|
-
*/
|
|
37
|
-
preRegister(): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Triggers when module has been registered with Conduit Core
|
|
40
|
-
* This is the step where you should initialize your
|
|
41
|
-
* module's general routing (admin or client) and any other operation,
|
|
42
|
-
* that would require other modules being able to reach you
|
|
43
|
-
*/
|
|
44
|
-
onRegister(): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* This is triggered when the module receives new configuration.
|
|
47
|
-
* At this step the configuration has not been checked yet,
|
|
48
|
-
* and has only been parsed.
|
|
49
|
-
* @param config
|
|
50
|
-
*/
|
|
51
|
-
preConfig(config: T): Promise<T>;
|
|
52
|
-
/**
|
|
53
|
-
* This is triggered when new configuration has been applied.
|
|
54
|
-
* This happens either when changes are being made on the configuration,
|
|
55
|
-
* or on module start up, where the config is recovered from the database.
|
|
56
|
-
* In either case the configuration is now available through the
|
|
57
|
-
* Config Controller of the sdk.
|
|
58
|
-
*/
|
|
59
|
-
onConfig(): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Registers common and module-specific metric types.
|
|
62
|
-
*/
|
|
63
|
-
registerMetrics(): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Initializes metric startup values.
|
|
66
|
-
* Implemented by individual modules.
|
|
67
|
-
*/
|
|
68
|
-
initializeMetrics(): Promise<void>;
|
|
69
|
-
createGrpcServer(): Promise<void>;
|
|
70
|
-
startGrpcServer(): Promise<void>;
|
|
71
|
-
setConfig(call: SetConfigRequest, callback: SetConfigResponse): Promise<void>;
|
|
72
|
-
/** Used to update the module's configuration on initial Redis/DB reconciliation. */
|
|
73
|
-
handleConfigSyncUpdate(): Promise<void>;
|
|
74
|
-
}
|