@conduitplatform/grpc-sdk 0.13.0-rc0

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 (206) hide show
  1. package/README.md +20 -0
  2. package/dist/classes/ConduitActiveSchema.d.ts +19 -0
  3. package/dist/classes/ConduitActiveSchema.js +57 -0
  4. package/dist/classes/ConduitActiveSchema.js.map +1 -0
  5. package/dist/classes/ConduitMiddleware.d.ts +8 -0
  6. package/dist/classes/ConduitMiddleware.js +26 -0
  7. package/dist/classes/ConduitMiddleware.js.map +1 -0
  8. package/dist/classes/ConduitModule.d.ts +26 -0
  9. package/dist/classes/ConduitModule.js +170 -0
  10. package/dist/classes/ConduitModule.js.map +1 -0
  11. package/dist/classes/ConduitParser.d.ts +20 -0
  12. package/dist/classes/ConduitParser.js +84 -0
  13. package/dist/classes/ConduitParser.js.map +1 -0
  14. package/dist/classes/ConduitRoute.d.ts +12 -0
  15. package/dist/classes/ConduitRoute.js +44 -0
  16. package/dist/classes/ConduitRoute.js.map +1 -0
  17. package/dist/classes/ConduitRouteReturn.d.ts +48 -0
  18. package/dist/classes/ConduitRouteReturn.js +66 -0
  19. package/dist/classes/ConduitRouteReturn.js.map +1 -0
  20. package/dist/classes/ConduitSchema.d.ts +10 -0
  21. package/dist/classes/ConduitSchema.js +22 -0
  22. package/dist/classes/ConduitSchema.js.map +1 -0
  23. package/dist/classes/ConduitSchemaExtension.d.ts +7 -0
  24. package/dist/classes/ConduitSchemaExtension.js +19 -0
  25. package/dist/classes/ConduitSchemaExtension.js.map +1 -0
  26. package/dist/classes/ConduitServiceModule.d.ts +25 -0
  27. package/dist/classes/ConduitServiceModule.js +139 -0
  28. package/dist/classes/ConduitServiceModule.js.map +1 -0
  29. package/dist/classes/ConduitSocket.d.ts +9 -0
  30. package/dist/classes/ConduitSocket.js +27 -0
  31. package/dist/classes/ConduitSocket.js.map +1 -0
  32. package/dist/classes/ConfigController.d.ts +7 -0
  33. package/dist/classes/ConfigController.js +27 -0
  34. package/dist/classes/ConfigController.js.map +1 -0
  35. package/dist/classes/Error.d.ts +11 -0
  36. package/dist/classes/Error.js +51 -0
  37. package/dist/classes/Error.js.map +1 -0
  38. package/dist/classes/GrpcServer.d.ts +19 -0
  39. package/dist/classes/GrpcServer.js +185 -0
  40. package/dist/classes/GrpcServer.js.map +1 -0
  41. package/dist/classes/ManagedModule.d.ts +20 -0
  42. package/dist/classes/ManagedModule.js +212 -0
  43. package/dist/classes/ManagedModule.js.map +1 -0
  44. package/dist/classes/ModuleManager.d.ts +11 -0
  45. package/dist/classes/ModuleManager.js +191 -0
  46. package/dist/classes/ModuleManager.js.map +1 -0
  47. package/dist/classes/Routing/RouteBuilder.d.ts +28 -0
  48. package/dist/classes/Routing/RouteBuilder.js +107 -0
  49. package/dist/classes/Routing/RouteBuilder.js.map +1 -0
  50. package/dist/classes/Routing/RoutingManager.d.ts +25 -0
  51. package/dist/classes/Routing/RoutingManager.js +193 -0
  52. package/dist/classes/Routing/RoutingManager.js.map +1 -0
  53. package/dist/classes/index.d.ts +16 -0
  54. package/dist/classes/index.js +29 -0
  55. package/dist/classes/index.js.map +1 -0
  56. package/dist/constants/enums/PlatformTypesEnum.d.ts +9 -0
  57. package/dist/constants/enums/PlatformTypesEnum.js +14 -0
  58. package/dist/constants/enums/PlatformTypesEnum.js.map +1 -0
  59. package/dist/constants/enums/index.d.ts +1 -0
  60. package/dist/constants/enums/index.js +14 -0
  61. package/dist/constants/enums/index.js.map +1 -0
  62. package/dist/constants/index.d.ts +1 -0
  63. package/dist/constants/index.js +14 -0
  64. package/dist/constants/index.js.map +1 -0
  65. package/dist/helpers/GrpcHelper.d.ts +8 -0
  66. package/dist/helpers/GrpcHelper.js +44 -0
  67. package/dist/helpers/GrpcHelper.js.map +1 -0
  68. package/dist/helpers/RoutingJsonConstructor.d.ts +9 -0
  69. package/dist/helpers/RoutingJsonConstructor.js +89 -0
  70. package/dist/helpers/RoutingJsonConstructor.js.map +1 -0
  71. package/dist/helpers/RoutingUtilities.d.ts +13 -0
  72. package/dist/helpers/RoutingUtilities.js +69 -0
  73. package/dist/helpers/RoutingUtilities.js.map +1 -0
  74. package/dist/helpers/TypeHelpers.d.ts +44 -0
  75. package/dist/helpers/TypeHelpers.js +144 -0
  76. package/dist/helpers/TypeHelpers.js.map +1 -0
  77. package/dist/helpers/index.d.ts +5 -0
  78. package/dist/helpers/index.js +18 -0
  79. package/dist/helpers/index.js.map +1 -0
  80. package/dist/helpers/wrapGrpcFunctions.d.ts +5 -0
  81. package/dist/helpers/wrapGrpcFunctions.js +37 -0
  82. package/dist/helpers/wrapGrpcFunctions.js.map +1 -0
  83. package/dist/helpers/wrapRouterFunctions.d.ts +7 -0
  84. package/dist/helpers/wrapRouterFunctions.js +111 -0
  85. package/dist/helpers/wrapRouterFunctions.js.map +1 -0
  86. package/dist/index.d.ts +70 -0
  87. package/dist/index.js +481 -0
  88. package/dist/index.js.map +1 -0
  89. package/dist/interceptors/grpcSignedToken.d.ts +2 -0
  90. package/dist/interceptors/grpcSignedToken.js +88 -0
  91. package/dist/interceptors/grpcSignedToken.js.map +1 -0
  92. package/dist/interceptors/index.d.ts +2 -0
  93. package/dist/interceptors/index.js +15 -0
  94. package/dist/interceptors/index.js.map +1 -0
  95. package/dist/interceptors/moduleName.d.ts +2 -0
  96. package/dist/interceptors/moduleName.js +88 -0
  97. package/dist/interceptors/moduleName.js.map +1 -0
  98. package/dist/interfaces/ConduitService.d.ts +8 -0
  99. package/dist/interfaces/ConduitService.js +3 -0
  100. package/dist/interfaces/ConduitService.js.map +1 -0
  101. package/dist/interfaces/GrpcCallback.d.ts +4 -0
  102. package/dist/interfaces/GrpcCallback.js +3 -0
  103. package/dist/interfaces/GrpcCallback.js.map +1 -0
  104. package/dist/interfaces/Indexable.d.ts +9 -0
  105. package/dist/interfaces/Indexable.js +3 -0
  106. package/dist/interfaces/Indexable.js.map +1 -0
  107. package/dist/interfaces/Middleware.d.ts +7 -0
  108. package/dist/interfaces/Middleware.js +3 -0
  109. package/dist/interfaces/Middleware.js.map +1 -0
  110. package/dist/interfaces/Model.d.ts +37 -0
  111. package/dist/interfaces/Model.js +19 -0
  112. package/dist/interfaces/Model.js.map +1 -0
  113. package/dist/interfaces/Route.d.ts +54 -0
  114. package/dist/interfaces/Route.js +21 -0
  115. package/dist/interfaces/Route.js.map +1 -0
  116. package/dist/interfaces/Socket.d.ts +34 -0
  117. package/dist/interfaces/Socket.js +9 -0
  118. package/dist/interfaces/Socket.js.map +1 -0
  119. package/dist/interfaces/index.d.ts +7 -0
  120. package/dist/interfaces/index.js +20 -0
  121. package/dist/interfaces/index.js.map +1 -0
  122. package/dist/modules/admin/index.d.ts +13 -0
  123. package/dist/modules/admin/index.js +131 -0
  124. package/dist/modules/admin/index.js.map +1 -0
  125. package/dist/modules/authentication/index.d.ts +11 -0
  126. package/dist/modules/authentication/index.js +50 -0
  127. package/dist/modules/authentication/index.js.map +1 -0
  128. package/dist/modules/chat/index.d.ts +10 -0
  129. package/dist/modules/chat/index.js +46 -0
  130. package/dist/modules/chat/index.js.map +1 -0
  131. package/dist/modules/config/index.d.ts +25 -0
  132. package/dist/modules/config/index.js +234 -0
  133. package/dist/modules/config/index.js.map +1 -0
  134. package/dist/modules/core/index.d.ts +6 -0
  135. package/dist/modules/core/index.js +32 -0
  136. package/dist/modules/core/index.js.map +1 -0
  137. package/dist/modules/database/index.d.ts +30 -0
  138. package/dist/modules/database/index.js +201 -0
  139. package/dist/modules/database/index.js.map +1 -0
  140. package/dist/modules/email/index.d.ts +21 -0
  141. package/dist/modules/email/index.js +63 -0
  142. package/dist/modules/email/index.js.map +1 -0
  143. package/dist/modules/forms/index.d.ts +7 -0
  144. package/dist/modules/forms/index.js +37 -0
  145. package/dist/modules/forms/index.js.map +1 -0
  146. package/dist/modules/index.d.ts +11 -0
  147. package/dist/modules/index.js +24 -0
  148. package/dist/modules/index.js.map +1 -0
  149. package/dist/modules/pushNotifications/index.d.ts +10 -0
  150. package/dist/modules/pushNotifications/index.js +63 -0
  151. package/dist/modules/pushNotifications/index.js.map +1 -0
  152. package/dist/modules/router/index.d.ts +8 -0
  153. package/dist/modules/router/index.js +43 -0
  154. package/dist/modules/router/index.js.map +1 -0
  155. package/dist/modules/sms/index.d.ts +10 -0
  156. package/dist/modules/sms/index.js +46 -0
  157. package/dist/modules/sms/index.js.map +1 -0
  158. package/dist/modules/storage/index.d.ts +10 -0
  159. package/dist/modules/storage/index.js +47 -0
  160. package/dist/modules/storage/index.js.map +1 -0
  161. package/dist/protoUtils/authentication.d.ts +209 -0
  162. package/dist/protoUtils/authentication.js +533 -0
  163. package/dist/protoUtils/authentication.js.map +1 -0
  164. package/dist/protoUtils/chat.d.ts +178 -0
  165. package/dist/protoUtils/chat.js +534 -0
  166. package/dist/protoUtils/chat.js.map +1 -0
  167. package/dist/protoUtils/core.d.ts +607 -0
  168. package/dist/protoUtils/core.js +1883 -0
  169. package/dist/protoUtils/core.js.map +1 -0
  170. package/dist/protoUtils/database.d.ts +496 -0
  171. package/dist/protoUtils/database.js +1275 -0
  172. package/dist/protoUtils/database.js.map +1 -0
  173. package/dist/protoUtils/email.d.ts +153 -0
  174. package/dist/protoUtils/email.js +543 -0
  175. package/dist/protoUtils/email.js.map +1 -0
  176. package/dist/protoUtils/forms.d.ts +54 -0
  177. package/dist/protoUtils/forms.js +141 -0
  178. package/dist/protoUtils/forms.js.map +1 -0
  179. package/dist/protoUtils/grpc_health_check.d.ts +83 -0
  180. package/dist/protoUtils/grpc_health_check.js +197 -0
  181. package/dist/protoUtils/grpc_health_check.js.map +1 -0
  182. package/dist/protoUtils/push-notifications.d.ts +179 -0
  183. package/dist/protoUtils/push-notifications.js +512 -0
  184. package/dist/protoUtils/push-notifications.js.map +1 -0
  185. package/dist/protoUtils/sms.d.ts +176 -0
  186. package/dist/protoUtils/sms.js +459 -0
  187. package/dist/protoUtils/sms.js.map +1 -0
  188. package/dist/protoUtils/storage.d.ts +203 -0
  189. package/dist/protoUtils/storage.js +522 -0
  190. package/dist/protoUtils/storage.js.map +1 -0
  191. package/dist/types/index.d.ts +55 -0
  192. package/dist/types/index.js +37 -0
  193. package/dist/types/index.js.map +1 -0
  194. package/dist/utilities/EventBus.d.ts +10 -0
  195. package/dist/utilities/EventBus.js +52 -0
  196. package/dist/utilities/EventBus.js.map +1 -0
  197. package/dist/utilities/RedisManager.d.ts +6 -0
  198. package/dist/utilities/RedisManager.js +32 -0
  199. package/dist/utilities/RedisManager.js.map +1 -0
  200. package/dist/utilities/StateManager.d.ts +10 -0
  201. package/dist/utilities/StateManager.js +31 -0
  202. package/dist/utilities/StateManager.js.map +1 -0
  203. package/dist/utilities/index.d.ts +1 -0
  204. package/dist/utilities/index.js +10 -0
  205. package/dist/utilities/index.js.map +1 -0
  206. package/package.json +56 -0
