@conduitplatform/grpc-sdk 0.16.0-alpha.9 → 0.16.0-rc.0
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/dist/classes/ConduitAuthorizedResource.js +5 -6
- package/dist/classes/ConduitAuthorizedResource.js.map +1 -1
- package/dist/classes/ConduitModule.js +59 -162
- package/dist/classes/ConduitModule.js.map +1 -1
- package/dist/classes/ConduitSchema.js +3 -4
- package/dist/classes/ConduitSchema.js.map +1 -1
- package/dist/classes/Error.js +17 -40
- package/dist/classes/Error.js.map +1 -1
- package/dist/classes/HealthCheck.js +28 -96
- package/dist/classes/HealthCheck.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +300 -462
- package/dist/index.js.map +1 -1
- package/dist/interceptors/grpcSignedToken.d.ts +1 -1
- package/dist/interceptors/grpcSignedToken.js +7 -79
- package/dist/interceptors/grpcSignedToken.js.map +1 -1
- package/dist/interceptors/moduleName.d.ts +1 -1
- package/dist/interceptors/moduleName.js +7 -79
- package/dist/interceptors/moduleName.js.map +1 -1
- package/dist/interfaces/ConduitRouteReturn.js +9 -18
- package/dist/interfaces/ConduitRouteReturn.js.map +1 -1
- package/dist/interfaces/GrpcCallback.d.ts +1 -1
- package/dist/interfaces/Indexable.d.ts +7 -7
- package/dist/interfaces/Model.d.ts +19 -16
- package/dist/interfaces/Params.d.ts +3 -3
- package/dist/interfaces/RawQuery.d.ts +2 -2
- package/dist/interfaces/Route.d.ts +12 -9
- package/dist/interfaces/Route.js.map +1 -1
- package/dist/interfaces/Socket.d.ts +1 -1
- package/dist/interfaces/UntypedArray.d.ts +1 -1
- package/dist/interfaces/types.d.ts +6 -6
- package/dist/module.proto +58 -0
- package/dist/modules/admin/index.d.ts +2 -3
- package/dist/modules/admin/index.js +13 -39
- package/dist/modules/admin/index.js.map +1 -1
- package/dist/modules/authentication/index.d.ts +6 -2
- package/dist/modules/authentication/index.js +33 -40
- package/dist/modules/authentication/index.js.map +1 -1
- package/dist/modules/authorization/index.d.ts +4 -1
- package/dist/modules/authorization/index.js +38 -47
- package/dist/modules/authorization/index.js.map +1 -1
- package/dist/modules/chat/index.js +16 -34
- package/dist/modules/chat/index.js.map +1 -1
- package/dist/modules/config/index.d.ts +10 -1
- package/dist/modules/config/index.js +82 -177
- package/dist/modules/config/index.js.map +1 -1
- package/dist/modules/core/index.js +8 -26
- package/dist/modules/core/index.js.map +1 -1
- package/dist/modules/database/index.d.ts +19 -10
- package/dist/modules/database/index.js +184 -125
- package/dist/modules/database/index.js.map +1 -1
- package/dist/modules/email/index.js +15 -33
- package/dist/modules/email/index.js.map +1 -1
- package/dist/modules/pushNotifications/index.d.ts +4 -4
- package/dist/modules/pushNotifications/index.js +38 -60
- package/dist/modules/pushNotifications/index.js.map +1 -1
- package/dist/modules/router/index.d.ts +2 -3
- package/dist/modules/router/index.js +15 -41
- package/dist/modules/router/index.js.map +1 -1
- package/dist/modules/sms/index.js +17 -35
- package/dist/modules/sms/index.js.map +1 -1
- package/dist/modules/storage/index.d.ts +7 -7
- package/dist/modules/storage/index.js +64 -55
- package/dist/modules/storage/index.js.map +1 -1
- package/dist/protoUtils/authentication.d.ts +200 -4
- package/dist/protoUtils/authentication.js +789 -194
- package/dist/protoUtils/authentication.js.map +1 -1
- package/dist/protoUtils/authorization.d.ts +155 -5
- package/dist/protoUtils/authorization.js +860 -447
- package/dist/protoUtils/authorization.js.map +1 -1
- package/dist/protoUtils/chat.d.ts +18 -7
- package/dist/protoUtils/chat.js +210 -227
- package/dist/protoUtils/chat.js.map +1 -1
- package/dist/protoUtils/core.d.ts +55 -50
- package/dist/protoUtils/core.js +1018 -902
- package/dist/protoUtils/core.js.map +1 -1
- package/dist/protoUtils/database.d.ts +262 -16
- package/dist/protoUtils/database.js +1489 -832
- package/dist/protoUtils/database.js.map +1 -1
- package/dist/protoUtils/email.d.ts +13 -4
- package/dist/protoUtils/email.js +242 -253
- package/dist/protoUtils/email.js.map +1 -1
- package/dist/protoUtils/google/protobuf/empty.d.ts +4 -3
- package/dist/protoUtils/google/protobuf/empty.js +21 -38
- package/dist/protoUtils/google/protobuf/empty.js.map +1 -1
- package/dist/protoUtils/grpc_health_check.d.ts +10 -4
- package/dist/protoUtils/grpc_health_check.js +72 -83
- package/dist/protoUtils/grpc_health_check.js.map +1 -1
- package/dist/protoUtils/module.d.ts +202 -4
- package/dist/protoUtils/module.js +810 -72
- package/dist/protoUtils/module.js.map +1 -1
- package/dist/protoUtils/push-notifications.d.ts +26 -6
- package/dist/protoUtils/push-notifications.js +381 -317
- package/dist/protoUtils/push-notifications.js.map +1 -1
- package/dist/protoUtils/router.d.ts +18 -48
- package/dist/protoUtils/router.js +502 -560
- package/dist/protoUtils/router.js.map +1 -1
- package/dist/protoUtils/sms.d.ts +16 -4
- package/dist/protoUtils/sms.js +199 -175
- package/dist/protoUtils/sms.js.map +1 -1
- package/dist/protoUtils/storage.d.ts +37 -4
- package/dist/protoUtils/storage.js +639 -318
- package/dist/protoUtils/storage.js.map +1 -1
- package/dist/types/db.d.ts +13 -11
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +6 -24
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/EventBus.d.ts +3 -1
- package/dist/utilities/EventBus.js +38 -17
- package/dist/utilities/EventBus.js.map +1 -1
- package/dist/utilities/RedisManager.js +11 -21
- package/dist/utilities/RedisManager.js.map +1 -1
- package/dist/utilities/StateManager.d.ts +9 -0
- package/dist/utilities/StateManager.js +58 -15
- package/dist/utilities/StateManager.js.map +1 -1
- package/dist/utilities/env.js +4 -4
- package/dist/utilities/env.js.map +1 -1
- package/dist/utilities/sleep.js +1 -1
- package/dist/utilities/sleep.js.map +1 -1
- package/package.json +26 -19
|
@@ -1,158 +1,107 @@
|
|
|
1
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 __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
54
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
55
|
-
var m = o[Symbol.asyncIterator], i;
|
|
56
|
-
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);
|
|
57
|
-
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); }); }; }
|
|
58
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
59
|
-
};
|
|
60
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
61
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
62
4
|
};
|
|
63
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
64
6
|
exports.Config = void 0;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
_this._serviceHealthStatusGetter = serviceHealthStatusGetter;
|
|
79
|
-
return _this;
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const classes_1 = require("../../classes");
|
|
9
|
+
const types_1 = require("../../types");
|
|
10
|
+
const core_1 = require("../../protoUtils/core");
|
|
11
|
+
const index_1 = __importDefault(require("../../index"));
|
|
12
|
+
class Config extends classes_1.ConduitModule {
|
|
13
|
+
constructor(moduleName, url, serviceHealthStatusGetter, grpcToken) {
|
|
14
|
+
super(moduleName, 'config', url, grpcToken);
|
|
15
|
+
this.url = url;
|
|
16
|
+
this.emitter = new events_1.EventEmitter();
|
|
17
|
+
this.coreLive = false;
|
|
18
|
+
this.initializeClient(core_1.ConfigDefinition);
|
|
19
|
+
this._serviceHealthStatusGetter = serviceHealthStatusGetter;
|
|
80
20
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return this.client.getServerConfig(request).then(
|
|
21
|
+
getServerConfig() {
|
|
22
|
+
const request = {};
|
|
23
|
+
return this.client.getServerConfig(request).then(res => {
|
|
84
24
|
return JSON.parse(res.data);
|
|
85
25
|
});
|
|
86
|
-
}
|
|
87
|
-
|
|
26
|
+
}
|
|
27
|
+
getModuleUrlByName(name) {
|
|
88
28
|
if (name === 'core')
|
|
89
29
|
return Promise.resolve({ url: this.url });
|
|
90
|
-
return this.client.getModuleUrlByName({ name: name }).then(
|
|
30
|
+
return this.client.getModuleUrlByName({ name: name }).then(res => {
|
|
91
31
|
return { url: res.moduleUrl };
|
|
92
32
|
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
33
|
+
}
|
|
34
|
+
get(name) {
|
|
35
|
+
const request = {
|
|
96
36
|
key: name,
|
|
97
37
|
};
|
|
98
|
-
return this.client.get(request).then(
|
|
38
|
+
return this.client.get(request).then(res => {
|
|
99
39
|
return JSON.parse(res.data);
|
|
100
40
|
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
41
|
+
}
|
|
42
|
+
configure(config, schema, override) {
|
|
43
|
+
const request = {
|
|
104
44
|
config: JSON.stringify(config),
|
|
105
45
|
schema: JSON.stringify(schema),
|
|
106
|
-
override
|
|
46
|
+
override,
|
|
107
47
|
};
|
|
108
|
-
return this.client.configure(request).then(
|
|
48
|
+
return this.client.configure(request).then(res => {
|
|
109
49
|
return JSON.parse(res.result);
|
|
110
50
|
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
51
|
+
}
|
|
52
|
+
moduleExists(name) {
|
|
53
|
+
const request = {
|
|
114
54
|
moduleName: name,
|
|
115
55
|
};
|
|
116
56
|
return this.client.moduleExists(request);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var request = {};
|
|
57
|
+
}
|
|
58
|
+
moduleList() {
|
|
59
|
+
const request = {};
|
|
121
60
|
return this.client.moduleList(request)
|
|
122
|
-
.then(
|
|
123
|
-
.catch(
|
|
124
|
-
if (
|
|
61
|
+
.then(res => res.modules)
|
|
62
|
+
.catch(err => {
|
|
63
|
+
if (this._clientName === 'core')
|
|
125
64
|
return [];
|
|
126
65
|
throw err;
|
|
127
66
|
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
67
|
+
}
|
|
68
|
+
async getRedisDetails() {
|
|
69
|
+
const request = {};
|
|
70
|
+
const r = await this.client.getRedisDetails(request);
|
|
71
|
+
return {
|
|
72
|
+
...(r.standalone ? { standalone: JSON.parse(r.standalone) } : undefined),
|
|
73
|
+
...(r.cluster ? { cluster: JSON.parse(r.cluster) } : undefined),
|
|
74
|
+
// maintain backwards compatibility with <=grpc-sdk-v0.16.0-alpha.20
|
|
75
|
+
redisHost: r.redisHost,
|
|
76
|
+
redisPort: r.redisPort,
|
|
77
|
+
redisUsername: r.redisUsername,
|
|
78
|
+
redisPassword: r.redisPassword,
|
|
79
|
+
redisConfig: r.redisConfig,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
registerModule(name, url, healthStatus) {
|
|
83
|
+
const request = {
|
|
135
84
|
moduleName: name.toString(),
|
|
136
85
|
url: url.toString(),
|
|
137
86
|
healthStatus: healthStatus,
|
|
138
87
|
};
|
|
139
|
-
|
|
140
|
-
return this.client.registerModule(request).then(
|
|
88
|
+
const self = this;
|
|
89
|
+
return this.client.registerModule(request).then(res => {
|
|
141
90
|
self.coreLive = true;
|
|
142
91
|
return res.result;
|
|
143
92
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
93
|
+
}
|
|
94
|
+
moduleHealthProbe(name, url) {
|
|
95
|
+
const request = {
|
|
147
96
|
moduleName: name.toString(),
|
|
148
|
-
url
|
|
97
|
+
url,
|
|
149
98
|
status: this._serviceHealthStatusGetter
|
|
150
99
|
? this._serviceHealthStatusGetter()
|
|
151
100
|
: types_1.HealthCheckStatus.SERVICE_UNKNOWN,
|
|
152
101
|
};
|
|
153
|
-
|
|
102
|
+
const self = this;
|
|
154
103
|
this.client.moduleHealthProbe(request)
|
|
155
|
-
.then(
|
|
104
|
+
.then(res => {
|
|
156
105
|
if (!res && self.coreLive) {
|
|
157
106
|
index_1.default.Logger.warn('Core unhealthy');
|
|
158
107
|
self.coreLive = false;
|
|
@@ -163,75 +112,31 @@ var Config = /** @class */ (function (_super) {
|
|
|
163
112
|
self.watchModules();
|
|
164
113
|
}
|
|
165
114
|
})
|
|
166
|
-
.catch(
|
|
115
|
+
.catch(() => {
|
|
167
116
|
if (self.coreLive) {
|
|
168
117
|
index_1.default.Logger.warn('Core unhealthy');
|
|
169
118
|
self.coreLive = false;
|
|
170
119
|
}
|
|
171
120
|
});
|
|
172
|
-
}
|
|
173
|
-
|
|
121
|
+
}
|
|
122
|
+
getModuleWatcher() {
|
|
174
123
|
return this.emitter;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
_e.trys.push([2, 15, , 16]);
|
|
193
|
-
call = this.client.watchModules({});
|
|
194
|
-
_e.label = 3;
|
|
195
|
-
case 3:
|
|
196
|
-
_e.trys.push([3, 8, 9, 14]);
|
|
197
|
-
call_1 = __asyncValues(call);
|
|
198
|
-
_e.label = 4;
|
|
199
|
-
case 4: return [4 /*yield*/, call_1.next()];
|
|
200
|
-
case 5:
|
|
201
|
-
if (!(call_1_1 = _e.sent(), !call_1_1.done)) return [3 /*break*/, 7];
|
|
202
|
-
data = call_1_1.value;
|
|
203
|
-
self.emitter.emit('serving-modules-update', data.modules);
|
|
204
|
-
_e.label = 6;
|
|
205
|
-
case 6: return [3 /*break*/, 4];
|
|
206
|
-
case 7: return [3 /*break*/, 14];
|
|
207
|
-
case 8:
|
|
208
|
-
e_1_1 = _e.sent();
|
|
209
|
-
e_1 = { error: e_1_1 };
|
|
210
|
-
return [3 /*break*/, 14];
|
|
211
|
-
case 9:
|
|
212
|
-
_e.trys.push([9, , 12, 13]);
|
|
213
|
-
if (!(call_1_1 && !call_1_1.done && (_a = call_1.return))) return [3 /*break*/, 11];
|
|
214
|
-
return [4 /*yield*/, _a.call(call_1)];
|
|
215
|
-
case 10:
|
|
216
|
-
_e.sent();
|
|
217
|
-
_e.label = 11;
|
|
218
|
-
case 11: return [3 /*break*/, 13];
|
|
219
|
-
case 12:
|
|
220
|
-
if (e_1) throw e_1.error;
|
|
221
|
-
return [7 /*endfinally*/];
|
|
222
|
-
case 13: return [7 /*endfinally*/];
|
|
223
|
-
case 14: return [3 /*break*/, 16];
|
|
224
|
-
case 15:
|
|
225
|
-
error_1 = _e.sent();
|
|
226
|
-
self.coreLive = false;
|
|
227
|
-
index_1.default.Logger.warn('Core unhealthy');
|
|
228
|
-
return [3 /*break*/, 16];
|
|
229
|
-
case 16: return [2 /*return*/];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
return Config;
|
|
235
|
-
}(classes_1.ConduitModule));
|
|
124
|
+
}
|
|
125
|
+
async watchModules() {
|
|
126
|
+
const self = this;
|
|
127
|
+
this.emitter.setMaxListeners(150);
|
|
128
|
+
self.emitter.emit('serving-modules-update', await self.moduleList().catch());
|
|
129
|
+
try {
|
|
130
|
+
const call = this.client.watchModules({});
|
|
131
|
+
for await (const data of call) {
|
|
132
|
+
self.emitter.emit('serving-modules-update', data.modules);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
self.coreLive = false;
|
|
137
|
+
index_1.default.Logger.warn('Core unhealthy');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
236
141
|
exports.Config = Config;
|
|
237
142
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/config/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAsC;AACtC,2CAA8C;AAC9C,uCAAgD;AAChD,gDAI+B;AAE/B,wDAAyC;AAGzC,MAAa,MAAO,SAAQ,uBAAsC;IAKhE,YACE,UAAkB,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;CACF;AAzJD,wBAyJC"}
|
|
@@ -1,32 +1,14 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.Core = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.initializeClient(core_1.CoreDefinition);
|
|
27
|
-
return _this;
|
|
4
|
+
const ConduitModule_1 = require("../../classes/ConduitModule");
|
|
5
|
+
const core_1 = require("../../protoUtils/core");
|
|
6
|
+
class Core extends ConduitModule_1.ConduitModule {
|
|
7
|
+
constructor(moduleName, url, grpcToken) {
|
|
8
|
+
super(moduleName, 'core', url, grpcToken);
|
|
9
|
+
this.moduleName = moduleName;
|
|
10
|
+
this.initializeClient(core_1.CoreDefinition);
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
}(ConduitModule_1.ConduitModule));
|
|
12
|
+
}
|
|
31
13
|
exports.Core = Core;
|
|
32
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/core/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,gDAAuD;AAEvD,MAAa,IAAK,SAAQ,6BAAoC;IAC5D,YAA6B,UAAkB,EAAE,GAAW,EAAE,SAAkB;QAC9E,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;QADf,eAAU,GAAV,UAAU,CAAQ;QAE7C,IAAI,CAAC,gBAAgB,CAAC,qBAAc,CAAC,CAAC;IACxC,CAAC;CACF;AALD,oBAKC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConduitModule } from '../../classes';
|
|
2
2
|
import { DatabaseProviderDefinition, DropCollectionResponse, Schema } from '../../protoUtils/database';
|
|
3
|
-
import { RawQuery, UntypedArray } from '../../interfaces';
|
|
3
|
+
import { Indexable, RawQuery, UntypedArray } from '../../interfaces';
|
|
4
4
|
import { Query } from '../../types/db';
|
|
5
5
|
import { ConduitSchema } from '../../classes/ConduitSchema';
|
|
6
6
|
import { ConduitSchemaExtension } from '../../interfaces/ConduitSchemaExtension';
|
|
@@ -24,19 +24,28 @@ export declare class DatabaseProvider extends ConduitModule<typeof DatabaseProvi
|
|
|
24
24
|
createSchemaFromAdapter(schema: ConduitSchema): Promise<Schema>;
|
|
25
25
|
setSchemaExtension(extension: ConduitSchemaExtension): Promise<Schema>;
|
|
26
26
|
processQuery<T>(query: Query<T>): string;
|
|
27
|
-
findOne<T>(schemaName: string, query: Query<T>, select?: string, populate?: string | string[]): Promise<T>;
|
|
27
|
+
findOne<T>(schemaName: string, query: Query<T>, select?: string, populate?: string | string[], userId?: string, scope?: string): Promise<T>;
|
|
28
28
|
findMany<T>(schemaName: string, query: Query<T>, select?: string, skip?: number, limit?: number, sort?: {
|
|
29
29
|
[field: string]: -1 | 1;
|
|
30
|
-
} | string[] | string, populate?: string | string[]): Promise<T[]>;
|
|
31
|
-
create<T>(schemaName: string, query: Query<T
|
|
32
|
-
createMany<T>(schemaName: string, query: Query<T>[]): Promise<T[] | UntypedArray>;
|
|
33
|
-
findByIdAndUpdate<T>(schemaName: string, id: string, document: Query<T>, populate?: string | string[]): Promise<T | any>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
} | string[] | string, populate?: string | string[], userId?: string, scope?: string): Promise<T[]>;
|
|
31
|
+
create<T>(schemaName: string, query: Query<T>, userId?: string, scope?: string): Promise<T>;
|
|
32
|
+
createMany<T>(schemaName: string, query: Query<T>[], userId?: string, scope?: string): Promise<T[] | UntypedArray>;
|
|
33
|
+
findByIdAndUpdate<T>(schemaName: string, id: string, document: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<T | any>;
|
|
34
|
+
findByIdAndReplace<T>(schemaName: string, id: string, document: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<T | any>;
|
|
35
|
+
updateMany<T>(schemaName: string, filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
|
|
36
|
+
updateOne<T>(schemaName: string, filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
|
|
37
|
+
replaceOne<T>(schemaName: string, filterQuery: Query<T>, query: Query<T>, populate?: string | string[], userId?: string, scope?: string): Promise<any>;
|
|
38
|
+
deleteOne<T>(schemaName: string, query: Query<T>, userId?: string, scope?: string): Promise<any>;
|
|
39
|
+
deleteMany<T>(schemaName: string, query: Query<T>, userId?: string, scope?: string): Promise<any>;
|
|
40
|
+
countDocuments<T>(schemaName: string, query: Query<T>, userId?: string, scope?: string): Promise<number>;
|
|
38
41
|
rawQuery(schemaName: string, query: RawQuery): Promise<any>;
|
|
42
|
+
createView(schemaName: string, viewName: string, joinedSchemas: string[], query: {
|
|
43
|
+
mongoQuery?: Indexable;
|
|
44
|
+
sqlQuery?: string;
|
|
45
|
+
}): Promise<import("../../protoUtils/google/protobuf/empty").Empty>;
|
|
46
|
+
deleteView(viewName: string): Promise<import("../../protoUtils/google/protobuf/empty").Empty>;
|
|
39
47
|
columnExistence(schemaName: string, columns: string[]): Promise<boolean>;
|
|
40
48
|
migrate(schemaName: string): Promise<import("../../protoUtils/google/protobuf/empty").Empty>;
|
|
49
|
+
getDatabaseType(): Promise<import("../../protoUtils/database").GetDatabaseTypeResponse>;
|
|
41
50
|
private constructSortObj;
|
|
42
51
|
}
|