@conduitplatform/grpc-sdk 0.16.0-alpha.1 → 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.
Files changed (220) hide show
  1. package/README.mdx +1 -7
  2. package/dist/classes/ConduitModule.d.ts +9 -6
  3. package/dist/classes/ConduitModule.js +85 -48
  4. package/dist/classes/ConduitModule.js.map +1 -1
  5. package/dist/classes/ConduitSchema.js.map +1 -1
  6. package/dist/classes/HealthCheck.js +36 -9
  7. package/dist/classes/HealthCheck.js.map +1 -1
  8. package/dist/classes/index.d.ts +2 -6
  9. package/dist/classes/index.js +2 -6
  10. package/dist/classes/index.js.map +1 -1
  11. package/dist/index.d.ts +33 -31
  12. package/dist/index.js +155 -176
  13. package/dist/index.js.map +1 -1
  14. package/dist/interceptors/grpcSignedToken.d.ts +1 -1
  15. package/dist/interceptors/grpcSignedToken.js +2 -2
  16. package/dist/interceptors/moduleName.d.ts +1 -1
  17. package/dist/interceptors/moduleName.js +2 -2
  18. package/dist/interfaces/ConduitMiddleware.js.map +1 -0
  19. package/dist/{routing/interfaces → interfaces}/ConduitRoute.d.ts +2 -3
  20. package/dist/interfaces/ConduitRoute.js.map +1 -0
  21. package/dist/{routing → interfaces}/ConduitRouteReturn.d.ts +3 -3
  22. package/dist/interfaces/ConduitRouteReturn.js.map +1 -0
  23. package/dist/interfaces/ConduitSchemaExtension.d.ts +1 -1
  24. package/dist/interfaces/GrpcCallback.d.ts +1 -1
  25. package/dist/{utilities/Logger.d.ts → interfaces/IConduitLogger.d.ts} +4 -7
  26. package/dist/interfaces/{ConduitService.js → IConduitLogger.js} +1 -1
  27. package/dist/interfaces/IConduitLogger.js.map +1 -0
  28. package/dist/{metrics/index.d.ts → interfaces/IConduitMetrics.d.ts} +5 -11
  29. package/dist/interfaces/IConduitMetrics.js +3 -0
  30. package/dist/interfaces/IConduitMetrics.js.map +1 -0
  31. package/dist/interfaces/Indexable.d.ts +7 -8
  32. package/dist/interfaces/Model.d.ts +63 -13
  33. package/dist/interfaces/Model.js.map +1 -1
  34. package/dist/interfaces/Params.d.ts +3 -3
  35. package/dist/interfaces/ProxyRoute.js.map +1 -0
  36. package/dist/interfaces/RawQuery.d.ts +2 -2
  37. package/dist/interfaces/Route.d.ts +61 -0
  38. package/dist/interfaces/Route.js +12 -0
  39. package/dist/interfaces/Route.js.map +1 -0
  40. package/dist/{routing/interfaces → interfaces}/Socket.d.ts +4 -5
  41. package/dist/interfaces/Socket.js.map +1 -0
  42. package/dist/interfaces/UntypedArray.d.ts +1 -1
  43. package/dist/interfaces/index.d.ts +9 -2
  44. package/dist/interfaces/index.js +9 -2
  45. package/dist/interfaces/index.js.map +1 -1
  46. package/dist/{routing/interfaces → interfaces}/types.d.ts +11 -9
  47. package/dist/{routing/interfaces → interfaces}/types.js.map +1 -1
  48. package/dist/module.proto +14 -0
  49. package/dist/modules/admin/index.d.ts +5 -4
  50. package/dist/modules/admin/index.js +12 -5
  51. package/dist/modules/admin/index.js.map +1 -1
  52. package/dist/modules/authorization/index.d.ts +3 -2
  53. package/dist/modules/authorization/index.js +4 -4
  54. package/dist/modules/authorization/index.js.map +1 -1
  55. package/dist/modules/config/index.d.ts +5 -5
  56. package/dist/modules/config/index.js +38 -28
  57. package/dist/modules/config/index.js.map +1 -1
  58. package/dist/modules/database/index.d.ts +6 -5
  59. package/dist/modules/database/index.js +15 -15
  60. package/dist/modules/database/index.js.map +1 -1
  61. package/dist/modules/index.d.ts +0 -2
  62. package/dist/modules/index.js +0 -2
  63. package/dist/modules/index.js.map +1 -1
  64. package/dist/modules/router/index.d.ts +4 -3
  65. package/dist/modules/router/index.js +9 -2
  66. package/dist/modules/router/index.js.map +1 -1
  67. package/dist/modules/storage/index.d.ts +6 -2
  68. package/dist/modules/storage/index.js +22 -2
  69. package/dist/modules/storage/index.js.map +1 -1
  70. package/dist/protoUtils/authentication.d.ts +3 -48
  71. package/dist/protoUtils/authentication.js +1 -110
  72. package/dist/protoUtils/authentication.js.map +1 -1
  73. package/dist/protoUtils/authorization.d.ts +28 -82
  74. package/dist/protoUtils/authorization.js +10 -156
  75. package/dist/protoUtils/authorization.js.map +1 -1
  76. package/dist/protoUtils/chat.d.ts +7 -61
  77. package/dist/protoUtils/chat.js +3 -149
  78. package/dist/protoUtils/chat.js.map +1 -1
  79. package/dist/protoUtils/core.d.ts +115 -90
  80. package/dist/protoUtils/core.js +110 -48
  81. package/dist/protoUtils/core.js.map +1 -1
  82. package/dist/protoUtils/database.d.ts +7 -17
  83. package/dist/protoUtils/database.js +3 -41
  84. package/dist/protoUtils/database.js.map +1 -1
  85. package/dist/protoUtils/email.d.ts +3 -48
  86. package/dist/protoUtils/email.js +1 -110
  87. package/dist/protoUtils/email.js.map +1 -1
  88. package/dist/protoUtils/google/protobuf/empty.d.ts +25 -0
  89. package/dist/protoUtils/google/protobuf/empty.js +47 -0
  90. package/dist/protoUtils/google/protobuf/empty.js.map +1 -0
  91. package/dist/protoUtils/grpc_health_check.d.ts +3 -4
  92. package/dist/protoUtils/grpc_health_check.js +1 -2
  93. package/dist/protoUtils/grpc_health_check.js.map +1 -1
  94. package/dist/protoUtils/index.d.ts +12 -0
  95. package/dist/{routing/interfaces → protoUtils}/index.js +12 -6
  96. package/dist/protoUtils/index.js.map +1 -0
  97. package/dist/protoUtils/{forms.d.ts → module.d.ts} +6 -7
  98. package/dist/protoUtils/{forms.js → module.js} +5 -6
  99. package/dist/protoUtils/module.js.map +1 -0
  100. package/dist/protoUtils/push-notifications.d.ts +3 -48
  101. package/dist/protoUtils/push-notifications.js +1 -110
  102. package/dist/protoUtils/push-notifications.js.map +1 -1
  103. package/dist/protoUtils/router.d.ts +45 -64
  104. package/dist/protoUtils/router.js +110 -156
  105. package/dist/protoUtils/router.js.map +1 -1
  106. package/dist/protoUtils/sms.d.ts +3 -48
  107. package/dist/protoUtils/sms.js +1 -110
  108. package/dist/protoUtils/sms.js.map +1 -1
  109. package/dist/protoUtils/storage.d.ts +134 -62
  110. package/dist/protoUtils/storage.js +433 -170
  111. package/dist/protoUtils/storage.js.map +1 -1
  112. package/dist/types/db.d.ts +11 -11
  113. package/dist/types/index.d.ts +3 -10
  114. package/dist/types/index.js +15 -0
  115. package/dist/types/index.js.map +1 -1
  116. package/dist/utilities/RedisManager.js.map +1 -1
  117. package/dist/utilities/env.d.ts +1 -0
  118. package/dist/utilities/env.js +37 -0
  119. package/dist/utilities/env.js.map +1 -0
  120. package/dist/utilities/index.d.ts +4 -2
  121. package/dist/utilities/index.js +4 -2
  122. package/dist/utilities/index.js.map +1 -1
  123. package/package.json +24 -25
  124. package/dist/classes/ConduitActiveSchema.d.ts +0 -19
  125. package/dist/classes/ConduitActiveSchema.js +0 -57
  126. package/dist/classes/ConduitActiveSchema.js.map +0 -1
  127. package/dist/classes/ConduitServiceModule.d.ts +0 -26
  128. package/dist/classes/ConduitServiceModule.js +0 -166
  129. package/dist/classes/ConduitServiceModule.js.map +0 -1
  130. package/dist/classes/ConfigController.d.ts +0 -7
  131. package/dist/classes/ConfigController.js +0 -27
  132. package/dist/classes/ConfigController.js.map +0 -1
  133. package/dist/classes/GrpcServer.d.ts +0 -22
  134. package/dist/classes/GrpcServer.js +0 -207
  135. package/dist/classes/GrpcServer.js.map +0 -1
  136. package/dist/classes/ManagedModule.d.ts +0 -74
  137. package/dist/classes/ManagedModule.js +0 -333
  138. package/dist/classes/ManagedModule.js.map +0 -1
  139. package/dist/classes/ModuleManager.d.ts +0 -11
  140. package/dist/classes/ModuleManager.js +0 -205
  141. package/dist/classes/ModuleManager.js.map +0 -1
  142. package/dist/helpers/GrpcHelper.d.ts +0 -8
  143. package/dist/helpers/GrpcHelper.js +0 -43
  144. package/dist/helpers/GrpcHelper.js.map +0 -1
  145. package/dist/helpers/TypeHelpers.d.ts +0 -44
  146. package/dist/helpers/TypeHelpers.js +0 -144
  147. package/dist/helpers/TypeHelpers.js.map +0 -1
  148. package/dist/helpers/index.d.ts +0 -3
  149. package/dist/helpers/index.js +0 -20
  150. package/dist/helpers/index.js.map +0 -1
  151. package/dist/helpers/wrapGrpcFunctions.d.ts +0 -5
  152. package/dist/helpers/wrapGrpcFunctions.js +0 -56
  153. package/dist/helpers/wrapGrpcFunctions.js.map +0 -1
  154. package/dist/interfaces/ConduitService.d.ts +0 -8
  155. package/dist/interfaces/ConduitService.js.map +0 -1
  156. package/dist/metrics/MetricsServer.d.ts +0 -9
  157. package/dist/metrics/MetricsServer.js +0 -94
  158. package/dist/metrics/MetricsServer.js.map +0 -1
  159. package/dist/metrics/clientMiddleware.d.ts +0 -2
  160. package/dist/metrics/clientMiddleware.js +0 -265
  161. package/dist/metrics/clientMiddleware.js.map +0 -1
  162. package/dist/metrics/config/defaults.d.ts +0 -91
  163. package/dist/metrics/config/defaults.js +0 -93
  164. package/dist/metrics/config/defaults.js.map +0 -1
  165. package/dist/metrics/index.js +0 -152
  166. package/dist/metrics/index.js.map +0 -1
  167. package/dist/modules/forms/index.d.ts +0 -6
  168. package/dist/modules/forms/index.js +0 -32
  169. package/dist/modules/forms/index.js.map +0 -1
  170. package/dist/modules/functions/index.d.ts +0 -6
  171. package/dist/modules/functions/index.js +0 -32
  172. package/dist/modules/functions/index.js.map +0 -1
  173. package/dist/protoUtils/forms.js.map +0 -1
  174. package/dist/protoUtils/functions.d.ts +0 -58
  175. package/dist/protoUtils/functions.js +0 -127
  176. package/dist/protoUtils/functions.js.map +0 -1
  177. package/dist/routing/ConduitRouteReturn.js.map +0 -1
  178. package/dist/routing/ProxyRouteBuilder.d.ts +0 -21
  179. package/dist/routing/ProxyRouteBuilder.js +0 -81
  180. package/dist/routing/ProxyRouteBuilder.js.map +0 -1
  181. package/dist/routing/RouteBuilder.d.ts +0 -24
  182. package/dist/routing/RouteBuilder.js +0 -107
  183. package/dist/routing/RouteBuilder.js.map +0 -1
  184. package/dist/routing/RoutingManager.d.ts +0 -33
  185. package/dist/routing/RoutingManager.js +0 -201
  186. package/dist/routing/RoutingManager.js.map +0 -1
  187. package/dist/routing/RoutingUtilities.d.ts +0 -7
  188. package/dist/routing/RoutingUtilities.js +0 -13
  189. package/dist/routing/RoutingUtilities.js.map +0 -1
  190. package/dist/routing/index.d.ts +0 -7
  191. package/dist/routing/index.js +0 -24
  192. package/dist/routing/index.js.map +0 -1
  193. package/dist/routing/interfaces/ConduitMiddleware.js.map +0 -1
  194. package/dist/routing/interfaces/ConduitRoute.js.map +0 -1
  195. package/dist/routing/interfaces/ProxyRoute.js.map +0 -1
  196. package/dist/routing/interfaces/Route.d.ts +0 -52
  197. package/dist/routing/interfaces/Route.js +0 -21
  198. package/dist/routing/interfaces/Route.js.map +0 -1
  199. package/dist/routing/interfaces/Socket.js.map +0 -1
  200. package/dist/routing/interfaces/index.d.ts +0 -6
  201. package/dist/routing/interfaces/index.js.map +0 -1
  202. package/dist/routing/wrapRouterFunctions.d.ts +0 -8
  203. package/dist/routing/wrapRouterFunctions.js +0 -132
  204. package/dist/routing/wrapRouterFunctions.js.map +0 -1
  205. package/dist/utilities/Logger.js +0 -255
  206. package/dist/utilities/Logger.js.map +0 -1
  207. package/dist/utilities/linearBackoffTimeout.d.ts +0 -10
  208. package/dist/utilities/linearBackoffTimeout.js +0 -119
  209. package/dist/utilities/linearBackoffTimeout.js.map +0 -1
  210. package/dist/utilities/merge.d.ts +0 -1
  211. package/dist/utilities/merge.js +0 -15
  212. package/dist/utilities/merge.js.map +0 -1
  213. /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.d.ts +0 -0
  214. /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.js +0 -0
  215. /package/dist/{routing/interfaces → interfaces}/ConduitRoute.js +0 -0
  216. /package/dist/{routing → interfaces}/ConduitRouteReturn.js +0 -0
  217. /package/dist/{routing/interfaces → interfaces}/ProxyRoute.d.ts +0 -0
  218. /package/dist/{routing/interfaces → interfaces}/ProxyRoute.js +0 -0
  219. /package/dist/{routing/interfaces → interfaces}/Socket.js +0 -0
  220. /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 registration & discovery
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
- initializeClient(type: T): Client<T>;
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/grpc_health_check").HealthCheckResponse_ServingStatus>;
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.active = true;
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, _a;
128
- var _b;
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 (_c) {
133
- switch (_c.label) {
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 = (_b = this.type) === null || _b === void 0 ? void 0 : _b.name;
166
+ serviceName = (_d = this.type) === null || _d === void 0 ? void 0 : _d.name;
137
167
  this.healthCheckEmitter.setMaxListeners(150);
138
- _c.label = 1;
168
+ _f.label = 1;
139
169
  case 1:
140
- _c.trys.push([1, 14, , 15]);
170
+ _f.trys.push([1, 14, , 15]);
141
171
  call = this.healthClient.watch({ service: service });
142
- _c.label = 2;
172
+ _f.label = 2;
143
173
  case 2:
144
- _c.trys.push([2, 7, 8, 13]);
145
- call_1 = __asyncValues(call);
146
- _c.label = 3;
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 = _c.sent(), !call_1_1.done)) return [3 /*break*/, 6];
150
- data = call_1_1.value;
151
- self.healthCheckEmitter.emit("grpc-health-change:".concat(serviceName), data.status);
152
- _c.label = 5;
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 = _c.sent();
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
- _c.trys.push([8, , 11, 12]);
161
- if (!(call_1_1 && !call_1_1.done && (_a = call_1.return))) return [3 /*break*/, 10];
162
- return [4 /*yield*/, _a.call(call_1)];
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
- _c.sent();
165
- _c.label = 10;
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 = _c.sent();
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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C,KAAK,CAAC,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;;;;mCAC1B,SAAA,cAAA,IAAI,CAAA;;;;;wBAAJ,oBAAI;wBAAJ,WAAI;;4BAAZ,IAAI,KAAA,CAAA;4BACnB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,6BAAsB,WAAW,CAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOpF;IACH,oBAAC;AAAD,CAAC,AAjHD,IAiHC;AAjHY,sCAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"ConduitSchema.js","sourceRoot":"","sources":["../../src/classes/ConduitSchema.ts"],"names":[],"mappings":";;;AAEA;IAOE,uBACE,IAAY,EACZ,MAAoB,EACpB,YAAmC,EACnC,cAAuB;QANzB,gBAAW,GAAW,SAAS,CAAC;QAQ9B,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,AAlBD,IAkBC;AAlBY,sCAAa"}
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 clientMiddleware_1 = require("../metrics/clientMiddleware");
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
- return __generator(this, function (_a) {
49
- switch (_a.label) {
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
- .use((0, clientMiddleware_1.clientMiddleware)())
57
- .use(grpcToken
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 = _a.sent();
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":";;;;;;;;;;;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
@@ -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';
@@ -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,wDAAsC;AACtC,+CAA6B;AAC7B,yDAAuC;AACvC,kDAAgC;AAChC,kDAAgC;AAChC,qDAAmC;AACnC,8DAA4C"}
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, Forms, Functions, PushNotifications, Router, SMS, Storage } from './modules';
2
- import { EventBus } from './utilities/EventBus';
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/ConduitModule';
4
+ import { ConduitModule } from './classes';
7
5
  import { Client } from 'nice-grpc';
8
- import { HealthDefinition } from './protoUtils/grpc_health_check';
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 readonly urlRemap?;
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 name;
29
- private readonly instance;
25
+ private readonly urlRemap?;
30
26
  private readonly _serviceHealthStatusGetter;
31
27
  private readonly _grpcToken?;
32
28
  private _initialized;
33
- static Metrics?: ConduitMetrics;
34
- static readonly Logger: ConduitLogger;
35
- constructor(serverUrl: string, serviceHealthStatusGetter?: () => HealthCheckStatus, name?: string, watchModules?: boolean, urlRemap?: string | undefined);
36
- initialize(): Promise<void>;
37
- private _initialize;
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 functions(): Functions | null;
55
- get redisDetails(): RedisOptions | {
56
- nodes: {
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
- get grpcToken(): string | undefined;
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';