@@ -0,0 +1,193 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.RoutingManager = void 0;
40
+ var interfaces_1 = require("../../interfaces");
41
+ var RoutingUtilities_1 = require("../../helpers/RoutingUtilities");
42
+ var RouteBuilder_1 = require("./RouteBuilder");
43
+ var RoutingManager = /** @class */ (function () {
44
+ function RoutingManager(_router, _server) {
45
+ this._router = _router;
46
+ this._server = _server;
47
+ this._moduleRoutes = {};
48
+ this._routeHandlers = {};
49
+ }
50
+ RoutingManager.prototype.get = function (path) {
51
+ return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.GET).path(path);
52
+ };
53
+ RoutingManager.prototype.post = function (path) {
54
+ return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.POST).path(path);
55
+ };
56
+ RoutingManager.prototype.delete = function (path) {
57
+ return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.DELETE).path(path);
58
+ };
59
+ RoutingManager.prototype.update = function (path) {
60
+ return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.UPDATE).path(path);
61
+ };
62
+ RoutingManager.prototype.patch = function (path) {
63
+ return new RouteBuilder_1.RouteBuilder(this).method(interfaces_1.ConduitRouteActions.PATCH).path(path);
64
+ };
65
+ RoutingManager.prototype.clear = function () {
66
+ this._moduleRoutes = {};
67
+ this._routeHandlers = {};
68
+ };
69
+ RoutingManager.prototype.middleware = function (input, handler) {
70
+ var routeObject = {
71
+ options: input,
72
+ grpcFunction: input.name,
73
+ };
74
+ if (!routeObject.options.middlewares) {
75
+ routeObject.options.middlewares = [];
76
+ }
77
+ for (var option in routeObject.options) {
78
+ if (!routeObject.options.hasOwnProperty(option))
79
+ continue;
80
+ if (option === 'middlewares')
81
+ continue;
82
+ if (typeof routeObject.options[option] === 'string' ||
83
+ routeObject.options[option] instanceof String)
84
+ continue;
85
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
86
+ }
87
+ this._moduleRoutes[routeObject.grpcFunction] = routeObject;
88
+ this._routeHandlers[routeObject.grpcFunction] = handler;
89
+ };
90
+ RoutingManager.prototype.route = function (input, type, handler) {
91
+ var routeObject = {
92
+ options: input,
93
+ returns: {
94
+ name: type.name,
95
+ fields: JSON.stringify(type.fields),
96
+ },
97
+ grpcFunction: this.generateGrpcName(input),
98
+ };
99
+ if (!routeObject.options.middlewares) {
100
+ routeObject.options.middlewares = [];
101
+ }
102
+ for (var option in routeObject.options) {
103
+ if (!routeObject.options.hasOwnProperty(option))
104
+ continue;
105
+ if (option === 'middlewares')
106
+ continue;
107
+ if (typeof routeObject.options[option] === 'string' ||
108
+ routeObject.options[option] instanceof String)
109
+ continue;
110
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
111
+ }
112
+ this._moduleRoutes[routeObject.grpcFunction] = routeObject;
113
+ this._routeHandlers[routeObject.grpcFunction] = handler;
114
+ };
115
+ RoutingManager.prototype.socket = function (input, events) {
116
+ var _this = this;
117
+ var routeObject = {
118
+ options: input,
119
+ events: '',
120
+ };
121
+ var eventsObj = {};
122
+ if (!routeObject.options.middlewares) {
123
+ routeObject.options.middlewares = [];
124
+ }
125
+ for (var option in routeObject.options) {
126
+ if (!routeObject.options.hasOwnProperty(option))
127
+ continue;
128
+ if (option === 'middlewares')
129
+ continue;
130
+ if (typeof routeObject.options[option] === 'string' ||
131
+ routeObject.options[option] instanceof String)
132
+ continue;
133
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
134
+ }
135
+ var primary;
136
+ Object.keys(events).forEach(function (eventName) {
137
+ var _a, _b, _c;
138
+ if (!primary)
139
+ primary = eventName;
140
+ var event = events[eventName];
141
+ eventsObj[eventName] = {
142
+ grpcFunction: eventName,
143
+ params: JSON.stringify(event.params),
144
+ returns: {
145
+ name: (_b = (_a = event.returnType) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
146
+ fields: JSON.stringify((_c = event.returnType) === null || _c === void 0 ? void 0 : _c.fields),
147
+ },
148
+ };
149
+ _this._routeHandlers[eventName] = event.handler;
150
+ });
151
+ routeObject.events = JSON.stringify(eventsObj);
152
+ this._moduleRoutes[primary] = routeObject;
153
+ };
154
+ RoutingManager.prototype.registerRoutes = function () {
155
+ return __awaiter(this, void 0, void 0, function () {
156
+ var modifiedFunctions, protoDescriptions;
157
+ return __generator(this, function (_a) {
158
+ switch (_a.label) {
159
+ case 0:
160
+ if (Object.keys(this._routeHandlers).length === 0)
161
+ return [2 /*return*/];
162
+ modifiedFunctions = RoutingUtilities_1.wrapFunctionsAsync(this._routeHandlers);
163
+ protoDescriptions = RoutingUtilities_1.constructProtoFile(this._router.moduleName, Object.values(this._moduleRoutes));
164
+ return [4 /*yield*/, this._server.addService(protoDescriptions.path, protoDescriptions.name + '.router.Router', modifiedFunctions)];
165
+ case 1:
166
+ _a.sent();
167
+ return [2 /*return*/, this._router.register(Object.values(this._moduleRoutes), protoDescriptions.file)];
168
+ }
169
+ });
170
+ });
171
+ };
172
+ RoutingManager.prototype.generateGrpcName = function (options) {
173
+ if (options.name) {
174
+ return options.name.charAt(0).toUpperCase() + options.name.slice(1);
175
+ }
176
+ else {
177
+ var name_1 = options.action.charAt(0) +
178
+ options.action.slice(1).toLowerCase() +
179
+ this.extractNameFromPath(options.path);
180
+ return name_1.charAt(0).toUpperCase() + name_1.slice(1);
181
+ }
182
+ };
183
+ RoutingManager.prototype.extractNameFromPath = function (path) {
184
+ path = path.replace(/[-:]/g, '/');
185
+ return path
186
+ .split('/')
187
+ .map(function (word) { return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); })
188
+ .join('');
189
+ };
190
+ return RoutingManager;
191
+ }());
192
+ exports.RoutingManager = RoutingManager;
193
+ //# sourceMappingURL=RoutingManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutingManager.js","sourceRoot":"","sources":["../../../src/classes/Routing/RoutingManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAQ0B;AAK1B,mEAAwF;AACxF,+CAA8C;AAE9C;IAaE,wBAA6B,OAAe,EAAmB,OAAmB;QAArD,YAAO,GAAP,OAAO,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAAY;QAZ1E,kBAAa,GAOjB,EAAE,CAAC;QACC,mBAAc,GAElB,EAAE,CAAC;IAE8E,CAAC;IAEtF,4BAAG,GAAH,UAAI,IAAY;QACd,OAAO,IAAI,2BAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,gCAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED,6BAAI,GAAJ,UAAK,IAAY;QACf,OAAO,IAAI,2BAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,gCAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,+BAAM,G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AM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;gBACrC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACzC,OAAO,MAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACrD;IACH,CAAC;IAEO,4CAAmB,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;IACH,qBAAC;AAAD,CAAC,AA7KD,IA6KC;AA7KY,wCAAc"}
@@ -0,0 +1,16 @@
1
+ export * from './Error';
2
+ export * from './ConduitRoute';
3
+ export * from './ConduitRouteReturn';
4
+ export * from './ConduitMiddleware';
5
+ export * from './ConduitSchema';
6
+ export * from './ConduitSchemaExtension';
7
+ export * from './ConduitActiveSchema';
8
+ export * from './GrpcServer';
9
+ export * from './ConduitSocket';
10
+ export * from './ConduitServiceModule';
11
+ export * from './ManagedModule';
12
+ export * from './ModuleManager';
13
+ export * from './Routing/RoutingManager';
14
+ export * from './Routing/RouteBuilder';
15
+ export * from './ConfigController';
16
+ export * from './ConduitParser';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Error"), exports);
14
+ __exportStar(require("./ConduitRoute"), exports);
15
+ __exportStar(require("./ConduitRouteReturn"), exports);
16
+ __exportStar(require("./ConduitMiddleware"), exports);
17
+ __exportStar(require("./ConduitSchema"), exports);
18
+ __exportStar(require("./ConduitSchemaExtension"), exports);
19
+ __exportStar(require("./ConduitActiveSchema"), exports);
20
+ __exportStar(require("./GrpcServer"), exports);
21
+ __exportStar(require("./ConduitSocket"), exports);
22
+ __exportStar(require("./ConduitServiceModule"), exports);
23
+ __exportStar(require("./ManagedModule"), exports);
24
+ __exportStar(require("./ModuleManager"), exports);
25
+ __exportStar(require("./Routing/RoutingManager"), exports);
26
+ __exportStar(require("./Routing/RouteBuilder"), exports);
27
+ __exportStar(require("./ConfigController"), exports);
28
+ __exportStar(require("./ConduitParser"), exports);
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/classes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB;AACxB,iDAA+B;AAC/B,uDAAqC;AACrC,sDAAoC;AACpC,kDAAgC;AAChC,2DAAyC;AACzC,wDAAsC;AACtC,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,kDAAgC;AAChC,kDAAgC;AAChC,2DAAyC;AACzC,yDAAuC;AACvC,qDAAmC;AACnC,kDAAgC"}
@@ -0,0 +1,9 @@
1
+ export declare enum PlatformTypesEnum {
2
+ WEB = "WEB",
3
+ ANDROID = "ANDROID",
4
+ IOS = "IOS",
5
+ IPADOS = "IPADOS",
6
+ WINDOWS = "WINDOWS",
7
+ MACOS = "MACOS",
8
+ LINUX = "LINUX"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlatformTypesEnum = void 0;
4
+ var PlatformTypesEnum;
5
+ (function (PlatformTypesEnum) {
6
+ PlatformTypesEnum["WEB"] = "WEB";
7
+ PlatformTypesEnum["ANDROID"] = "ANDROID";
8
+ PlatformTypesEnum["IOS"] = "IOS";
9
+ PlatformTypesEnum["IPADOS"] = "IPADOS";
10
+ PlatformTypesEnum["WINDOWS"] = "WINDOWS";
11
+ PlatformTypesEnum["MACOS"] = "MACOS";
12
+ PlatformTypesEnum["LINUX"] = "LINUX";
13
+ })(PlatformTypesEnum = exports.PlatformTypesEnum || (exports.PlatformTypesEnum = {}));
14
+ //# sourceMappingURL=PlatformTypesEnum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformTypesEnum.js","sourceRoot":"","sources":["../../../src/constants/enums/PlatformTypesEnum.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,wCAAmB,CAAA;IACnB,gCAAW,CAAA;IACX,sCAAiB,CAAA;IACjB,wCAAmB,CAAA;IACnB,oCAAe,CAAA;IACf,oCAAe,CAAA;AACjB,CAAC,EARW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAQ5B"}
@@ -0,0 +1 @@
1
+ export * from './PlatformTypesEnum';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./PlatformTypesEnum"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC"}
@@ -0,0 +1 @@
1
+ export * from './enums';
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./enums"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAwB"}
@@ -0,0 +1,8 @@
1
+ import { Server } from '@grpc/grpc-js';
2
+ export declare function createServer(port: string): Promise<{
3
+ server: Server;
4
+ port: number;
5
+ }>;
6
+ export declare function addServiceToServer(server: Server, protoFilePath: string, descriptorObject: string, functions: {
7
+ [name: string]: Function;
8
+ }): void;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addServiceToServer = exports.createServer = void 0;
4
+ var grpc_js_1 = require("@grpc/grpc-js");
5
+ var protoLoader = require('@grpc/proto-loader');
6
+ function createServer(port) {
7
+ var grpcServer = new grpc_js_1.Server({
8
+ 'grpc.max_receive_message_length': 1024 * 1024 * 100,
9
+ 'grpc.max_send_message_length': 1024 * 1024 * 100,
10
+ });
11
+ return new Promise(function (resolve, reject) {
12
+ grpcServer.bindAsync(port, grpc_js_1.ServerCredentials.createInsecure(), function (err, port) {
13
+ if (err) {
14
+ reject(err);
15
+ }
16
+ else {
17
+ resolve({
18
+ server: grpcServer,
19
+ port: port,
20
+ });
21
+ }
22
+ });
23
+ });
24
+ }
25
+ exports.createServer = createServer;
26
+ function addServiceToServer(server, protoFilePath, descriptorObject, functions) {
27
+ var packageDefinition = protoLoader.loadSync(protoFilePath, {
28
+ keepCase: true,
29
+ longs: String,
30
+ enums: String,
31
+ defaults: true,
32
+ oneofs: true,
33
+ });
34
+ var protoDescriptor = grpc_js_1.loadPackageDefinition(packageDefinition);
35
+ var objs = descriptorObject.split('.');
36
+ var descObj = protoDescriptor;
37
+ objs.forEach(function (r) {
38
+ descObj = descObj[r];
39
+ });
40
+ // @ts-ignore
41
+ server.addService(descObj.service, functions);
42
+ }
43
+ exports.addServiceToServer = addServiceToServer;
44
+ //# sourceMappingURL=GrpcHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrpcHelper.js","sourceRoot":"","sources":["../../src/helpers/GrpcHelper.ts"],"names":[],"mappings":";;;AAAA,yCAAiF;AAEjF,IAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAElD,SAAgB,YAAY,CAAC,IAAY;IACvC,IAAM,UAAU,GAAW,IAAI,gBAAM,CAAC;QACpC,iCAAiC,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;QACpD,8BAA8B,EAAE,IAAI,GAAG,IAAI,GAAG,GAAG;KAClD,CAAC,CAAC;IACH,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACjC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,2BAAiB,CAAC,cAAc,EAAE,EAAE,UAAC,GAAG,EAAE,IAAI;YACvE,IAAI,GAAG,EAAE;gBACP,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,OAAO,CAAC;oBACN,MAAM,EAAE,UAAU;oBAClB,IAAI,MAAA;iBACL,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,oCAiBC;AAED,SAAgB,kBAAkB,CAChC,MAAc,EACd,aAAqB,EACrB,gBAAwB,EACxB,SAAuC;IAEvC,IAAM,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,aAAa,EAAE;QAC5D,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb,CAAC,CAAC;IACH,IAAM,eAAe,GAAG,+BAAqB,CAAC,iBAAiB,CAAC,CAAC;IACjE,IAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,OAAO,GAAQ,eAAe,CAAC;IACnC,IAAI,CAAC,OAAO,CAAC,UAAC,CAAS;QACrB,OAAO,GAAG,OAAO,CAAC,CAAC,CAAQ,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,aAAa;IACb,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AArBD,gDAqBC"}
@@ -0,0 +1,9 @@
1
+ import { ConduitMiddleware, ConduitRoute, ConduitRouteReturnDefinition, ConduitSocket } from '../classes';
2
+ import { ConduitRouteOptions } from '../interfaces';
3
+ export declare function constructRoute(route: ConduitRoute): any;
4
+ export declare function constructConduitRoute(input: ConduitRouteOptions, type: ConduitRouteReturnDefinition, handler: string): any;
5
+ export declare function constructMiddleware(route: ConduitMiddleware): any;
6
+ export declare function constructSocket(socket: ConduitSocket): {
7
+ options: import("../interfaces").ConduitSocketOptions;
8
+ events: string;
9
+ };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constructSocket = exports.constructMiddleware = exports.constructConduitRoute = exports.constructRoute = void 0;
4
+ function constructRoute(route) {
5
+ var routeObject = {
6
+ options: {},
7
+ returns: {},
8
+ grpcFunction: '',
9
+ };
10
+ routeObject.grpcFunction = route.handler;
11
+ routeObject.options = route.input;
12
+ if (!routeObject.options.middlewares) {
13
+ routeObject.options.middlewares = [];
14
+ }
15
+ routeObject.returns = {
16
+ name: route.returnTypeName,
17
+ fields: JSON.stringify(route.returnTypeFields),
18
+ };
19
+ for (var option in routeObject.options) {
20
+ if (!routeObject.options.hasOwnProperty(option))
21
+ continue;
22
+ if (option === 'middlewares')
23
+ continue;
24
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
25
+ }
26
+ return routeObject;
27
+ }
28
+ exports.constructRoute = constructRoute;
29
+ function constructConduitRoute(input, type, handler) {
30
+ var routeObject = {
31
+ options: input,
32
+ returns: {
33
+ name: type.name,
34
+ fields: JSON.stringify(type.fields),
35
+ },
36
+ grpcFunction: handler,
37
+ };
38
+ if (!routeObject.options.middlewares) {
39
+ routeObject.options.middlewares = [];
40
+ }
41
+ if (!routeObject.options.middlewares) {
42
+ routeObject.options.middlewares = [];
43
+ }
44
+ for (var option in routeObject.options) {
45
+ if (!routeObject.options.hasOwnProperty(option))
46
+ continue;
47
+ if (option === 'middlewares')
48
+ continue;
49
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
50
+ }
51
+ return routeObject;
52
+ }
53
+ exports.constructConduitRoute = constructConduitRoute;
54
+ function constructMiddleware(route) {
55
+ var routeObject = {
56
+ options: {},
57
+ grpcFunction: '',
58
+ };
59
+ routeObject.grpcFunction = route.handler;
60
+ routeObject.options = route.input.path ? route.input : null;
61
+ routeObject.options.middlewares = [];
62
+ for (var option in routeObject.options) {
63
+ if (!routeObject.options.hasOwnProperty(option))
64
+ continue;
65
+ routeObject.options[option] = JSON.stringify(routeObject.options[option]);
66
+ }
67
+ return routeObject;
68
+ }
69
+ exports.constructMiddleware = constructMiddleware;
70
+ function constructSocket(socket) {
71
+ var eventsObj = {};
72
+ Object.keys(socket.events).forEach(function (eventName) {
73
+ var event = socket.events[eventName];
74
+ eventsObj[eventName] = {
75
+ grpcFunction: event.handler,
76
+ params: JSON.stringify(event.params),
77
+ returns: {
78
+ name: socket.returnTypeName(eventName),
79
+ fields: JSON.stringify(socket.returnTypeFields(eventName)),
80
+ },
81
+ };
82
+ });
83
+ return {
84
+ options: socket.input,
85
+ events: JSON.stringify(eventsObj),
86
+ };
87
+ }
88
+ exports.constructSocket = constructSocket;
89
+ //# sourceMappingURL=RoutingJsonConstructor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutingJsonConstructor.js","sourceRoot":"","sources":["../../src/helpers/RoutingJsonConstructor.ts"],"names":[],"mappings":";;;AAQA,SAAgB,cAAc,CAAC,KAAmB;IAChD,IAAI,WAAW,GAAQ;QACrB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,EAAE;KACjB,CAAC;IACF,WAAW,CAAC,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC;IACzC,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;IAClC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE;QACpC,WAAW,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC;KACtC;IACD,WAAW,CAAC,OAAO,GAAG;QACpB,IAAI,EAAE,KAAK,CAAC,cAAc;QAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC;KAC/C,CAAC;IACF,KAAK,IAAI,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE;QACtC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;YAAE,SAAS;QAC1D,IAAI,MAAM,KAAK,aAAa;YAAE,SAAS;QACvC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC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,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5D,WAAW,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAC;IAErC,KAAK,IAAI,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE;QACtC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;YAAE,SAAS;QAC1D,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;KAC3E;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAfD,kDAeC;AAED,SAAgB,eAAe,CAAC,MAAqB;IACnD,IAAI,SAAS,GAA2B,EAAE,CAAC;IAE3C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAC,SAAiB;QACnD,IAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACvC,SAAS,CAAC,SAAS,CAAC,GAAG;YACrB,YAAY,EAAE,KAAK,CAAC,OAAO;YAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;YACpC,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC;gBACtC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;aAC3D;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,KAAK;QACrB,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;KAClC,CAAC;AACJ,CAAC;AAnBD,0CAmBC"}
@@ -0,0 +1,13 @@
1
+ import { RequestHandlers } from './wrapRouterFunctions';
2
+ import { Indexable, SocketProtoDescription } from '../interfaces';
3
+ export declare function constructProtoFile(moduleName: string, paths: SocketProtoDescription[]): {
4
+ path: string;
5
+ name: string;
6
+ file: string;
7
+ };
8
+ export declare function wrapFunctionsAsync(functions: {
9
+ [name: string]: RequestHandlers;
10
+ }): {
11
+ [name: string]: (call: Indexable, callback?: Indexable) => void;
12
+ };
13
+ export declare function createProtoFunctions(paths: SocketProtoDescription[]): string;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createProtoFunctions = exports.wrapFunctionsAsync = exports.constructProtoFile = void 0;
7
+ var wrapRouterFunctions_1 = require("./wrapRouterFunctions");
8
+ var path_1 = __importDefault(require("path"));
9
+ var fs_1 = __importDefault(require("fs"));
10
+ var protofile_template = "\nsyntax = \"proto3\";\npackage MODULE_NAME.router;\n\nservice Router {\n MODULE_FUNCTIONS\n}\n\nmessage RouterRequest {\n string params = 1;\n string path = 2;\n string headers = 3;\n string context = 4;\n}\n\nmessage RouterResponse {\n string result = 1;\n string redirect = 2;\n repeated Cookie setCookies = 3;\n repeated Cookie removeCookies = 4;\n}\n\nmessage SocketRequest {\n string event = 1;\n string socketId = 2;\n string params = 3;\n string context = 4;\n}\n\nmessage Cookie {\n string name = 1;\n optional string value = 2;\n Options options = 3;\n}\n\nmessage Options {\n bool httpOnly = 1;\n bool secure = 2;\n bool signed = 3;\n int32 maxAge = 4;\n string path = 5;\n string domain = 6;\n string sameSite = 7;\n \n}\nmessage SocketResponse {\n string event = 1;\n string data = 2;\n repeated string receivers = 3;\n repeated string rooms = 4;\n}\n";
11
+ function constructProtoFile(moduleName, paths) {
12
+ var formattedModuleName = getFormattedModuleName(moduleName);
13
+ var protoFunctions = createProtoFunctions(paths);
14
+ var protoFile = protofile_template
15
+ .toString()
16
+ .replace('MODULE_FUNCTIONS', protoFunctions);
17
+ protoFile = protoFile.replace('MODULE_NAME', formattedModuleName);
18
+ var protoPath = path_1.default.resolve(__dirname, Math.random().toString(36).substring(7));
19
+ fs_1.default.writeFileSync(protoPath, protoFile);
20
+ return { path: protoPath, name: formattedModuleName, file: protoFile };
21
+ }
22
+ exports.constructProtoFile = constructProtoFile;
23
+ function getFormattedModuleName(moduleName) {
24
+ return moduleName.replace('-', '_');
25
+ }
26
+ function wrapFunctionsAsync(functions) {
27
+ var modifiedFunctions = {};
28
+ Object.keys(functions).forEach(function (key) {
29
+ modifiedFunctions[key] = wrapRouterFunctions_1.wrapRouterGrpcFunction(functions[key]);
30
+ });
31
+ return modifiedFunctions;
32
+ }
33
+ exports.wrapFunctionsAsync = wrapFunctionsAsync;
34
+ function createProtoFunctions(paths) {
35
+ var protoFunctions = '';
36
+ paths.forEach(function (r) {
37
+ if (r.hasOwnProperty('events')) {
38
+ protoFunctions += createProtoFunctionsForSocket(r, protoFunctions);
39
+ }
40
+ else {
41
+ protoFunctions += createProtoFunctionForRoute(r, protoFunctions);
42
+ }
43
+ });
44
+ return protoFunctions;
45
+ }
46
+ exports.createProtoFunctions = createProtoFunctions;
47
+ function createProtoFunctionsForSocket(path, protoFunctions) {
48
+ var newFunctions = '';
49
+ var events = JSON.parse(path.events);
50
+ Object.keys(events).forEach(function (event) {
51
+ var newFunction = createGrpcFunctionName(events[event].grpcFunction);
52
+ if (protoFunctions.indexOf("rpc " + newFunction + "(") !== -1) {
53
+ return;
54
+ }
55
+ newFunctions += "rpc " + newFunction + "(SocketRequest) returns (SocketResponse);\n";
56
+ });
57
+ return newFunctions;
58
+ }
59
+ function createProtoFunctionForRoute(path, protoFunctions) {
60
+ var newFunction = createGrpcFunctionName(path.grpcFunction);
61
+ if (protoFunctions.indexOf("rpc " + newFunction + "(") !== -1) {
62
+ return '';
63
+ }
64
+ return "rpc " + newFunction + "(RouterRequest) returns (RouterResponse);\n";
65
+ }
66
+ function createGrpcFunctionName(grpcFunction) {
67
+ return grpcFunction.charAt(0).toUpperCase() + grpcFunction.slice(1);
68
+ }
69
+ //# sourceMappingURL=RoutingUtilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutingUtilities.js","sourceRoot":"","sources":["../../src/helpers/RoutingUtilities.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAgF;AAEhF,8CAAwB;AACxB,0CAAoB;AAEpB,IAAM,kBAAkB,GAAG,63BAmD1B,CAAC;AAEF,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,KAA+B;IACpF,IAAI,mBAAmB,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC7D,IAAM,cAAc,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,SAAS,GAAG,kBAAkB;SAC/B,QAAQ,EAAE;SACV,OAAO,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IAC/C,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAElE,IAAI,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACvC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACzE,CAAC;AAXD,gDAWC;AAED,SAAS,sBAAsB,CAAC,UAAkB;IAChD,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,kBAAkB,CAAC,SAElC;IAGC,IAAI,iBAAiB,GAEjB,EAAE,CAAC;IACP,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;QAChC,iBAAiB,CAAC,GAAG,CAAC,GAAG,4CAAsB,CAAC,SAAS,CAAC,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;KACX;IAED,OAAO,SAAO,WAAW,gDAA6C,CAAC;AACzE,CAAC;AAED,SAAS,sBAAsB,CAAC,YAAoB;IAClD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { ConduitModelField, TYPE } from '../interfaces';
2
+ declare class ConduitStringConstructor {
3
+ private constructor();
4
+ static get Optional(): TYPE;
5
+ static get Required(): ConduitModelField;
6
+ }
7
+ export declare let ConduitString: typeof ConduitStringConstructor;
8
+ declare class ConduitNumberConstructor {
9
+ private constructor();
10
+ static get Optional(): TYPE;
11
+ static get Required(): ConduitModelField;
12
+ }
13
+ export declare let ConduitNumber: typeof ConduitNumberConstructor;
14
+ declare class ConduitBooleanConstructor {
15
+ private constructor();
16
+ static get Optional(): TYPE;
17
+ static get Required(): ConduitModelField;
18
+ }
19
+ export declare let ConduitBoolean: typeof ConduitBooleanConstructor;
20
+ declare class ConduitDateConstructor {
21
+ private constructor();
22
+ static get Optional(): TYPE;
23
+ static get Required(): ConduitModelField;
24
+ }
25
+ export declare let ConduitDate: typeof ConduitDateConstructor;
26
+ declare class ConduitObjectIdConstructor {
27
+ private constructor();
28
+ static get Optional(): TYPE;
29
+ static get Required(): ConduitModelField;
30
+ }
31
+ export declare let ConduitObjectId: typeof ConduitObjectIdConstructor;
32
+ declare class ConduitJSONConstructor {
33
+ private constructor();
34
+ static get Optional(): TYPE;
35
+ static get Required(): ConduitModelField;
36
+ }
37
+ export declare let ConduitJson: typeof ConduitJSONConstructor;
38
+ declare class ConduitRelationConstructor {
39
+ private constructor();
40
+ static Optional(model: string): ConduitModelField;
41
+ static Required(model: string): ConduitModelField;
42
+ }
43
+ export declare let ConduitRelation: typeof ConduitRelationConstructor;
44
+ export {};