@conduitplatform/grpc-sdk 0.16.0-alpha.3 → 0.16.0-alpha.5
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/ConduitModule.d.ts +5 -5
- package/dist/classes/ConduitModule.js +45 -24
- package/dist/classes/ConduitModule.js.map +1 -1
- package/dist/classes/ConduitSchema.js.map +1 -1
- package/dist/classes/HealthCheck.js +35 -8
- 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 +27 -26
- package/dist/index.js +119 -119
- package/dist/index.js.map +1 -1
- 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 +1 -1
- package/dist/interfaces/ConduitRouteReturn.js.map +1 -0
- package/dist/interfaces/ConduitSchemaExtension.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 +0 -1
- package/dist/interfaces/ProxyRoute.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/Route.d.ts +2 -1
- package/dist/interfaces/Route.js.map +1 -0
- package/dist/{routing/interfaces → interfaces}/Socket.d.ts +3 -4
- package/dist/interfaces/Socket.js.map +1 -0
- package/dist/interfaces/index.d.ts +9 -2
- package/dist/interfaces/index.js +9 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/{routing/interfaces → interfaces}/types.d.ts +5 -3
- package/dist/{routing/interfaces → interfaces}/types.js.map +1 -1
- package/dist/modules/admin/index.d.ts +2 -2
- package/dist/modules/admin/index.js +2 -2
- package/dist/modules/admin/index.js.map +1 -1
- package/dist/modules/config/index.d.ts +3 -3
- package/dist/modules/config/index.js +6 -3
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/database/index.d.ts +5 -4
- package/dist/modules/database/index.js +15 -15
- package/dist/modules/database/index.js.map +1 -1
- package/dist/modules/router/index.d.ts +2 -2
- package/dist/modules/router/index.js +2 -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/storage.d.ts +131 -6
- package/dist/protoUtils/storage.js +486 -50
- package/dist/protoUtils/storage.js.map +1 -1
- package/dist/types/index.d.ts +1 -2
- 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/index.d.ts +3 -2
- package/dist/utilities/index.js +3 -2
- package/dist/utilities/index.js.map +1 -1
- package/package.json +5 -15
- 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 -204
- package/dist/classes/ModuleManager.js.map +0 -1
- package/dist/helpers/GrpcHelper.d.ts +0 -8
- package/dist/helpers/GrpcHelper.js +0 -43
- 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 -91
- package/dist/metrics/config/defaults.js +0 -93
- 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/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.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 +0 -23
- package/dist/routing/interfaces/index.js.map +0 -1
- package/dist/routing/wrapRouterFunctions.d.ts +0 -8
- package/dist/routing/wrapRouterFunctions.js +0 -132
- 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}/Route.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/Socket.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/types.js +0 -0
|
@@ -8,19 +8,19 @@ export declare class ConduitModule<T extends CompatServiceDefinition> {
|
|
|
8
8
|
private readonly _serviceName;
|
|
9
9
|
private readonly _serviceUrl;
|
|
10
10
|
private readonly _grpcToken?;
|
|
11
|
-
active: boolean;
|
|
12
|
-
private _client?;
|
|
13
|
-
private _healthClient?;
|
|
14
11
|
protected channel?: Channel;
|
|
15
12
|
protected protoPath?: string;
|
|
16
13
|
protected type?: T;
|
|
17
14
|
protected readonly healthCheckEmitter: EventEmitter;
|
|
18
15
|
constructor(_clientName: string, _serviceName: string, _serviceUrl: string, _grpcToken?: string | undefined);
|
|
19
|
-
|
|
20
|
-
openConnection(): void;
|
|
16
|
+
private _client?;
|
|
21
17
|
get client(): Client<T> | undefined;
|
|
18
|
+
private _healthClient?;
|
|
22
19
|
get healthClient(): Client<typeof HealthDefinition> | undefined;
|
|
20
|
+
get active(): boolean;
|
|
23
21
|
get healthCheckWatcher(): EventEmitter;
|
|
22
|
+
initializeClient(type: T): Client<T>;
|
|
23
|
+
openConnection(): void;
|
|
24
24
|
closeConnection(): void;
|
|
25
25
|
check(service?: string): Promise<import("../protoUtils/grpc_health_check").HealthCheckResponse_ServingStatus>;
|
|
26
26
|
watch(service?: string): Promise<void>;
|
|
@@ -55,9 +55,40 @@ var ConduitModule = /** @class */ (function () {
|
|
|
55
55
|
this._serviceName = _serviceName;
|
|
56
56
|
this._serviceUrl = _serviceUrl;
|
|
57
57
|
this._grpcToken = _grpcToken;
|
|
58
|
-
this.active = false;
|
|
59
58
|
this.healthCheckEmitter = new events_1.EventEmitter();
|
|
60
59
|
}
|
|
60
|
+
Object.defineProperty(ConduitModule.prototype, "client", {
|
|
61
|
+
get: function () {
|
|
62
|
+
return this._client;
|
|
63
|
+
},
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(ConduitModule.prototype, "healthClient", {
|
|
68
|
+
get: function () {
|
|
69
|
+
return this._healthClient;
|
|
70
|
+
},
|
|
71
|
+
enumerable: false,
|
|
72
|
+
configurable: true
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(ConduitModule.prototype, "active", {
|
|
75
|
+
get: function () {
|
|
76
|
+
if (!this.channel) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
var connectivityState = this.channel.getConnectivityState(true);
|
|
80
|
+
return connectivityState === 2 || connectivityState === 1 || connectivityState === 0;
|
|
81
|
+
},
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(ConduitModule.prototype, "healthCheckWatcher", {
|
|
86
|
+
get: function () {
|
|
87
|
+
return this.healthCheckEmitter;
|
|
88
|
+
},
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
61
92
|
ConduitModule.prototype.initializeClient = function (type) {
|
|
62
93
|
if (this._client)
|
|
63
94
|
return this._client;
|
|
@@ -66,6 +97,9 @@ var ConduitModule = /** @class */ (function () {
|
|
|
66
97
|
return this._client;
|
|
67
98
|
};
|
|
68
99
|
ConduitModule.prototype.openConnection = function () {
|
|
100
|
+
var _this = this;
|
|
101
|
+
if (this.channel)
|
|
102
|
+
return;
|
|
69
103
|
// ConduitGrpcSdk.Logger.log(`Opening connection for ${this._serviceName}`);
|
|
70
104
|
this.channel = (0, nice_grpc_1.createChannel)(this._serviceUrl, undefined, {
|
|
71
105
|
'grpc.max_receive_message_length': 1024 * 1024 * 100,
|
|
@@ -86,36 +120,23 @@ var ConduitModule = /** @class */ (function () {
|
|
|
86
120
|
},
|
|
87
121
|
});
|
|
88
122
|
this._healthClient = clientFactory.create(grpc_health_check_1.HealthDefinition, this.channel);
|
|
89
|
-
|
|
123
|
+
var monitorChannel = function () {
|
|
124
|
+
if (!_this.channel)
|
|
125
|
+
return;
|
|
126
|
+
try {
|
|
127
|
+
var state = _this.channel.getConnectivityState(true);
|
|
128
|
+
_this.channel.watchConnectivityState(state, Infinity, monitorChannel);
|
|
129
|
+
}
|
|
130
|
+
catch (e) { }
|
|
131
|
+
};
|
|
132
|
+
monitorChannel();
|
|
90
133
|
};
|
|
91
|
-
Object.defineProperty(ConduitModule.prototype, "client", {
|
|
92
|
-
get: function () {
|
|
93
|
-
return this._client;
|
|
94
|
-
},
|
|
95
|
-
enumerable: false,
|
|
96
|
-
configurable: true
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(ConduitModule.prototype, "healthClient", {
|
|
99
|
-
get: function () {
|
|
100
|
-
return this._healthClient;
|
|
101
|
-
},
|
|
102
|
-
enumerable: false,
|
|
103
|
-
configurable: true
|
|
104
|
-
});
|
|
105
|
-
Object.defineProperty(ConduitModule.prototype, "healthCheckWatcher", {
|
|
106
|
-
get: function () {
|
|
107
|
-
return this.healthCheckEmitter;
|
|
108
|
-
},
|
|
109
|
-
enumerable: false,
|
|
110
|
-
configurable: true
|
|
111
|
-
});
|
|
112
134
|
ConduitModule.prototype.closeConnection = function () {
|
|
113
135
|
if (!this.channel)
|
|
114
136
|
return;
|
|
115
137
|
// ConduitGrpcSdk.Logger.warn(`Closing connection for ${this._serviceName}`);
|
|
116
138
|
this.channel.close();
|
|
117
139
|
this.channel = undefined;
|
|
118
|
-
this.active = false;
|
|
119
140
|
};
|
|
120
141
|
ConduitModule.prototype.check = function (service) {
|
|
121
142
|
if (service === void 0) { service = ''; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConduitModule.js","sourceRoot":"","sources":["../../src/classes/ConduitModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAE1F,uCAAgF;AAChF,uFAAoE;AACpE,qEAAwF;AACxF,iCAAsC;AAEtC;
|
|
1
|
+
{"version":3,"file":"ConduitModule.js","sourceRoot":"","sources":["../../src/classes/ConduitModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAE1F,uCAAgF;AAChF,uFAAoE;AACpE,qEAAwF;AACxF,iCAAsC;AAEtC;IAME,uBACW,WAAmB,EACX,YAAoB,EACpB,WAAmB,EACnB,UAAmB;QAH3B,gB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BAAA,EAAA,YAAoB;QACxB,OAAO,IAAI,CAAC,YAAa,CAAC,KAAK,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC,IAAI,CAAC,UAAC,GAAwB;YACzE,OAAO,GAAG,CAAC,MAAM,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;IAEK,6BAAK,GAAX,UAAY,OAAoB;;;QAApB,wBAAA,EAAA,YAAoB;;;;;;wBACxB,IAAI,GAAG,IAAI,CAAC;wBACZ,WAAW,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAC;wBACpC,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;;;;wBAErC,IAAI,GAAG,IAAI,CAAC,YAAa,CAAC,KAAK,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;;;;wBAC1B,SAAA,cAAA,IAAI,CAAA;;;;;wBAAZ,IAAI,iBAAA,CAAA;wBACnB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,6BAAsB,WAAW,CAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOpF;IACH,oBAAC;AAAD,CAAC,AA1GD,IA0GC;AA1GY,sCAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConduitSchema.js","sourceRoot":"","sources":["../../src/classes/ConduitSchema.ts"],"names":[],"mappings":";;;AAEA;
|
|
1
|
+
{"version":3,"file":"ConduitSchema.js","sourceRoot":"","sources":["../../src/classes/ConduitSchema.ts"],"names":[],"mappings":";;;AAEA;IAQE,uBACE,IAAY,EACZ,MAAoB,EACpB,YAAmC,EACnC,cAAuB;QAPzB,gBAAW,GAAW,SAAS,CAAC;QAS9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,cAAc,IAAI,cAAc,KAAK,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,CAAC;IACH,oBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,sCAAa"}
|
|
@@ -35,26 +35,53 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
38
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
53
|
exports.checkModuleHealth = void 0;
|
|
40
54
|
var interceptors_1 = require("../interceptors");
|
|
41
55
|
var nice_grpc_1 = require("nice-grpc");
|
|
42
56
|
var grpc_health_check_1 = require("../protoUtils/grpc_health_check");
|
|
43
|
-
var
|
|
57
|
+
var index_1 = __importDefault(require("../index"));
|
|
44
58
|
function checkModuleHealth(clientName, serviceUrl, service, grpcToken) {
|
|
45
59
|
if (service === void 0) { service = ''; }
|
|
46
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var channel, clientFactory, _healthClient, error, status;
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
var channel, clientFactory, _a, _b, interceptor, _healthClient, error, status;
|
|
62
|
+
var e_1, _c;
|
|
63
|
+
return __generator(this, function (_d) {
|
|
64
|
+
switch (_d.label) {
|
|
50
65
|
case 0:
|
|
51
66
|
channel = (0, nice_grpc_1.createChannel)(serviceUrl, undefined, {
|
|
52
67
|
'grpc.max_receive_message_length': 1024 * 1024 * 100,
|
|
53
68
|
'grpc.max_send_message_length': 1024 * 1024 * 100,
|
|
54
69
|
});
|
|
55
|
-
clientFactory = (0, nice_grpc_1.createClientFactory)()
|
|
56
|
-
|
|
57
|
-
.
|
|
70
|
+
clientFactory = (0, nice_grpc_1.createClientFactory)();
|
|
71
|
+
try {
|
|
72
|
+
for (_a = __values(index_1.default.interceptors), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
73
|
+
interceptor = _b.value;
|
|
74
|
+
clientFactory.use(interceptor);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
78
|
+
finally {
|
|
79
|
+
try {
|
|
80
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
81
|
+
}
|
|
82
|
+
finally { if (e_1) throw e_1.error; }
|
|
83
|
+
}
|
|
84
|
+
clientFactory.use(grpcToken
|
|
58
85
|
? (0, interceptors_1.getGrpcSignedTokenInterceptor)(grpcToken)
|
|
59
86
|
: (0, interceptors_1.getModuleNameInterceptor)(clientName));
|
|
60
87
|
_healthClient = clientFactory.create(grpc_health_check_1.HealthDefinition, channel);
|
|
@@ -65,7 +92,7 @@ function checkModuleHealth(clientName, serviceUrl, service, grpcToken) {
|
|
|
65
92
|
})
|
|
66
93
|
.catch(function (err) { return (error = err); })];
|
|
67
94
|
case 1:
|
|
68
|
-
status =
|
|
95
|
+
status = _d.sent();
|
|
69
96
|
channel.close();
|
|
70
97
|
if (!error) {
|
|
71
98
|
return [2 /*return*/, status];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthCheck.js","sourceRoot":"","sources":["../../src/classes/HealthCheck.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HealthCheck.js","sourceRoot":"","sources":["../../src/classes/HealthCheck.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0F;AAC1F,uCAA+D;AAC/D,qEAAwF;AACxF,mDAAsC;AAEtC,SAAsB,iBAAiB,CACrC,UAAkB,EAClB,UAAkB,EAClB,OAAoB,EACpB,SAAkB;IADlB,wBAAA,EAAA,YAAoB;;;;;;;oBAGd,OAAO,GAAG,IAAA,yBAAa,EAAC,UAAU,EAAE,SAAS,EAAE;wBACnD,iCAAiC,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;wBACpD,8BAA8B,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;qBAClD,CAAC,CAAC;oBACG,aAAa,GAAG,IAAA,+BAAmB,GAAE,CAAC;;wBAC5C,KAA0B,KAAA,SAAA,eAAc,CAAC,YAAY,CAAA,4CAAE;4BAA5C,WAAW;4BACpB,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;yBAChC;;;;;;;;;oBACD,aAAa,CAAC,GAAG,CACf,SAAS;wBACP,CAAC,CAAC,IAAA,4CAA6B,EAAC,SAAS,CAAC;wBAC1C,CAAC,CAAC,IAAA,uCAAwB,EAAC,UAAU,CAAC,CACzC,CAAC;oBACI,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,oCAAgB,EAAE,OAAO,CAAC,CAAC;oBAGvD,qBAAM,aAAa;6BAC/B,KAAK,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC;6BAClB,IAAI,CAAC,UAAC,GAAwB;4BAC7B,OAAO,GAAG,CAAC,MAAM,CAAC;wBACpB,CAAC,CAAC;6BACD,KAAK,CAAC,UAAA,GAAG,IAAI,OAAA,CAAC,KAAK,GAAG,GAAG,CAAC,EAAb,CAAa,CAAC,EAAA;;oBALxB,MAAM,GAAG,SAKe;oBAC9B,OAAO,CAAC,KAAK,EAAE,CAAC;oBAChB,IAAI,CAAC,KAAK,EAAE;wBACV,sBAAO,MAAM,EAAC;qBACf;oBACD,MAAM,KAAK,CAAC;;;;CACb;AAjCD,8CAiCC"}
|
package/dist/classes/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
export * from './Error';
|
|
2
|
+
export * from './ConduitModule';
|
|
3
|
+
export * from './HealthCheck';
|
|
2
4
|
export * from './ConduitSchema';
|
|
3
|
-
export * from './ConduitActiveSchema';
|
|
4
|
-
export * from './GrpcServer';
|
|
5
|
-
export * from './ConduitServiceModule';
|
|
6
|
-
export * from './ManagedModule';
|
|
7
|
-
export * from './ModuleManager';
|
|
8
|
-
export * from './ConfigController';
|
|
9
5
|
export * from './ConduitAuthorizedResource';
|
package/dist/classes/index.js
CHANGED
|
@@ -15,12 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./Error"), exports);
|
|
18
|
+
__exportStar(require("./ConduitModule"), exports);
|
|
19
|
+
__exportStar(require("./HealthCheck"), exports);
|
|
18
20
|
__exportStar(require("./ConduitSchema"), exports);
|
|
19
|
-
__exportStar(require("./ConduitActiveSchema"), exports);
|
|
20
|
-
__exportStar(require("./GrpcServer"), exports);
|
|
21
|
-
__exportStar(require("./ConduitServiceModule"), exports);
|
|
22
|
-
__exportStar(require("./ManagedModule"), exports);
|
|
23
|
-
__exportStar(require("./ModuleManager"), exports);
|
|
24
|
-
__exportStar(require("./ConfigController"), exports);
|
|
25
21
|
__exportStar(require("./ConduitAuthorizedResource"), exports);
|
|
26
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,kDAAgC;AAChC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,kDAAgC;AAChC,gDAA8B;AAC9B,kDAAgC;AAChC,8DAA4C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,48 @@
|
|
|
1
1
|
import { Admin, Authentication, Authorization, Chat, Config, Core, DatabaseProvider, Email, Forms, Functions, PushNotifications, Router, SMS, Storage } from './modules';
|
|
2
|
-
import { EventBus } from './utilities
|
|
3
|
-
import { RedisManager } from './utilities/RedisManager';
|
|
4
|
-
import { StateManager } from './utilities/StateManager';
|
|
2
|
+
import { EventBus, RedisManager, StateManager } from './utilities';
|
|
5
3
|
import { CompatServiceDefinition } from 'nice-grpc/lib/service-definitions';
|
|
6
|
-
import { ConduitModule } from './classes
|
|
4
|
+
import { ConduitModule } from './classes';
|
|
7
5
|
import { Client } from 'nice-grpc';
|
|
8
6
|
import { HealthDefinition } from './protoUtils/grpc_health_check';
|
|
9
7
|
import { HealthCheckStatus } from './types';
|
|
10
|
-
import { ConduitLogger } from './utilities/Logger';
|
|
11
|
-
import { ConduitMetrics } from './metrics';
|
|
12
8
|
import { ClusterOptions, RedisOptions } from 'ioredis';
|
|
9
|
+
import { IConduitLogger, IConduitMetrics } from './interfaces';
|
|
13
10
|
export default class ConduitGrpcSdk {
|
|
11
|
+
private static middleware;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly instance: string;
|
|
14
14
|
private readonly serverUrl;
|
|
15
15
|
private readonly _watchModules;
|
|
16
16
|
private readonly _core?;
|
|
17
17
|
private readonly _config?;
|
|
18
18
|
private readonly _admin?;
|
|
19
|
-
private _redisManager;
|
|
20
|
-
private _redisDetails?;
|
|
21
19
|
private readonly _modules;
|
|
22
20
|
private readonly _availableModules;
|
|
23
21
|
private _dynamicModules;
|
|
24
22
|
private _eventBus?;
|
|
25
23
|
private _stateManager?;
|
|
26
24
|
private lastSearch;
|
|
27
|
-
private readonly name;
|
|
28
|
-
private readonly instance;
|
|
29
25
|
private readonly urlRemap?;
|
|
30
26
|
private readonly _serviceHealthStatusGetter;
|
|
31
27
|
private readonly _grpcToken?;
|
|
32
28
|
private _initialized;
|
|
33
|
-
|
|
29
|
+
constructor(serverUrl: string, name?: string, watchModules?: boolean, logger?: IConduitLogger, serviceHealthStatusGetter?: () => HealthCheckStatus);
|
|
34
30
|
private static _Logger;
|
|
35
|
-
static get Logger():
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
static get Logger(): IConduitLogger | Console;
|
|
32
|
+
private static _Metrics;
|
|
33
|
+
static get Metrics(): IConduitMetrics | undefined;
|
|
34
|
+
static set Metrics(metrics: IConduitMetrics | undefined);
|
|
35
|
+
static get interceptors(): any[];
|
|
36
|
+
private _redisManager;
|
|
37
|
+
get redisManager(): RedisManager;
|
|
38
|
+
private _redisDetails?;
|
|
39
|
+
get redisDetails(): RedisOptions | {
|
|
40
|
+
nodes: {
|
|
41
|
+
host: string;
|
|
42
|
+
port: number;
|
|
43
|
+
}[];
|
|
44
|
+
options: ClusterOptions;
|
|
45
|
+
};
|
|
39
46
|
get bus(): EventBus | null;
|
|
40
47
|
get state(): StateManager | null;
|
|
41
48
|
get core(): Core;
|
|
@@ -53,18 +60,13 @@ export default class ConduitGrpcSdk {
|
|
|
53
60
|
get sms(): SMS | null;
|
|
54
61
|
get chat(): Chat | null;
|
|
55
62
|
get functions(): Functions | null;
|
|
56
|
-
get
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
port: number;
|
|
60
|
-
}[];
|
|
61
|
-
options: ClusterOptions;
|
|
62
|
-
};
|
|
63
|
+
get grpcToken(): string | undefined;
|
|
64
|
+
addMiddleware(middleware: any): void;
|
|
65
|
+
initialize(): Promise<void>;
|
|
63
66
|
watchModules(): void;
|
|
64
67
|
monitorModule(moduleName: string, callback: (serving: boolean) => void, wait?: boolean): void;
|
|
65
68
|
unmonitorModule(moduleName: string): void;
|
|
66
69
|
initializeEventBus(): Promise<EventBus>;
|
|
67
|
-
get redisManager(): RedisManager;
|
|
68
70
|
/**
|
|
69
71
|
* Gets all the registered modules from the config and creates clients for them.
|
|
70
72
|
* This will only work on known modules, since the primary usage for the sdk is internal
|
|
@@ -85,13 +87,12 @@ export default class ConduitGrpcSdk {
|
|
|
85
87
|
* @param force If true will check for new modules no matter the interval
|
|
86
88
|
*/
|
|
87
89
|
refreshModules(force?: boolean): Promise<string | void>;
|
|
88
|
-
|
|
90
|
+
private _initialize;
|
|
89
91
|
}
|
|
90
92
|
export * from './interfaces';
|
|
91
93
|
export * from './classes';
|
|
92
94
|
export * from './modules';
|
|
93
|
-
export * from './helpers';
|
|
94
95
|
export * from './constants';
|
|
95
|
-
export * from './routing';
|
|
96
96
|
export * from './types';
|
|
97
97
|
export * from './utilities';
|
|
98
|
+
export * from '@grpc/grpc-js';
|