@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.
Files changed (222) 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 +72 -0
  49. package/dist/modules/admin/index.d.ts +5 -5
  50. package/dist/modules/admin/index.js +12 -13
  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 +5 -5
  65. package/dist/modules/router/index.js +10 -11
  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 +85 -107
  80. package/dist/protoUtils/core.js +101 -203
  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 +27 -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/module.d.ts +251 -0
  98. package/dist/protoUtils/module.js +882 -0
  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 -111
  104. package/dist/protoUtils/router.js +100 -310
  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.d.ts +0 -58
  174. package/dist/protoUtils/forms.js +0 -127
  175. package/dist/protoUtils/forms.js.map +0 -1
  176. package/dist/protoUtils/functions.d.ts +0 -58
  177. package/dist/protoUtils/functions.js +0 -127
  178. package/dist/protoUtils/functions.js.map +0 -1
  179. package/dist/routing/ConduitRouteReturn.js.map +0 -1
  180. package/dist/routing/ProxyRouteBuilder.d.ts +0 -21
  181. package/dist/routing/ProxyRouteBuilder.js +0 -81
  182. package/dist/routing/ProxyRouteBuilder.js.map +0 -1
  183. package/dist/routing/RouteBuilder.d.ts +0 -24
  184. package/dist/routing/RouteBuilder.js +0 -107
  185. package/dist/routing/RouteBuilder.js.map +0 -1
  186. package/dist/routing/RoutingManager.d.ts +0 -33
  187. package/dist/routing/RoutingManager.js +0 -201
  188. package/dist/routing/RoutingManager.js.map +0 -1
  189. package/dist/routing/RoutingUtilities.d.ts +0 -7
  190. package/dist/routing/RoutingUtilities.js +0 -13
  191. package/dist/routing/RoutingUtilities.js.map +0 -1
  192. package/dist/routing/index.d.ts +0 -7
  193. package/dist/routing/index.js +0 -24
  194. package/dist/routing/index.js.map +0 -1
  195. package/dist/routing/interfaces/ConduitMiddleware.js.map +0 -1
  196. package/dist/routing/interfaces/ConduitRoute.js.map +0 -1
  197. package/dist/routing/interfaces/ProxyRoute.js.map +0 -1
  198. package/dist/routing/interfaces/Route.d.ts +0 -52
  199. package/dist/routing/interfaces/Route.js +0 -21
  200. package/dist/routing/interfaces/Route.js.map +0 -1
  201. package/dist/routing/interfaces/Socket.js.map +0 -1
  202. package/dist/routing/interfaces/index.d.ts +0 -6
  203. package/dist/routing/interfaces/index.js.map +0 -1
  204. package/dist/routing/wrapRouterFunctions.d.ts +0 -8
  205. package/dist/routing/wrapRouterFunctions.js +0 -132
  206. package/dist/routing/wrapRouterFunctions.js.map +0 -1
  207. package/dist/utilities/Logger.js +0 -255
  208. package/dist/utilities/Logger.js.map +0 -1
  209. package/dist/utilities/linearBackoffTimeout.d.ts +0 -10
  210. package/dist/utilities/linearBackoffTimeout.js +0 -119
  211. package/dist/utilities/linearBackoffTimeout.js.map +0 -1
  212. package/dist/utilities/merge.d.ts +0 -1
  213. package/dist/utilities/merge.js +0 -15
  214. package/dist/utilities/merge.js.map +0 -1
  215. /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.d.ts +0 -0
  216. /package/dist/{routing/interfaces → interfaces}/ConduitMiddleware.js +0 -0
  217. /package/dist/{routing/interfaces → interfaces}/ConduitRoute.js +0 -0
  218. /package/dist/{routing → interfaces}/ConduitRouteReturn.js +0 -0
  219. /package/dist/{routing/interfaces → interfaces}/ProxyRoute.d.ts +0 -0
  220. /package/dist/{routing/interfaces → interfaces}/ProxyRoute.js +0 -0
  221. /package/dist/{routing/interfaces → interfaces}/Socket.js +0 -0
  222. /package/dist/{routing/interfaces → interfaces}/types.js +0 -0
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RouteBuilder = void 0;
4
- var ConduitRouteReturn_1 = require("./ConduitRouteReturn");
5
- var RouteBuilder = /** @class */ (function () {
6
- function RouteBuilder(manager) {
7
- this.manager = manager;
8
- this._options = {};
9
- }
10
- RouteBuilder.prototype.method = function (action) {
11
- this._options.action = action;
12
- return this;
13
- };
14
- RouteBuilder.prototype.name = function (name) {
15
- this._options.name = name;
16
- return this;
17
- };
18
- RouteBuilder.prototype.description = function (description) {
19
- this._options.description = description;
20
- return this;
21
- };
22
- RouteBuilder.prototype.cacheControl = function (cache) {
23
- this._options.cacheControl = cache;
24
- return this;
25
- };
26
- RouteBuilder.prototype.middleware = function (middleware, allowDuplicates) {
27
- var _this = this;
28
- var _a, _b, _c;
29
- if (allowDuplicates === void 0) { allowDuplicates = false; }
30
- if (!Array.isArray(middleware)) {
31
- middleware = [middleware];
32
- }
33
- if (this._options.middlewares !== undefined &&
34
- ((_a = this._options.middlewares) === null || _a === void 0 ? void 0 : _a.length) !== 0) {
35
- if (allowDuplicates) {
36
- this._options.middlewares = (_b = this._options.middlewares) === null || _b === void 0 ? void 0 : _b.concat(middleware);
37
- }
38
- else {
39
- // add to existing middlewares and filter out potential duplicates
40
- this._options.middlewares = (_c = this._options.middlewares) === null || _c === void 0 ? void 0 : _c.concat(middleware.filter(function (mid) { var _a; return ((_a = _this._options.middlewares) === null || _a === void 0 ? void 0 : _a.indexOf(mid)) === -1; }));
41
- }
42
- }
43
- else {
44
- this._options.middlewares = middleware;
45
- }
46
- return this;
47
- };
48
- RouteBuilder.prototype.path = function (path) {
49
- this._options.path = path;
50
- return this;
51
- };
52
- RouteBuilder.prototype.queryParams = function (params) {
53
- this._options.queryParams = params;
54
- return this;
55
- };
56
- RouteBuilder.prototype.urlParams = function (params) {
57
- this._options.urlParams = params;
58
- return this;
59
- };
60
- RouteBuilder.prototype.bodyParams = function (params) {
61
- this._options.bodyParams = params;
62
- return this;
63
- };
64
- RouteBuilder.prototype.return = function (name, fields) {
65
- this._returns = new ConduitRouteReturn_1.ConduitRouteReturnDefinition(name, fields);
66
- return this;
67
- };
68
- RouteBuilder.prototype.handler = function (fn) {
69
- this._handler = fn;
70
- return this;
71
- };
72
- RouteBuilder.prototype.add = function () {
73
- if (!this.manager)
74
- throw new Error('Builder not setup with manager');
75
- if (!this._options)
76
- throw new Error('Cannot build route without options');
77
- if (!this._options.action)
78
- throw new Error('Cannot build route without action');
79
- if (!this._options.path)
80
- throw new Error('Cannot build route without action');
81
- if (!this._returns)
82
- throw new Error('Cannot build route without return');
83
- if (!this._handler)
84
- throw new Error('Cannot build route without handler');
85
- this.manager.route(this._options, this._returns, this._handler);
86
- };
87
- RouteBuilder.prototype.build = function () {
88
- if (!this._options)
89
- throw new Error('Cannot build route without options');
90
- if (!this._options.action)
91
- throw new Error('Cannot build route without action');
92
- if (!this._options.path)
93
- throw new Error('Cannot build route without action');
94
- if (!this._returns)
95
- throw new Error('Cannot build route without return');
96
- if (!this._handler)
97
- throw new Error('Cannot build route without handler');
98
- return {
99
- input: this._options,
100
- returnType: this._returns,
101
- handler: this._handler,
102
- };
103
- };
104
- return RouteBuilder;
105
- }());
106
- exports.RouteBuilder = RouteBuilder;
107
- //# sourceMappingURL=RouteBuilder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RouteBuilder.js","sourceRoot":"","sources":["../../src/routing/RouteBuilder.ts"],"names":[],"mappings":";;;AAAA,2DAAoE;AAWpE;IAKE,sBAA6B,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QACnD,IAAI,CAAC,QAAQ,GAAG,EAAS,CAAC;IAC5B,CAAC;IAED,6BAAM,GAAN,UAAO,MAA2B;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2BAAI,GA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C,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC1E,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,4BAAK,GAAL;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC9E,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC1E,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,UAAU,EAAE,IAAI,CAAC,QAAQ;YACzB,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC;IACJ,CAAC;IACH,mBAAC;AAAD,CAAC,AAvGD,IAuGC;AAvGY,oCAAY"}
@@ -1,33 +0,0 @@
1
- import { GrpcServer, ProxyMiddlewareOptions, ProxyRouteBuilder, ProxyRouteOptions } from '../index';
2
- import { Admin, Router } from '../modules';
3
- import { RouteBuilder } from './RouteBuilder';
4
- import { RequestHandlers } from './wrapRouterFunctions';
5
- import { ConduitRouteReturnDefinition } from './ConduitRouteReturn';
6
- import { ConduitMiddlewareOptions, ConduitRouteOptions, ConduitSocketEventHandler, ConduitSocketOptions, ParsedRouterRequest, UnparsedRouterResponse } from './interfaces';
7
- export declare class RoutingManager {
8
- private readonly _router;
9
- private readonly _server;
10
- private _moduleRoutes;
11
- private _moduleProxyRoutes;
12
- private _routeHandlers;
13
- private readonly isAdmin;
14
- constructor(_router: Router | Admin, _server: GrpcServer);
15
- get(path: string): RouteBuilder;
16
- post(path: string): RouteBuilder;
17
- delete(path: string): RouteBuilder;
18
- update(path: string): RouteBuilder;
19
- patch(path: string): RouteBuilder;
20
- proxy(): ProxyRouteBuilder;
21
- clear(): void;
22
- middleware(input: ConduitMiddlewareOptions, handler: (request: ParsedRouterRequest) => Promise<UnparsedRouterResponse>): void;
23
- route(input: ConduitRouteOptions, type: ConduitRouteReturnDefinition, handler: RequestHandlers): void;
24
- proxyRoute(input: {
25
- options: ProxyRouteOptions;
26
- proxy: ProxyMiddlewareOptions;
27
- }): void;
28
- socket(input: ConduitSocketOptions, events: Record<string, ConduitSocketEventHandler>): void;
29
- registerRoutes(): Promise<any>;
30
- private generateGrpcName;
31
- private extractNameFromPath;
32
- private parseRouteObject;
33
- }
@@ -1,201 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.RoutingManager = void 0;
43
- var index_1 = require("../index");
44
- var modules_1 = require("../modules");
45
- var RouteBuilder_1 = require("./RouteBuilder");
46
- var RoutingUtilities_1 = require("./RoutingUtilities");
47
- var interfaces_1 = require("./interfaces");
48
- var fs_1 = __importDefault(require("fs"));
49
- var path_1 = __importDefault(require("path"));
50
- var RoutingManager = /** @class */ (function () {
51
- function RoutingManager(_router, _server) {
52
- this._router = _router;
53
- this._server = _server;
54
- this._moduleRoutes = {};
55
- this._moduleProxyRoutes = {};
56
- this._routeHandlers = {};
57
- this.isAdmin = false;
58
- if (_router instanceof modules_1.Admin) {
59
- this.isAdmin = true;
60
- }
61
- }
62
- RoutingManager.prototype.get = function (path) {
63
- return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.GET).path(path);
64
- };
65
- RoutingManager.prototype.post = function (path) {
66
- return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.POST).path(path);
67
- };
68
- RoutingManager.prototype.delete = function (path) {
69
- return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.DELETE).path(path);
70
- };
71
- RoutingManager.prototype.update = function (path) {
72
- return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.UPDATE).path(path);
73
- };
74
- RoutingManager.prototype.patch = function (path) {
75
- return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.PATCH).path(path);
76
- };
77
- RoutingManager.prototype.proxy = function () {
78
- return new index_1.ProxyRouteBuilder(this);
79
- };
80
- RoutingManager.prototype.clear = function () {
81
- this._moduleRoutes = {};
82
- this._routeHandlers = {};
83
- this._moduleProxyRoutes = {};
84
- };
85
- RoutingManager.prototype.middleware = function (input, handler) {
86
- var routeObject = this.parseRouteObject({
87
- options: input,
88
- grpcFunction: input.name,
89
- });
90
- this._moduleRoutes[routeObject.grpcFunction] = routeObject;
91
- this._routeHandlers[routeObject.grpcFunction] = handler;
92
- };
93
- RoutingManager.prototype.route = function (input, type, handler) {
94
- var routeObject = this.parseRouteObject({
95
- options: input,
96
- returns: {
97
- name: type.name,
98
- fields: JSON.stringify(type.fields),
99
- },
100
- grpcFunction: this.generateGrpcName(input),
101
- });
102
- this._moduleRoutes[routeObject.grpcFunction] = routeObject;
103
- this._routeHandlers[routeObject.grpcFunction] = handler;
104
- };
105
- RoutingManager.prototype.proxyRoute = function (input) {
106
- var routeObject = this.parseRouteObject({
107
- options: input,
108
- });
109
- this._moduleProxyRoutes[routeObject.options.path + routeObject.proxy.target] =
110
- routeObject;
111
- };
112
- RoutingManager.prototype.socket = function (input, events) {
113
- var _this = this;
114
- var eventsObj = {};
115
- var routeObject = this.parseRouteObject({
116
- options: input,
117
- events: '',
118
- });
119
- var primary;
120
- Object.keys(events).forEach(function (eventName) {
121
- var _a, _b, _c;
122
- if (!primary)
123
- primary = eventName;
124
- var event = events[eventName];
125
- eventsObj[eventName] = {
126
- grpcFunction: eventName,
127
- params: JSON.stringify(event.params),
128
- returns: {
129
- name: (_b = (_a = event.returnType) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
130
- fields: JSON.stringify((_c = event.returnType) === null || _c === void 0 ? void 0 : _c.fields),
131
- },
132
- };
133
- _this._routeHandlers[eventName] = event.handler;
134
- });
135
- routeObject.events = JSON.stringify(eventsObj);
136
- this._moduleRoutes[primary] = routeObject;
137
- };
138
- RoutingManager.prototype.registerRoutes = function () {
139
- return __awaiter(this, void 0, void 0, function () {
140
- var modifiedFunctions, protoDescriptions, protoPath, paths;
141
- return __generator(this, function (_a) {
142
- switch (_a.label) {
143
- case 0:
144
- if (Object.keys(this._routeHandlers).length === 0)
145
- return [2 /*return*/];
146
- modifiedFunctions = (0, RoutingUtilities_1.wrapFunctionsAsync)(this._routeHandlers, this.isAdmin ? 'admin' : 'client');
147
- return [4 /*yield*/, this._router.generateProtoFile(this._router.moduleName, Object.values(this._moduleRoutes))];
148
- case 1:
149
- protoDescriptions = _a.sent();
150
- protoPath = path_1.default.resolve(__dirname, Math.random().toString(36).substring(7));
151
- fs_1.default.writeFileSync(protoPath, protoDescriptions.protoFile);
152
- return [4 /*yield*/, this._server.addService(protoPath, protoDescriptions.formattedModuleName +
153
- (this.isAdmin ? '.admin.Admin' : '.router.Router'), modifiedFunctions)];
154
- case 2:
155
- _a.sent();
156
- paths = Object.values(this._moduleRoutes);
157
- return [2 /*return*/, this._router.register(this.isAdmin
158
- ? paths
159
- : paths, protoDescriptions.protoFile)];
160
- }
161
- });
162
- });
163
- };
164
- RoutingManager.prototype.generateGrpcName = function (options) {
165
- if (options.name) {
166
- return options.name.charAt(0).toUpperCase() + options.name.slice(1);
167
- }
168
- else {
169
- var name_1 = options.action.charAt(0) +
170
- options.action.slice(1).toLowerCase() +
171
- this.extractNameFromPath(options.path);
172
- return name_1.charAt(0).toUpperCase() + name_1.slice(1);
173
- }
174
- };
175
- RoutingManager.prototype.extractNameFromPath = function (path) {
176
- path = path.replace(/[-:]/g, '/');
177
- return path
178
- .split('/')
179
- .map(function (word) { return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); })
180
- .join('');
181
- };
182
- RoutingManager.prototype.parseRouteObject = function (routeObject) {
183
- if (!routeObject.options.middlewares) {
184
- routeObject.options.middlewares = [];
185
- }
186
- for (var option in routeObject.options) {
187
- if (!routeObject.options.hasOwnProperty(option))
188
- continue;
189
- if (option === 'middlewares')
190
- continue;
191
- if (typeof routeObject.options[option] === 'string' ||
192
- routeObject.options[option] instanceof String)
193
- continue;
194
- routeObject.options[option] = JSON.stringify(routeObject.options[option]);
195
- }
196
- return routeObject;
197
- };
198
- return RoutingManager;
199
- }());
200
- exports.RoutingManager = RoutingManager;
201
- //# sourceMappingURL=RoutingManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RoutingManager.js","sourceRoot":"","sources":["../../src/routing/RoutingManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAMkB;AAClB,sCAA2C;AAC3C,+CAA8C;AAG9C,uDAAwD;AAExD,2CAWsB;AAEtB,0CAAoB;AACpB,8CAAwB;AAExB;IAWE,wBACmB,OAAuB,EACvB,OAAmB;QADnB,YAAO,GAAP,OAAO,CAAgB;QACvB,YAAO,GAAP,OAAO,CAAY;QAZ9B,kBAAa,GAEjB,EAAE,CAAC;QACC,uBAAkB,GAA0C,EAAE,CAAC;QAE/D,mBAAc,GAElB,EAAE,CAAC;QACU,YAAO,GAAY,KAAK,CAAC;QAMxC,IAAI,OAAO,YAAY,eAAK,EAAE;YAC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CAAmB,GAA3B,UAA4B,IAAY;QACtC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAClC,OAAO,IAAI;aACR,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAA1D,CAA0D,CAAC;aACvE,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAEO,yCAAgB,GAAxB,UACE,WAAgB;QAEhB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC;SACtC;QACD,KAAK,IAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE;YACxC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;gBAAE,SAAS;YAC1D,IAAI,MAAM,KAAK,aAAa;gBAAE,SAAS;YACvC,IACE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,QAAQ;gBAC/C,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,MAAM;gBAE7C,SAAS;YACX,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;SAC3E;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IACH,qBAAC;AAAD,CAAC,AAhLD,IAgLC;AAhLY,wCAAc"}
@@ -1,7 +0,0 @@
1
- import { RequestHandlers } from './wrapRouterFunctions';
2
- import { Indexable } from '../interfaces';
3
- export declare function wrapFunctionsAsync(functions: {
4
- [name: string]: RequestHandlers;
5
- }, routerType: 'admin' | 'client'): {
6
- [name: string]: (call: Indexable, callback?: Indexable) => void;
7
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapFunctionsAsync = void 0;
4
- var wrapRouterFunctions_1 = require("./wrapRouterFunctions");
5
- function wrapFunctionsAsync(functions, routerType) {
6
- var modifiedFunctions = {};
7
- Object.keys(functions).forEach(function (key) {
8
- modifiedFunctions[key] = (0, wrapRouterFunctions_1.wrapRouterGrpcFunction)(functions[key], routerType);
9
- });
10
- return modifiedFunctions;
11
- }
12
- exports.wrapFunctionsAsync = wrapFunctionsAsync;
13
- //# sourceMappingURL=RoutingUtilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RoutingUtilities.js","sourceRoot":"","sources":["../../src/routing/RoutingUtilities.ts"],"names":[],"mappings":";;;AAAA,6DAAgF;AAGhF,SAAgB,kBAAkB,CAChC,SAA8C,EAC9C,UAA8B;IAI9B,IAAM,iBAAiB,GAEnB,EAAE,CAAC;IACP,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;QAChC,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAA,4CAAsB,EAAC,SAAS,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAbD,gDAaC"}
@@ -1,7 +0,0 @@
1
- export * from './interfaces';
2
- export * from './ConduitRouteReturn';
3
- export * from './RouteBuilder';
4
- export * from './RoutingManager';
5
- export * from './RoutingUtilities';
6
- export * from './wrapRouterFunctions';
7
- export * from './ProxyRouteBuilder';
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./interfaces"), exports);
18
- __exportStar(require("./ConduitRouteReturn"), exports);
19
- __exportStar(require("./RouteBuilder"), exports);
20
- __exportStar(require("./RoutingManager"), exports);
21
- __exportStar(require("./RoutingUtilities"), exports);
22
- __exportStar(require("./wrapRouterFunctions"), exports);
23
- __exportStar(require("./ProxyRouteBuilder"), exports);
24
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,uDAAqC;AACrC,iDAA+B;AAC/B,mDAAiC;AACjC,qDAAmC;AACnC,wDAAsC;AACtC,sDAAoC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConduitMiddleware.js","sourceRoot":"","sources":["../../../src/routing/interfaces/ConduitMiddleware.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConduitRoute.js","sourceRoot":"","sources":["../../../src/routing/interfaces/ConduitRoute.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProxyRoute.js","sourceRoot":"","sources":["../../../src/routing/interfaces/ProxyRoute.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,kCAAa,CAAA;IACb,mCAAc,CAAA;IACd,oCAAe,CAAA;IACf,sCAAiB,CAAA;IACjB,gCAAW,CAAA;AACb,CAAC,EAPW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAO5B"}
@@ -1,52 +0,0 @@
1
- import { ConduitModel, Indexable } from '../../interfaces';
2
- export interface ConduitRouteParameters {
3
- params?: Indexable;
4
- path?: string;
5
- headers: Indexable;
6
- context?: Indexable;
7
- cookies?: Indexable;
8
- bodyParams?: Indexable;
9
- urlParams?: Indexable;
10
- queryParams?: Indexable;
11
- }
12
- export declare enum RouteOptionType {
13
- String = "String",
14
- Number = "Number",
15
- Boolean = "Boolean",
16
- Date = "Date",
17
- ObjectId = "ObjectId",
18
- JSON = "JSON"
19
- }
20
- export interface ConduitRouteOptionExtended {
21
- type: RouteOptionType;
22
- required: boolean;
23
- }
24
- export interface ConduitRouteOption {
25
- [field: string]: string | string[] | ConduitRouteOptionExtended | RouteOptionType | RouteOptionType[];
26
- }
27
- export declare enum ConduitRouteActions {
28
- GET = "GET",
29
- POST = "POST",
30
- UPDATE = "PUT",
31
- PATCH = "PATCH",
32
- DELETE = "DELETE"
33
- }
34
- export interface ConduitRouteOptions {
35
- queryParams?: ConduitRouteOption | ConduitModel;
36
- bodyParams?: ConduitRouteOption | ConduitModel;
37
- urlParams?: ConduitRouteOption | ConduitModel;
38
- action: ConduitRouteActions;
39
- path: string;
40
- name?: string;
41
- description?: string;
42
- middlewares?: string[];
43
- cacheControl?: string;
44
- }
45
- export interface ConduitRouteObject {
46
- options: ConduitRouteOptions;
47
- returns: {
48
- name: string;
49
- fields: string;
50
- };
51
- grpcFunction: string;
52
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConduitRouteActions = exports.RouteOptionType = void 0;
4
- var RouteOptionType;
5
- (function (RouteOptionType) {
6
- RouteOptionType["String"] = "String";
7
- RouteOptionType["Number"] = "Number";
8
- RouteOptionType["Boolean"] = "Boolean";
9
- RouteOptionType["Date"] = "Date";
10
- RouteOptionType["ObjectId"] = "ObjectId";
11
- RouteOptionType["JSON"] = "JSON";
12
- })(RouteOptionType = exports.RouteOptionType || (exports.RouteOptionType = {}));
13
- var ConduitRouteActions;
14
- (function (ConduitRouteActions) {
15
- ConduitRouteActions["GET"] = "GET";
16
- ConduitRouteActions["POST"] = "POST";
17
- ConduitRouteActions["UPDATE"] = "PUT";
18
- ConduitRouteActions["PATCH"] = "PATCH";
19
- ConduitRouteActions["DELETE"] = "DELETE";
20
- })(ConduitRouteActions = exports.ConduitRouteActions || (exports.ConduitRouteActions = {}));
21
- //# sourceMappingURL=Route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../../../src/routing/interfaces/Route.ts"],"names":[],"mappings":";;;AAaA,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,gCAAa,CAAA;IACb,wCAAqB,CAAA;IACrB,gCAAa,CAAA;AACf,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAO1B;AAgBD,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,kCAAW,CAAA;IACX,oCAAa,CAAA;IACb,qCAAc,CAAA;IACd,sCAAe,CAAA;IACf,wCAAiB,CAAA;AACnB,CAAC,EANW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAM9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../../src/routing/interfaces/Socket.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export * from './ConduitMiddleware';
2
- export * from './ConduitRoute';
3
- export * from './Route';
4
- export * from './Socket';
5
- export * from './types';
6
- export * from './ProxyRoute';
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/routing/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,iDAA+B;AAC/B,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,+CAA6B"}
@@ -1,8 +0,0 @@
1
- import { ParsedRouterRequest, ParsedSocketRequest, UnparsedRouterResponse, UnparsedSocketResponse } from './interfaces';
2
- import { Indexable } from '../interfaces';
3
- export declare type RouterRequestHandler = (call: ParsedRouterRequest) => Promise<UnparsedRouterResponse>;
4
- export declare type RouterRequestHandlerCallback = (call: ParsedRouterRequest, callback: (response: UnparsedRouterResponse) => void) => Promise<UnparsedRouterResponse | undefined | void>;
5
- export declare type SocketRequestHandler = (call: ParsedSocketRequest) => Promise<UnparsedSocketResponse>;
6
- export declare type SocketRequestHandlerCallback = (call: ParsedSocketRequest, callback: (response: UnparsedRouterResponse) => void) => Promise<UnparsedSocketResponse | undefined | void>;
7
- export declare type RequestHandlers = RouterRequestHandler | RouterRequestHandlerCallback | SocketRequestHandler | SocketRequestHandlerCallback;
8
- export declare function wrapRouterGrpcFunction(fun: RequestHandlers, routerType: string): (call: Indexable, callback: any) => void;