@conduitplatform/grpc-sdk 0.13.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/classes/ConduitActiveSchema.d.ts +19 -0
- package/dist/classes/ConduitActiveSchema.js +57 -0
- package/dist/classes/ConduitActiveSchema.js.map +1 -0
- package/dist/classes/ConduitMiddleware.d.ts +8 -0
- package/dist/classes/ConduitMiddleware.js +26 -0
- package/dist/classes/ConduitMiddleware.js.map +1 -0
- package/dist/classes/ConduitModule.d.ts +26 -0
- package/dist/classes/ConduitModule.js +170 -0
- package/dist/classes/ConduitModule.js.map +1 -0
- package/dist/classes/ConduitParser.d.ts +20 -0
- package/dist/classes/ConduitParser.js +84 -0
- package/dist/classes/ConduitParser.js.map +1 -0
- package/dist/classes/ConduitRoute.d.ts +12 -0
- package/dist/classes/ConduitRoute.js +44 -0
- package/dist/classes/ConduitRoute.js.map +1 -0
- package/dist/classes/ConduitRouteReturn.d.ts +48 -0
- package/dist/classes/ConduitRouteReturn.js +66 -0
- package/dist/classes/ConduitRouteReturn.js.map +1 -0
- package/dist/classes/ConduitSchema.d.ts +10 -0
- package/dist/classes/ConduitSchema.js +22 -0
- package/dist/classes/ConduitSchema.js.map +1 -0
- package/dist/classes/ConduitSchemaExtension.d.ts +7 -0
- package/dist/classes/ConduitSchemaExtension.js +19 -0
- package/dist/classes/ConduitSchemaExtension.js.map +1 -0
- package/dist/classes/ConduitServiceModule.d.ts +25 -0
- package/dist/classes/ConduitServiceModule.js +139 -0
- package/dist/classes/ConduitServiceModule.js.map +1 -0
- package/dist/classes/ConduitSocket.d.ts +9 -0
- package/dist/classes/ConduitSocket.js +27 -0
- package/dist/classes/ConduitSocket.js.map +1 -0
- package/dist/classes/ConfigController.d.ts +7 -0
- package/dist/classes/ConfigController.js +27 -0
- package/dist/classes/ConfigController.js.map +1 -0
- package/dist/classes/Error.d.ts +11 -0
- package/dist/classes/Error.js +51 -0
- package/dist/classes/Error.js.map +1 -0
- package/dist/classes/GrpcServer.d.ts +19 -0
- package/dist/classes/GrpcServer.js +185 -0
- package/dist/classes/GrpcServer.js.map +1 -0
- package/dist/classes/ManagedModule.d.ts +20 -0
- package/dist/classes/ManagedModule.js +212 -0
- package/dist/classes/ManagedModule.js.map +1 -0
- package/dist/classes/ModuleManager.d.ts +11 -0
- package/dist/classes/ModuleManager.js +191 -0
- package/dist/classes/ModuleManager.js.map +1 -0
- package/dist/classes/Routing/RouteBuilder.d.ts +28 -0
- package/dist/classes/Routing/RouteBuilder.js +107 -0
- package/dist/classes/Routing/RouteBuilder.js.map +1 -0
- package/dist/classes/Routing/RoutingManager.d.ts +25 -0
- package/dist/classes/Routing/RoutingManager.js +193 -0
- package/dist/classes/Routing/RoutingManager.js.map +1 -0
- package/dist/classes/index.d.ts +16 -0
- package/dist/classes/index.js +29 -0
- package/dist/classes/index.js.map +1 -0
- package/dist/constants/enums/PlatformTypesEnum.d.ts +9 -0
- package/dist/constants/enums/PlatformTypesEnum.js +14 -0
- package/dist/constants/enums/PlatformTypesEnum.js.map +1 -0
- package/dist/constants/enums/index.d.ts +1 -0
- package/dist/constants/enums/index.js +14 -0
- package/dist/constants/enums/index.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +14 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/helpers/GrpcHelper.d.ts +8 -0
- package/dist/helpers/GrpcHelper.js +44 -0
- package/dist/helpers/GrpcHelper.js.map +1 -0
- package/dist/helpers/RoutingJsonConstructor.d.ts +9 -0
- package/dist/helpers/RoutingJsonConstructor.js +89 -0
- package/dist/helpers/RoutingJsonConstructor.js.map +1 -0
- package/dist/helpers/RoutingUtilities.d.ts +13 -0
- package/dist/helpers/RoutingUtilities.js +69 -0
- package/dist/helpers/RoutingUtilities.js.map +1 -0
- package/dist/helpers/TypeHelpers.d.ts +44 -0
- package/dist/helpers/TypeHelpers.js +144 -0
- package/dist/helpers/TypeHelpers.js.map +1 -0
- package/dist/helpers/index.d.ts +5 -0
- package/dist/helpers/index.js +18 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/wrapGrpcFunctions.d.ts +5 -0
- package/dist/helpers/wrapGrpcFunctions.js +37 -0
- package/dist/helpers/wrapGrpcFunctions.js.map +1 -0
- package/dist/helpers/wrapRouterFunctions.d.ts +7 -0
- package/dist/helpers/wrapRouterFunctions.js +111 -0
- package/dist/helpers/wrapRouterFunctions.js.map +1 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +481 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/grpcSignedToken.d.ts +2 -0
- package/dist/interceptors/grpcSignedToken.js +88 -0
- package/dist/interceptors/grpcSignedToken.js.map +1 -0
- package/dist/interceptors/index.d.ts +2 -0
- package/dist/interceptors/index.js +15 -0
- package/dist/interceptors/index.js.map +1 -0
- package/dist/interceptors/moduleName.d.ts +2 -0
- package/dist/interceptors/moduleName.js +88 -0
- package/dist/interceptors/moduleName.js.map +1 -0
- package/dist/interfaces/ConduitService.d.ts +8 -0
- package/dist/interfaces/ConduitService.js +3 -0
- package/dist/interfaces/ConduitService.js.map +1 -0
- package/dist/interfaces/GrpcCallback.d.ts +4 -0
- package/dist/interfaces/GrpcCallback.js +3 -0
- package/dist/interfaces/GrpcCallback.js.map +1 -0
- package/dist/interfaces/Indexable.d.ts +9 -0
- package/dist/interfaces/Indexable.js +3 -0
- package/dist/interfaces/Indexable.js.map +1 -0
- package/dist/interfaces/Middleware.d.ts +7 -0
- package/dist/interfaces/Middleware.js +3 -0
- package/dist/interfaces/Middleware.js.map +1 -0
- package/dist/interfaces/Model.d.ts +37 -0
- package/dist/interfaces/Model.js +19 -0
- package/dist/interfaces/Model.js.map +1 -0
- package/dist/interfaces/Route.d.ts +54 -0
- package/dist/interfaces/Route.js +21 -0
- package/dist/interfaces/Route.js.map +1 -0
- package/dist/interfaces/Socket.d.ts +34 -0
- package/dist/interfaces/Socket.js +9 -0
- package/dist/interfaces/Socket.js.map +1 -0
- package/dist/interfaces/index.d.ts +7 -0
- package/dist/interfaces/index.js +20 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/modules/admin/index.d.ts +13 -0
- package/dist/modules/admin/index.js +131 -0
- package/dist/modules/admin/index.js.map +1 -0
- package/dist/modules/authentication/index.d.ts +11 -0
- package/dist/modules/authentication/index.js +50 -0
- package/dist/modules/authentication/index.js.map +1 -0
- package/dist/modules/chat/index.d.ts +10 -0
- package/dist/modules/chat/index.js +46 -0
- package/dist/modules/chat/index.js.map +1 -0
- package/dist/modules/config/index.d.ts +25 -0
- package/dist/modules/config/index.js +234 -0
- package/dist/modules/config/index.js.map +1 -0
- package/dist/modules/core/index.d.ts +6 -0
- package/dist/modules/core/index.js +32 -0
- package/dist/modules/core/index.js.map +1 -0
- package/dist/modules/database/index.d.ts +30 -0
- package/dist/modules/database/index.js +201 -0
- package/dist/modules/database/index.js.map +1 -0
- package/dist/modules/email/index.d.ts +21 -0
- package/dist/modules/email/index.js +63 -0
- package/dist/modules/email/index.js.map +1 -0
- package/dist/modules/forms/index.d.ts +7 -0
- package/dist/modules/forms/index.js +37 -0
- package/dist/modules/forms/index.js.map +1 -0
- package/dist/modules/index.d.ts +11 -0
- package/dist/modules/index.js +24 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/pushNotifications/index.d.ts +10 -0
- package/dist/modules/pushNotifications/index.js +63 -0
- package/dist/modules/pushNotifications/index.js.map +1 -0
- package/dist/modules/router/index.d.ts +8 -0
- package/dist/modules/router/index.js +43 -0
- package/dist/modules/router/index.js.map +1 -0
- package/dist/modules/sms/index.d.ts +10 -0
- package/dist/modules/sms/index.js +46 -0
- package/dist/modules/sms/index.js.map +1 -0
- package/dist/modules/storage/index.d.ts +10 -0
- package/dist/modules/storage/index.js +47 -0
- package/dist/modules/storage/index.js.map +1 -0
- package/dist/protoUtils/authentication.d.ts +209 -0
- package/dist/protoUtils/authentication.js +533 -0
- package/dist/protoUtils/authentication.js.map +1 -0
- package/dist/protoUtils/chat.d.ts +178 -0
- package/dist/protoUtils/chat.js +534 -0
- package/dist/protoUtils/chat.js.map +1 -0
- package/dist/protoUtils/core.d.ts +607 -0
- package/dist/protoUtils/core.js +1883 -0
- package/dist/protoUtils/core.js.map +1 -0
- package/dist/protoUtils/database.d.ts +496 -0
- package/dist/protoUtils/database.js +1275 -0
- package/dist/protoUtils/database.js.map +1 -0
- package/dist/protoUtils/email.d.ts +153 -0
- package/dist/protoUtils/email.js +543 -0
- package/dist/protoUtils/email.js.map +1 -0
- package/dist/protoUtils/forms.d.ts +54 -0
- package/dist/protoUtils/forms.js +141 -0
- package/dist/protoUtils/forms.js.map +1 -0
- package/dist/protoUtils/grpc_health_check.d.ts +83 -0
- package/dist/protoUtils/grpc_health_check.js +197 -0
- package/dist/protoUtils/grpc_health_check.js.map +1 -0
- package/dist/protoUtils/push-notifications.d.ts +179 -0
- package/dist/protoUtils/push-notifications.js +512 -0
- package/dist/protoUtils/push-notifications.js.map +1 -0
- package/dist/protoUtils/sms.d.ts +176 -0
- package/dist/protoUtils/sms.js +459 -0
- package/dist/protoUtils/sms.js.map +1 -0
- package/dist/protoUtils/storage.d.ts +203 -0
- package/dist/protoUtils/storage.js +522 -0
- package/dist/protoUtils/storage.js.map +1 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/index.js +37 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utilities/EventBus.d.ts +10 -0
- package/dist/utilities/EventBus.js +52 -0
- package/dist/utilities/EventBus.js.map +1 -0
- package/dist/utilities/RedisManager.d.ts +6 -0
- package/dist/utilities/RedisManager.js +32 -0
- package/dist/utilities/RedisManager.js.map +1 -0
- package/dist/utilities/StateManager.d.ts +10 -0
- package/dist/utilities/StateManager.js +31 -0
- package/dist/utilities/StateManager.js.map +1 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +10 -0
- package/dist/utilities/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6
|
+
function step(op) {
|
|
7
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
8
|
+
while (_) try {
|
|
9
|
+
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;
|
|
10
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
11
|
+
switch (op[0]) {
|
|
12
|
+
case 0: case 1: t = op; break;
|
|
13
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
14
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
15
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
16
|
+
default:
|
|
17
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
18
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
19
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
20
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
21
|
+
if (t[2]) _.ops.pop();
|
|
22
|
+
_.trys.pop(); continue;
|
|
23
|
+
}
|
|
24
|
+
op = body.call(thisArg, _);
|
|
25
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
26
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
30
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
31
|
+
var m = o[Symbol.asyncIterator], i;
|
|
32
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
33
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
34
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
35
|
+
};
|
|
36
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
37
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
38
|
+
var i, p;
|
|
39
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
40
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
41
|
+
};
|
|
42
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
43
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
44
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
45
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
46
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
47
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
48
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
49
|
+
function fulfill(value) { resume("next", value); }
|
|
50
|
+
function reject(value) { resume("throw", value); }
|
|
51
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
52
|
+
};
|
|
53
|
+
var __values = (this && this.__values) || function(o) {
|
|
54
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
55
|
+
if (m) return m.call(o);
|
|
56
|
+
if (o && typeof o.length === "number") return {
|
|
57
|
+
next: function () {
|
|
58
|
+
if (o && i >= o.length) o = void 0;
|
|
59
|
+
return { value: o && o[i++], done: !o };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.getModuleNameInterceptor = void 0;
|
|
66
|
+
var nice_grpc_1 = require("nice-grpc");
|
|
67
|
+
function getModuleNameInterceptor(moduleName) {
|
|
68
|
+
return function middleware(call, options) {
|
|
69
|
+
var _a;
|
|
70
|
+
return __asyncGenerator(this, arguments, function middleware_1() {
|
|
71
|
+
return __generator(this, function (_b) {
|
|
72
|
+
switch (_b.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (!options.metadata) {
|
|
75
|
+
options.metadata = nice_grpc_1.Metadata();
|
|
76
|
+
}
|
|
77
|
+
(_a = options.metadata) === null || _a === void 0 ? void 0 : _a.set('module-name', moduleName);
|
|
78
|
+
return [5 /*yield**/, __values(__asyncDelegator(__asyncValues(call.next(call.request, options))))];
|
|
79
|
+
case 1: return [4 /*yield*/, __await.apply(void 0, [_b.sent()])];
|
|
80
|
+
case 2: return [4 /*yield*/, __await.apply(void 0, [_b.sent()])];
|
|
81
|
+
case 3: return [2 /*return*/, _b.sent()];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
exports.getModuleNameInterceptor = getModuleNameInterceptor;
|
|
88
|
+
//# sourceMappingURL=moduleName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleName.js","sourceRoot":"","sources":["../../src/interceptors/moduleName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwE;AAExE,SAAgB,wBAAwB,CAAC,UAAkB;IACzD,OAAO,SAAgB,UAAU,CAC/B,IAA6C,EAC7C,OAAoB;;;;;;wBAEpB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;4BACrB,OAAO,CAAC,QAAQ,GAAG,oBAAQ,EAAE,CAAC;yBAC/B;wBACD,MAAA,OAAO,CAAC,QAAQ,0CAAE,GAAG,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;wBAC1C,sBAAA,SAAO,iBAAA,cAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,CAAA,CAAA,EAAA;4BAAvC,4CAAA,SAAuC,IAAA;wEAAvC,SAAuC;4BAA9C,iCAA+C;;;;KAChD,CAAC;AACJ,CAAC;AAXD,4DAWC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GrpcRequest, GrpcResponse } from '..';
|
|
2
|
+
export interface ConduitService {
|
|
3
|
+
readonly protoPath: string;
|
|
4
|
+
readonly protoDescription: string;
|
|
5
|
+
functions: {
|
|
6
|
+
[p: string]: (call: GrpcRequest<any>, callback: GrpcResponse<any>) => void | Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConduitService.js","sourceRoot":"","sources":["../../src/interfaces/ConduitService.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GrpcCallback.js","sourceRoot":"","sources":["../../src/interfaces/GrpcCallback.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type Indexable = {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
};
|
|
4
|
+
export declare type Params = Indexable;
|
|
5
|
+
export declare type Document = Indexable;
|
|
6
|
+
export declare type Route = Indexable;
|
|
7
|
+
export declare type Headers = Indexable;
|
|
8
|
+
export declare type Context = Indexable;
|
|
9
|
+
export declare type Query = Indexable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Indexable.js","sourceRoot":"","sources":["../../src/interfaces/Indexable.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Middleware.js","sourceRoot":"","sources":["../../src/interfaces/Middleware.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare enum TYPE {
|
|
2
|
+
String = "String",
|
|
3
|
+
Number = "Number",
|
|
4
|
+
Boolean = "Boolean",
|
|
5
|
+
Date = "Date",
|
|
6
|
+
ObjectId = "ObjectId",
|
|
7
|
+
JSON = "JSON",
|
|
8
|
+
Relation = "Relation"
|
|
9
|
+
}
|
|
10
|
+
export declare type Array = any[];
|
|
11
|
+
export interface ConduitModelField {
|
|
12
|
+
type?: TYPE | Array | ConduitModel | ConduitModelField;
|
|
13
|
+
enum?: any;
|
|
14
|
+
default?: any;
|
|
15
|
+
model?: string;
|
|
16
|
+
unique?: boolean;
|
|
17
|
+
select?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
systemRequired?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ConduitModel {
|
|
22
|
+
[field: string]: ConduitModelField | ConduitModelField[] | ConduitModel | TYPE | TYPE[] | any[];
|
|
23
|
+
}
|
|
24
|
+
export declare const ConduitModelOptionsPermModifyType: string[];
|
|
25
|
+
export interface ConduitModelOptions {
|
|
26
|
+
timestamps?: boolean;
|
|
27
|
+
_id?: boolean;
|
|
28
|
+
conduit?: {
|
|
29
|
+
[field: string]: any;
|
|
30
|
+
permissions?: {
|
|
31
|
+
extendable: boolean;
|
|
32
|
+
canCreate: boolean;
|
|
33
|
+
canModify: 'Everything' | 'Nothing' | 'ExtensionOnly';
|
|
34
|
+
canDelete: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConduitModelOptionsPermModifyType = exports.TYPE = void 0;
|
|
4
|
+
var TYPE;
|
|
5
|
+
(function (TYPE) {
|
|
6
|
+
TYPE["String"] = "String";
|
|
7
|
+
TYPE["Number"] = "Number";
|
|
8
|
+
TYPE["Boolean"] = "Boolean";
|
|
9
|
+
TYPE["Date"] = "Date";
|
|
10
|
+
TYPE["ObjectId"] = "ObjectId";
|
|
11
|
+
TYPE["JSON"] = "JSON";
|
|
12
|
+
TYPE["Relation"] = "Relation";
|
|
13
|
+
})(TYPE = exports.TYPE || (exports.TYPE = {}));
|
|
14
|
+
exports.ConduitModelOptionsPermModifyType = [
|
|
15
|
+
'Everything',
|
|
16
|
+
'Nothing',
|
|
17
|
+
'ExtensionOnly',
|
|
18
|
+
];
|
|
19
|
+
//# sourceMappingURL=Model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Model.js","sourceRoot":"","sources":["../../src/interfaces/Model.ts"],"names":[],"mappings":";;;AAAA,IAAY,IAQX;AARD,WAAY,IAAI;IACd,yBAAiB,CAAA;IACjB,yBAAiB,CAAA;IACjB,2BAAmB,CAAA;IACnB,qBAAa,CAAA;IACb,6BAAqB,CAAA;IACrB,qBAAa,CAAA;IACb,6BAAqB,CAAA;AACvB,CAAC,EARW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAQf;AAyBY,QAAA,iCAAiC,GAAG;IAC/C,YAAY;IACZ,SAAS;IACT,eAAe;CAChB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ConduitModel } from './Model';
|
|
3
|
+
import { IncomingHttpHeaders } from 'http';
|
|
4
|
+
export interface ConduitRouteParameters {
|
|
5
|
+
params?: {
|
|
6
|
+
[field: string]: any;
|
|
7
|
+
};
|
|
8
|
+
path?: string;
|
|
9
|
+
headers: IncomingHttpHeaders;
|
|
10
|
+
context?: {
|
|
11
|
+
[field: string]: any;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare enum RouteOptionType {
|
|
15
|
+
String = "String",
|
|
16
|
+
Number = "Number",
|
|
17
|
+
Boolean = "Boolean",
|
|
18
|
+
Date = "Date",
|
|
19
|
+
ObjectId = "ObjectId",
|
|
20
|
+
JSON = "JSON"
|
|
21
|
+
}
|
|
22
|
+
export interface ConduitRouteOptionExtended {
|
|
23
|
+
type: RouteOptionType;
|
|
24
|
+
required: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ConduitRouteOption {
|
|
27
|
+
[field: string]: string | string[] | ConduitRouteOptionExtended | RouteOptionType | RouteOptionType[];
|
|
28
|
+
}
|
|
29
|
+
export declare enum ConduitRouteActions {
|
|
30
|
+
GET = "GET",
|
|
31
|
+
POST = "POST",
|
|
32
|
+
UPDATE = "PUT",
|
|
33
|
+
PATCH = "PATCH",
|
|
34
|
+
DELETE = "DELETE"
|
|
35
|
+
}
|
|
36
|
+
export interface ConduitRouteOptions {
|
|
37
|
+
queryParams?: ConduitRouteOption | ConduitModel;
|
|
38
|
+
bodyParams?: ConduitRouteOption | ConduitModel;
|
|
39
|
+
urlParams?: ConduitRouteOption | ConduitModel;
|
|
40
|
+
action: ConduitRouteActions;
|
|
41
|
+
path: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
middlewares?: string[];
|
|
45
|
+
cacheControl?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ConduitRouteObject {
|
|
48
|
+
options: ConduitRouteOptions;
|
|
49
|
+
returns: {
|
|
50
|
+
name: string;
|
|
51
|
+
fields: string;
|
|
52
|
+
};
|
|
53
|
+
grpcFunction: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Route.js","sourceRoot":"","sources":["../../src/interfaces/Route.ts"],"names":[],"mappings":";;;AAUA,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TYPE } from './Model';
|
|
2
|
+
import { ConduitRouteReturnDefinition } from '../classes';
|
|
3
|
+
import { RequestHandlers } from '../helpers';
|
|
4
|
+
export declare type ConduitSocketParamTypes = (TYPE | ConduitSocketParamTypes)[];
|
|
5
|
+
export interface ConduitSocketOptions {
|
|
6
|
+
path: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
middlewares?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ConduitSocketEvent {
|
|
12
|
+
params?: ConduitSocketParamTypes;
|
|
13
|
+
returnType?: ConduitRouteReturnDefinition;
|
|
14
|
+
handler: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ConduitSocketEventHandler {
|
|
17
|
+
params?: ConduitSocketParamTypes;
|
|
18
|
+
returnType?: ConduitRouteReturnDefinition;
|
|
19
|
+
handler: RequestHandlers;
|
|
20
|
+
}
|
|
21
|
+
export interface EventsProtoDescription {
|
|
22
|
+
[name: string]: {
|
|
23
|
+
grpcFunction: string;
|
|
24
|
+
params: string;
|
|
25
|
+
returns: {
|
|
26
|
+
name: string;
|
|
27
|
+
fields: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface SocketProtoDescription {
|
|
32
|
+
options: ConduitSocketOptions;
|
|
33
|
+
events: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function instanceOfSocketProtoDescription(object) {
|
|
4
|
+
if (!('options' in object)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
return 'events' in object && object.events !== '';
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Socket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Socket.js","sourceRoot":"","sources":["../../src/interfaces/Socket.ts"],"names":[],"mappings":";;AAyCA,SAAS,gCAAgC,CAAC,MAAW;IACnD,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE;QAC1B,OAAO,KAAK,CAAC;KACd;IAED,OAAO,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./ConduitService"), exports);
|
|
14
|
+
__exportStar(require("./Model"), exports);
|
|
15
|
+
__exportStar(require("./Route"), exports);
|
|
16
|
+
__exportStar(require("./Middleware"), exports);
|
|
17
|
+
__exportStar(require("./Socket"), exports);
|
|
18
|
+
__exportStar(require("./GrpcCallback"), exports);
|
|
19
|
+
__exportStar(require("./Indexable"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AACjC,0CAAwB;AACxB,0CAAwB;AACxB,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,8CAA4B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConduitModule } from '../../classes/ConduitModule';
|
|
2
|
+
import { GrpcServer } from '../../classes';
|
|
3
|
+
import { AdminDefinition } from '../../protoUtils/core';
|
|
4
|
+
import { Indexable } from '../../interfaces';
|
|
5
|
+
import { ParsedRouterRequest } from '../../types';
|
|
6
|
+
export declare class Admin extends ConduitModule<typeof AdminDefinition> {
|
|
7
|
+
private readonly moduleName;
|
|
8
|
+
constructor(moduleName: string, url: string, grpcToken?: string);
|
|
9
|
+
registerAdminAsync(server: GrpcServer, paths: Indexable[], functions: {
|
|
10
|
+
[name: string]: (call: ParsedRouterRequest, callback?: Indexable) => Promise<any>;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
register(paths: Indexable[], protoFile?: string, serverUrl?: string): Promise<any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.Admin = void 0;
|
|
58
|
+
var path_1 = __importDefault(require("path"));
|
|
59
|
+
var ConduitModule_1 = require("../../classes/ConduitModule");
|
|
60
|
+
var fs_1 = __importDefault(require("fs"));
|
|
61
|
+
var core_1 = require("../../protoUtils/core");
|
|
62
|
+
var helpers_1 = require("../../helpers");
|
|
63
|
+
var utilities_1 = require("../../utilities");
|
|
64
|
+
var protofile_template = "\nsyntax = \"proto3\";\npackage MODULE_NAME.admin;\n\nservice Admin {\n MODULE_FUNCTIONS\n}\n\n// all admin requests accept the params,headers and context objects as stringified json\nmessage AdminRequest {\n string params = 1;\n string headers = 2;\n string context = 3;\n string path = 4;\n}\n// all admin responses return their results as stringified json\nmessage AdminResponse {\n string result = 1;\n string redirect = 2;\n}\n";
|
|
65
|
+
var Admin = /** @class */ (function (_super) {
|
|
66
|
+
__extends(Admin, _super);
|
|
67
|
+
function Admin(moduleName, url, grpcToken) {
|
|
68
|
+
var _this = _super.call(this, moduleName, 'admin', url, grpcToken) || this;
|
|
69
|
+
_this.moduleName = moduleName;
|
|
70
|
+
_this.initializeClient(core_1.AdminDefinition);
|
|
71
|
+
return _this;
|
|
72
|
+
}
|
|
73
|
+
Admin.prototype.registerAdminAsync = function (server, paths, functions) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var modifiedFunctions, protoFunctions, protoFile, protoPath;
|
|
76
|
+
var _this = this;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
modifiedFunctions = {};
|
|
81
|
+
Object.keys(functions).forEach(function (key) {
|
|
82
|
+
modifiedFunctions[key] = helpers_1.wrapRouterGrpcFunction(functions[key]);
|
|
83
|
+
});
|
|
84
|
+
protoFunctions = '';
|
|
85
|
+
paths.forEach(function (r) {
|
|
86
|
+
protoFunctions += "rpc " + (r.grpcFunction.charAt(0).toUpperCase() + r.grpcFunction.slice(1)) + "(AdminRequest) returns (AdminResponse);\n";
|
|
87
|
+
});
|
|
88
|
+
protoFile = protofile_template
|
|
89
|
+
.toString()
|
|
90
|
+
.replace('MODULE_FUNCTIONS', protoFunctions);
|
|
91
|
+
protoFile = protoFile.replace('MODULE_NAME', this.moduleName);
|
|
92
|
+
protoPath = path_1.default.resolve(__dirname, Math.random().toString(36).substring(7));
|
|
93
|
+
fs_1.default.writeFileSync(protoPath, protoFile);
|
|
94
|
+
return [4 /*yield*/, server.addService(protoPath, this.moduleName + '.admin.Admin', modifiedFunctions)];
|
|
95
|
+
case 1:
|
|
96
|
+
_a.sent();
|
|
97
|
+
// fs.unlinkSync(protoPath);
|
|
98
|
+
//added sleep as a precaution
|
|
99
|
+
// With this register process there is a chance that the config instances will
|
|
100
|
+
// not have the url of the service yet. In order to avoid this I've added the sleep period.
|
|
101
|
+
// One case is to register to config module X and the admin package to request the url from
|
|
102
|
+
// config module Y that hasn't been informed yet. It may be a rare case but this will help defend against it.
|
|
103
|
+
return [2 /*return*/, utilities_1.sleep(3000).then(function () { return _this.register(paths, protoFile); })];
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
Admin.prototype.register = function (paths, protoFile, serverUrl) {
|
|
109
|
+
var protoFunctions = '';
|
|
110
|
+
paths.forEach(function (r) {
|
|
111
|
+
if (!protoFile) {
|
|
112
|
+
protoFunctions += "rpc " + (r.protoName.charAt(0).toUpperCase() + r.protoName.slice(1)) + "(AdminRequest) returns (AdminResponse);\n";
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (!protoFile) {
|
|
116
|
+
protoFile = protofile_template
|
|
117
|
+
.toString()
|
|
118
|
+
.replace('MODULE_FUNCTIONS', protoFunctions);
|
|
119
|
+
protoFile = protoFile.replace('MODULE_NAME', this.moduleName);
|
|
120
|
+
}
|
|
121
|
+
var request = {
|
|
122
|
+
routes: paths,
|
|
123
|
+
protoFile: protoFile,
|
|
124
|
+
adminUrl: serverUrl,
|
|
125
|
+
};
|
|
126
|
+
return this.client.registerAdminRoute(request);
|
|
127
|
+
};
|
|
128
|
+
return Admin;
|
|
129
|
+
}(ConduitModule_1.ConduitModule));
|
|
130
|
+
exports.Admin = Admin;
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/admin/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConduitModule } from '../../classes/ConduitModule';
|
|
2
|
+
import { AuthenticationDefinition, SetConfigResponse, UserCreateResponse, UserDeleteResponse, UserLoginResponse } from '../../protoUtils/authentication';
|
|
3
|
+
export declare class Authentication extends ConduitModule<typeof AuthenticationDefinition> {
|
|
4
|
+
private readonly moduleName;
|
|
5
|
+
constructor(moduleName: string, url: string, grpcToken?: string);
|
|
6
|
+
setConfig(newConfig: any): Promise<SetConfigResponse>;
|
|
7
|
+
userLogin(userId: string, clientId: string): Promise<UserLoginResponse>;
|
|
8
|
+
userDelete(userId: string): Promise<UserDeleteResponse>;
|
|
9
|
+
userCreate(email: string, verify?: boolean, password?: string): Promise<UserCreateResponse>;
|
|
10
|
+
changePass(email: string, password?: string): Promise<UserCreateResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Authentication = void 0;
|
|
19
|
+
var ConduitModule_1 = require("../../classes/ConduitModule");
|
|
20
|
+
var authentication_1 = require("../../protoUtils/authentication");
|
|
21
|
+
var Authentication = /** @class */ (function (_super) {
|
|
22
|
+
__extends(Authentication, _super);
|
|
23
|
+
function Authentication(moduleName, url, grpcToken) {
|
|
24
|
+
var _this = _super.call(this, moduleName, 'authentication', url, grpcToken) || this;
|
|
25
|
+
_this.moduleName = moduleName;
|
|
26
|
+
_this.initializeClient(authentication_1.AuthenticationDefinition);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
Authentication.prototype.setConfig = function (newConfig) {
|
|
30
|
+
return this.client.setConfig({ newConfig: JSON.stringify(newConfig) }).then(function (res) {
|
|
31
|
+
return JSON.parse(res.updatedConfig);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Authentication.prototype.userLogin = function (userId, clientId) {
|
|
35
|
+
return this.client.userLogin({ userId: userId, clientId: clientId });
|
|
36
|
+
};
|
|
37
|
+
Authentication.prototype.userDelete = function (userId) {
|
|
38
|
+
return this.client.userDelete({ userId: userId });
|
|
39
|
+
};
|
|
40
|
+
Authentication.prototype.userCreate = function (email, verify, password) {
|
|
41
|
+
if (verify === void 0) { verify = false; }
|
|
42
|
+
return this.client.userCreate({ email: email, verify: verify, password: password });
|
|
43
|
+
};
|
|
44
|
+
Authentication.prototype.changePass = function (email, password) {
|
|
45
|
+
return this.client.changePass({ email: email, password: password });
|
|
46
|
+
};
|
|
47
|
+
return Authentication;
|
|
48
|
+
}(ConduitModule_1.ConduitModule));
|
|
49
|
+
exports.Authentication = Authentication;
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/authentication/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,6DAA4D;AAC5D,kEAMyC;AAEzC;IAAoC,kCAA8C;IAChF,wBAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAAhF,YACE,kBAAM,UAAU,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,CAAC,SAEpD;QAH4B,gBAAU,GAAV,UAAU,CAAQ;QAE7C,KAAI,CAAC,gBAAgB,CAAC,yCAAwB,CAAC,CAAC;;IAClD,CAAC;IAED,kCAAS,GAAT,UAAU,SAAc;QACtB,OAAO,IAAI,CAAC,MAAO,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG;YAC9E,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kCAAS,GAAT,UAAU,MAAc,EAAE,QAAgB;QACxC,OAAO,IAAI,CAAC,MAAO,CAAC,SAAS,CAAC,EAAE,MAAM,QAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,mCAAU,GAAV,UAAW,MAAc;QACvB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,mCAAU,GAAV,UACE,KAAa,EACb,MAAuB,EACvB,QAAiB;QADjB,uBAAA,EAAA,cAAuB;QAGvB,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,mCAAU,GAAV,UAAW,KAAa,EAAE,QAAiB;QACzC,OAAO,IAAI,CAAC,MAAO,CAAC,UAAU,CAAC,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC;IACtD,CAAC;IACH,qBAAC;AAAD,CAAC,AA/BD,CAAoC,6BAAa,GA+BhD;AA/BY,wCAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConduitModule } from '../../classes/ConduitModule';
|
|
2
|
+
import { ChatDefinition, Room, SendMessageRequest } from '../../protoUtils/chat';
|
|
3
|
+
export declare class Chat extends ConduitModule<typeof ChatDefinition> {
|
|
4
|
+
private readonly moduleName;
|
|
5
|
+
constructor(moduleName: string, url: string, grpcToken?: string);
|
|
6
|
+
setConfig(newConfig: any): Promise<any>;
|
|
7
|
+
sendMessage(messageData: SendMessageRequest): Promise<any>;
|
|
8
|
+
createRoom(name: string, participants: string[]): Promise<Room>;
|
|
9
|
+
deleteRoom(id: string): Promise<Room>;
|
|
10
|
+
}
|