@conduitplatform/grpc-sdk 0.16.0-alpha.1 → 0.16.0-alpha.11
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 +63 -13
- package/dist/interfaces/Model.js.map +1 -1
- package/dist/interfaces/Params.d.ts +3 -3
- 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 -1
- 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 +11 -9
- package/dist/{routing/interfaces → interfaces}/types.js.map +1 -1
- package/dist/module.proto +72 -0
- package/dist/modules/admin/index.d.ts +5 -5
- package/dist/modules/admin/index.js +12 -13
- 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 +38 -28
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/database/index.d.ts +6 -5
- package/dist/modules/database/index.js +15 -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 +5 -5
- package/dist/modules/router/index.js +10 -11
- 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 +1 -110
- package/dist/protoUtils/authentication.js.map +1 -1
- package/dist/protoUtils/authorization.d.ts +28 -82
- package/dist/protoUtils/authorization.js +10 -156
- package/dist/protoUtils/authorization.js.map +1 -1
- package/dist/protoUtils/chat.d.ts +7 -61
- package/dist/protoUtils/chat.js +3 -149
- package/dist/protoUtils/chat.js.map +1 -1
- package/dist/protoUtils/core.d.ts +85 -107
- package/dist/protoUtils/core.js +101 -203
- package/dist/protoUtils/core.js.map +1 -1
- package/dist/protoUtils/database.d.ts +7 -17
- package/dist/protoUtils/database.js +3 -41
- package/dist/protoUtils/database.js.map +1 -1
- package/dist/protoUtils/email.d.ts +3 -48
- package/dist/protoUtils/email.js +1 -110
- package/dist/protoUtils/email.js.map +1 -1
- package/dist/protoUtils/google/protobuf/empty.d.ts +27 -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 +1 -2
- 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/module.d.ts +251 -0
- package/dist/protoUtils/module.js +882 -0
- package/dist/protoUtils/module.js.map +1 -0
- package/dist/protoUtils/push-notifications.d.ts +3 -48
- package/dist/protoUtils/push-notifications.js +1 -110
- package/dist/protoUtils/push-notifications.js.map +1 -1
- package/dist/protoUtils/router.d.ts +45 -111
- package/dist/protoUtils/router.js +100 -310
- package/dist/protoUtils/router.js.map +1 -1
- package/dist/protoUtils/sms.d.ts +3 -48
- package/dist/protoUtils/sms.js +1 -110
- package/dist/protoUtils/sms.js.map +1 -1
- package/dist/protoUtils/storage.d.ts +134 -62
- package/dist/protoUtils/storage.js +433 -170
- 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 -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/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.d.ts +0 -58
- package/dist/protoUtils/forms.js +0 -127
- package/dist/protoUtils/forms.js.map +0 -1
- package/dist/protoUtils/functions.d.ts +0 -58
- package/dist/protoUtils/functions.js +0 -127
- 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 -52
- 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 -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}/Socket.js +0 -0
- /package/dist/{routing/interfaces → interfaces}/types.js +0 -0
package/README.mdx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Conduit gRPC SDK
|
|
2
2
|
|
|
3
3
|
This library provides a framework to bind all Conduit modules in a safe and consistent way.<br />
|
|
4
|
-
It is also used to provide syntactic sugar that makes development easier.
|
|
5
4
|
|
|
6
5
|
## Build Steps
|
|
7
6
|
|
|
@@ -10,12 +9,7 @@ It is also used to provide syntactic sugar that makes development easier.
|
|
|
10
9
|
|
|
11
10
|
## Features ✔️
|
|
12
11
|
|
|
13
|
-
- Service
|
|
14
|
-
- Application route registration
|
|
15
|
-
- Administrative route registration
|
|
12
|
+
- Service discovery
|
|
16
13
|
- Provides wrappers for gRPC handlers to support async
|
|
17
|
-
- Parses incoming requests and outgoing responses to JSON
|
|
18
14
|
- Provides health check service out of the box
|
|
19
|
-
- Manages the gRPC server so you don't have to
|
|
20
15
|
- Provides typings for common Conduit models
|
|
21
|
-
- Provides classes to facilitate building your own Conduit modules
|
|
@@ -3,25 +3,28 @@ import { CompatServiceDefinition } from 'nice-grpc/lib/service-definitions';
|
|
|
3
3
|
import { Channel, Client } from 'nice-grpc';
|
|
4
4
|
import { HealthDefinition } from '../protoUtils/grpc_health_check';
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
|
+
import { ConduitModuleDefinition } from '../protoUtils';
|
|
6
7
|
export declare class ConduitModule<T extends CompatServiceDefinition> {
|
|
7
8
|
readonly _clientName: string;
|
|
8
9
|
private readonly _serviceName;
|
|
9
10
|
private readonly _serviceUrl;
|
|
10
11
|
private readonly _grpcToken?;
|
|
11
|
-
active: boolean;
|
|
12
|
-
private _client?;
|
|
13
|
-
private _healthClient?;
|
|
14
12
|
protected channel?: Channel;
|
|
15
13
|
protected protoPath?: string;
|
|
16
14
|
protected type?: T;
|
|
17
15
|
protected readonly healthCheckEmitter: EventEmitter;
|
|
18
16
|
constructor(_clientName: string, _serviceName: string, _serviceUrl: string, _grpcToken?: string | undefined);
|
|
19
|
-
|
|
20
|
-
openConnection(): void;
|
|
17
|
+
private _client?;
|
|
21
18
|
get client(): Client<T> | undefined;
|
|
19
|
+
private _healthClient?;
|
|
22
20
|
get healthClient(): Client<typeof HealthDefinition> | undefined;
|
|
21
|
+
private _moduleClient?;
|
|
22
|
+
get moduleClient(): Client<typeof ConduitModuleDefinition> | undefined;
|
|
23
|
+
get active(): boolean;
|
|
23
24
|
get healthCheckWatcher(): EventEmitter;
|
|
25
|
+
initializeClient(type: T): Client<T>;
|
|
26
|
+
openConnection(): void;
|
|
24
27
|
closeConnection(): void;
|
|
25
|
-
check(service?: string): Promise<import("../protoUtils
|
|
28
|
+
check(service?: string): Promise<import("../protoUtils").HealthCheckResponse_ServingStatus>;
|
|
26
29
|
watch(service?: string): Promise<void>;
|
|
27
30
|
}
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -49,15 +49,54 @@ var nice_grpc_1 = require("nice-grpc");
|
|
|
49
49
|
var nice_grpc_client_middleware_retry_1 = require("nice-grpc-client-middleware-retry");
|
|
50
50
|
var grpc_health_check_1 = require("../protoUtils/grpc_health_check");
|
|
51
51
|
var events_1 = require("events");
|
|
52
|
+
var protoUtils_1 = require("../protoUtils");
|
|
52
53
|
var ConduitModule = /** @class */ (function () {
|
|
53
54
|
function ConduitModule(_clientName, _serviceName, _serviceUrl, _grpcToken) {
|
|
54
55
|
this._clientName = _clientName;
|
|
55
56
|
this._serviceName = _serviceName;
|
|
56
57
|
this._serviceUrl = _serviceUrl;
|
|
57
58
|
this._grpcToken = _grpcToken;
|
|
58
|
-
this.active = false;
|
|
59
59
|
this.healthCheckEmitter = new events_1.EventEmitter();
|
|
60
60
|
}
|
|
61
|
+
Object.defineProperty(ConduitModule.prototype, "client", {
|
|
62
|
+
get: function () {
|
|
63
|
+
return this._client;
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(ConduitModule.prototype, "healthClient", {
|
|
69
|
+
get: function () {
|
|
70
|
+
return this._healthClient;
|
|
71
|
+
},
|
|
72
|
+
enumerable: false,
|
|
73
|
+
configurable: true
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(ConduitModule.prototype, "moduleClient", {
|
|
76
|
+
get: function () {
|
|
77
|
+
return this._moduleClient;
|
|
78
|
+
},
|
|
79
|
+
enumerable: false,
|
|
80
|
+
configurable: true
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(ConduitModule.prototype, "active", {
|
|
83
|
+
get: function () {
|
|
84
|
+
if (!this.channel) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
var connectivityState = this.channel.getConnectivityState(true);
|
|
88
|
+
return connectivityState === 2 || connectivityState === 1 || connectivityState === 0;
|
|
89
|
+
},
|
|
90
|
+
enumerable: false,
|
|
91
|
+
configurable: true
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(ConduitModule.prototype, "healthCheckWatcher", {
|
|
94
|
+
get: function () {
|
|
95
|
+
return this.healthCheckEmitter;
|
|
96
|
+
},
|
|
97
|
+
enumerable: false,
|
|
98
|
+
configurable: true
|
|
99
|
+
});
|
|
61
100
|
ConduitModule.prototype.initializeClient = function (type) {
|
|
62
101
|
if (this._client)
|
|
63
102
|
return this._client;
|
|
@@ -66,6 +105,9 @@ var ConduitModule = /** @class */ (function () {
|
|
|
66
105
|
return this._client;
|
|
67
106
|
};
|
|
68
107
|
ConduitModule.prototype.openConnection = function () {
|
|
108
|
+
var _this = this;
|
|
109
|
+
if (this.channel)
|
|
110
|
+
return;
|
|
69
111
|
// ConduitGrpcSdk.Logger.log(`Opening connection for ${this._serviceName}`);
|
|
70
112
|
this.channel = (0, nice_grpc_1.createChannel)(this._serviceUrl, undefined, {
|
|
71
113
|
'grpc.max_receive_message_length': 1024 * 1024 * 100,
|
|
@@ -86,36 +128,24 @@ var ConduitModule = /** @class */ (function () {
|
|
|
86
128
|
},
|
|
87
129
|
});
|
|
88
130
|
this._healthClient = clientFactory.create(grpc_health_check_1.HealthDefinition, this.channel);
|
|
89
|
-
this.
|
|
131
|
+
this._moduleClient = clientFactory.create(protoUtils_1.ConduitModuleDefinition, this.channel);
|
|
132
|
+
var monitorChannel = function () {
|
|
133
|
+
if (!_this.channel)
|
|
134
|
+
return;
|
|
135
|
+
try {
|
|
136
|
+
var state = _this.channel.getConnectivityState(true);
|
|
137
|
+
_this.channel.watchConnectivityState(state, Infinity, monitorChannel);
|
|
138
|
+
}
|
|
139
|
+
catch (e) { }
|
|
140
|
+
};
|
|
141
|
+
monitorChannel();
|
|
90
142
|
};
|
|
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
143
|
ConduitModule.prototype.closeConnection = function () {
|
|
113
144
|
if (!this.channel)
|
|
114
145
|
return;
|
|
115
146
|
// ConduitGrpcSdk.Logger.warn(`Closing connection for ${this._serviceName}`);
|
|
116
147
|
this.channel.close();
|
|
117
148
|
this.channel = undefined;
|
|
118
|
-
this.active = false;
|
|
119
149
|
};
|
|
120
150
|
ConduitModule.prototype.check = function (service) {
|
|
121
151
|
if (service === void 0) { service = ''; }
|
|
@@ -124,45 +154,52 @@ var ConduitModule = /** @class */ (function () {
|
|
|
124
154
|
});
|
|
125
155
|
};
|
|
126
156
|
ConduitModule.prototype.watch = function (service) {
|
|
127
|
-
var e_1,
|
|
128
|
-
var
|
|
157
|
+
var _a, e_1, _b, _c;
|
|
158
|
+
var _d;
|
|
129
159
|
if (service === void 0) { service = ''; }
|
|
130
160
|
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
-
var self, serviceName, call, call_1, call_1_1, data, e_1_1, error_1;
|
|
132
|
-
return __generator(this, function (
|
|
133
|
-
switch (
|
|
161
|
+
var self, serviceName, call, _e, call_1, call_1_1, data, e_1_1, error_1;
|
|
162
|
+
return __generator(this, function (_f) {
|
|
163
|
+
switch (_f.label) {
|
|
134
164
|
case 0:
|
|
135
165
|
self = this;
|
|
136
|
-
serviceName = (
|
|
166
|
+
serviceName = (_d = this.type) === null || _d === void 0 ? void 0 : _d.name;
|
|
137
167
|
this.healthCheckEmitter.setMaxListeners(150);
|
|
138
|
-
|
|
168
|
+
_f.label = 1;
|
|
139
169
|
case 1:
|
|
140
|
-
|
|
170
|
+
_f.trys.push([1, 14, , 15]);
|
|
141
171
|
call = this.healthClient.watch({ service: service });
|
|
142
|
-
|
|
172
|
+
_f.label = 2;
|
|
143
173
|
case 2:
|
|
144
|
-
|
|
145
|
-
call_1 = __asyncValues(call);
|
|
146
|
-
|
|
174
|
+
_f.trys.push([2, 7, 8, 13]);
|
|
175
|
+
_e = true, call_1 = __asyncValues(call);
|
|
176
|
+
_f.label = 3;
|
|
147
177
|
case 3: return [4 /*yield*/, call_1.next()];
|
|
148
178
|
case 4:
|
|
149
|
-
if (!(call_1_1 =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
179
|
+
if (!(call_1_1 = _f.sent(), _a = call_1_1.done, !_a)) return [3 /*break*/, 6];
|
|
180
|
+
_c = call_1_1.value;
|
|
181
|
+
_e = false;
|
|
182
|
+
try {
|
|
183
|
+
data = _c;
|
|
184
|
+
self.healthCheckEmitter.emit("grpc-health-change:".concat(serviceName), data.status);
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
_e = true;
|
|
188
|
+
}
|
|
189
|
+
_f.label = 5;
|
|
153
190
|
case 5: return [3 /*break*/, 3];
|
|
154
191
|
case 6: return [3 /*break*/, 13];
|
|
155
192
|
case 7:
|
|
156
|
-
e_1_1 =
|
|
193
|
+
e_1_1 = _f.sent();
|
|
157
194
|
e_1 = { error: e_1_1 };
|
|
158
195
|
return [3 /*break*/, 13];
|
|
159
196
|
case 8:
|
|
160
|
-
|
|
161
|
-
if (!(
|
|
162
|
-
return [4 /*yield*/,
|
|
197
|
+
_f.trys.push([8, , 11, 12]);
|
|
198
|
+
if (!(!_e && !_a && (_b = call_1.return))) return [3 /*break*/, 10];
|
|
199
|
+
return [4 /*yield*/, _b.call(call_1)];
|
|
163
200
|
case 9:
|
|
164
|
-
|
|
165
|
-
|
|
201
|
+
_f.sent();
|
|
202
|
+
_f.label = 10;
|
|
166
203
|
case 10: return [3 /*break*/, 12];
|
|
167
204
|
case 11:
|
|
168
205
|
if (e_1) throw e_1.error;
|
|
@@ -170,7 +207,7 @@ var ConduitModule = /** @class */ (function () {
|
|
|
170
207
|
case 12: return [7 /*endfinally*/];
|
|
171
208
|
case 13: return [3 /*break*/, 15];
|
|
172
209
|
case 14:
|
|
173
|
-
error_1 =
|
|
210
|
+
error_1 = _f.sent();
|
|
174
211
|
return [3 /*break*/, 15];
|
|
175
212
|
case 15: return [2 /*return*/];
|
|
176
213
|
}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"ConduitModule.js","sourceRoot":"","sources":["../../src/classes/ConduitModule.ts"],"names":[],"mappings":"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"}
|
|
@@ -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"}
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
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
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -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,40 +1,48 @@
|
|
|
1
|
-
import { Admin, Authentication, Authorization, Chat, Config, Core, DatabaseProvider, Email,
|
|
2
|
-
import { EventBus } from './utilities
|
|
3
|
-
import { RedisManager } from './utilities/RedisManager';
|
|
4
|
-
import { StateManager } from './utilities/StateManager';
|
|
1
|
+
import { Admin, Authentication, Authorization, Chat, Config, Core, DatabaseProvider, Email, PushNotifications, Router, SMS, Storage } from './modules';
|
|
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
|
-
import { HealthDefinition } from './protoUtils
|
|
6
|
+
import { ConduitModuleDefinition, HealthDefinition } from './protoUtils';
|
|
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 {
|
|
14
|
-
private
|
|
11
|
+
private static middleware;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly instance: string;
|
|
15
14
|
private readonly serverUrl;
|
|
16
15
|
private readonly _watchModules;
|
|
17
16
|
private readonly _core?;
|
|
18
17
|
private readonly _config?;
|
|
19
18
|
private readonly _admin?;
|
|
20
|
-
private _redisManager;
|
|
21
|
-
private _redisDetails?;
|
|
22
19
|
private readonly _modules;
|
|
23
20
|
private readonly _availableModules;
|
|
24
21
|
private _dynamicModules;
|
|
25
22
|
private _eventBus?;
|
|
26
23
|
private _stateManager?;
|
|
27
24
|
private lastSearch;
|
|
28
|
-
private readonly
|
|
29
|
-
private readonly instance;
|
|
25
|
+
private readonly urlRemap?;
|
|
30
26
|
private readonly _serviceHealthStatusGetter;
|
|
31
27
|
private readonly _grpcToken?;
|
|
32
28
|
private _initialized;
|
|
33
|
-
|
|
34
|
-
static
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
constructor(serverUrl: string, name?: string, watchModules?: boolean, logger?: IConduitLogger, serviceHealthStatusGetter?: () => HealthCheckStatus);
|
|
30
|
+
private static _Logger;
|
|
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
|
+
};
|
|
38
46
|
get bus(): EventBus | null;
|
|
39
47
|
get state(): StateManager | null;
|
|
40
48
|
get core(): Core;
|
|
@@ -44,26 +52,19 @@ export default class ConduitGrpcSdk {
|
|
|
44
52
|
get database(): DatabaseProvider | null;
|
|
45
53
|
get databaseProvider(): DatabaseProvider | null;
|
|
46
54
|
get storage(): Storage | null;
|
|
47
|
-
get forms(): Forms | null;
|
|
48
55
|
get emailProvider(): Email | null;
|
|
49
56
|
get pushNotifications(): PushNotifications | null;
|
|
50
57
|
get authentication(): Authentication | null;
|
|
51
58
|
get authorization(): Authorization | null;
|
|
52
59
|
get sms(): SMS | null;
|
|
53
60
|
get chat(): Chat | null;
|
|
54
|
-
get
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
host: string;
|
|
58
|
-
port: number;
|
|
59
|
-
}[];
|
|
60
|
-
options: ClusterOptions;
|
|
61
|
-
};
|
|
61
|
+
get grpcToken(): string | undefined;
|
|
62
|
+
addMiddleware(middleware: any): void;
|
|
63
|
+
initialize(): Promise<void>;
|
|
62
64
|
watchModules(): void;
|
|
63
65
|
monitorModule(moduleName: string, callback: (serving: boolean) => void, wait?: boolean): void;
|
|
64
66
|
unmonitorModule(moduleName: string): void;
|
|
65
67
|
initializeEventBus(): Promise<EventBus>;
|
|
66
|
-
get redisManager(): RedisManager;
|
|
67
68
|
/**
|
|
68
69
|
* Gets all the registered modules from the config and creates clients for them.
|
|
69
70
|
* This will only work on known modules, since the primary usage for the sdk is internal
|
|
@@ -74,6 +75,7 @@ export default class ConduitGrpcSdk {
|
|
|
74
75
|
moduleClient(name: string, type: CompatServiceDefinition): void;
|
|
75
76
|
getModule<T extends CompatServiceDefinition>(name: string): ConduitModule<T> | undefined;
|
|
76
77
|
getServiceClient<T extends CompatServiceDefinition>(name: string): Client<T> | undefined;
|
|
78
|
+
getModuleClient(name: string): Client<ConduitModuleDefinition> | undefined;
|
|
77
79
|
getHealthClient<T extends CompatServiceDefinition>(name: string): Client<typeof HealthDefinition> | undefined;
|
|
78
80
|
isAvailable(moduleName: string): boolean;
|
|
79
81
|
waitForExistence(moduleName: string): Promise<boolean>;
|
|
@@ -84,13 +86,13 @@ export default class ConduitGrpcSdk {
|
|
|
84
86
|
* @param force If true will check for new modules no matter the interval
|
|
85
87
|
*/
|
|
86
88
|
refreshModules(force?: boolean): Promise<string | void>;
|
|
87
|
-
|
|
89
|
+
private _initialize;
|
|
88
90
|
}
|
|
89
91
|
export * from './interfaces';
|
|
90
92
|
export * from './classes';
|
|
91
93
|
export * from './modules';
|
|
92
|
-
export * from './helpers';
|
|
93
94
|
export * from './constants';
|
|
94
|
-
export * from './routing';
|
|
95
95
|
export * from './types';
|
|
96
96
|
export * from './utilities';
|
|
97
|
+
export * from './protoUtils';
|
|
98
|
+
export * from '@grpc/grpc-js';
|