@restorecommerce/chassis-srv 0.3.3 → 0.3.7
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/CHANGELOG.md +19 -0
- package/lib/cache/index.js +22 -3
- package/lib/cache/index.js.map +1 -1
- package/lib/command-interface/index.d.ts +3 -3
- package/lib/command-interface/index.js +432 -498
- package/lib/command-interface/index.js.map +1 -1
- package/lib/config/index.js +6 -15
- package/lib/config/index.js.map +1 -1
- package/lib/database/index.d.ts +2 -4
- package/lib/database/index.js +4 -13
- package/lib/database/index.js.map +1 -1
- package/lib/database/provider/arango/base.js +314 -322
- package/lib/database/provider/arango/base.js.map +1 -1
- package/lib/database/provider/arango/common.js +70 -57
- package/lib/database/provider/arango/common.js.map +1 -1
- package/lib/database/provider/arango/graph.d.ts +4 -8
- package/lib/database/provider/arango/graph.js +335 -470
- package/lib/database/provider/arango/graph.js.map +1 -1
- package/lib/database/provider/arango/index.js +34 -21
- package/lib/database/provider/arango/index.js.map +1 -1
- package/lib/database/provider/arango/interface.d.ts +70 -0
- package/lib/database/provider/arango/interface.js +46 -0
- package/lib/database/provider/arango/interface.js.map +1 -0
- package/lib/database/provider/arango/utils.d.ts +77 -0
- package/lib/database/provider/arango/utils.js +587 -0
- package/lib/database/provider/arango/utils.js.map +1 -0
- package/lib/database/provider/nedb/index.js +203 -206
- package/lib/database/provider/nedb/index.js.map +1 -1
- package/lib/health/index.js +36 -42
- package/lib/health/index.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +27 -6
- package/lib/index.js.map +1 -1
- package/lib/microservice/endpoint.js +33 -23
- package/lib/microservice/endpoint.js.map +1 -1
- package/lib/microservice/server.js +115 -106
- package/lib/microservice/server.js.map +1 -1
- package/lib/microservice/transport/provider/grpc/index.js +58 -52
- package/lib/microservice/transport/provider/grpc/index.js.map +1 -1
- package/lib/microservice/transport/provider/grpc/reflection.js +101 -93
- package/lib/microservice/transport/provider/grpc/reflection.js.map +1 -1
- package/lib/offsets/index.d.ts +2 -2
- package/lib/offsets/index.js +41 -42
- package/lib/offsets/index.js.map +1 -1
- package/package.json +29 -29
- package/tsconfig.json +13 -6
- package/setupTopics.js +0 -32
|
@@ -0,0 +1,587 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.createGraphsAssociationFilter = exports.buildGraphSorter = exports.autoCastRootKey = exports.buildGraphLimiter = exports.recursiveFindEntities = exports.buildGraphFilter = exports.buildGraphField = exports.buildComparison = exports.autoCastValue = exports.autoCastKey = exports.toTraversalFilterObject = void 0;
|
|
26
|
+
const _ = __importStar(require("lodash"));
|
|
27
|
+
const long_1 = __importDefault(require("long"));
|
|
28
|
+
const filterOperationMap = new Map([
|
|
29
|
+
[0, 'eq'],
|
|
30
|
+
[1, 'lt'],
|
|
31
|
+
[2, 'lte'],
|
|
32
|
+
[3, 'gt'],
|
|
33
|
+
[4, 'gte'],
|
|
34
|
+
[5, 'isEmpty'],
|
|
35
|
+
[6, 'iLike'],
|
|
36
|
+
[7, 'in'],
|
|
37
|
+
[8, 'neq']
|
|
38
|
+
]);
|
|
39
|
+
const filterOperatorMap = new Map([
|
|
40
|
+
[0, 'and'],
|
|
41
|
+
[1, 'or']
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Takes filter object containing field, operation and value and inserts it
|
|
45
|
+
* to the obj using the operatorList for finding the last operator position and updates obj
|
|
46
|
+
* @param {filter} filter object containing field, operation, value and type
|
|
47
|
+
* @param {obj} obj converted filter object
|
|
48
|
+
* @param {operatorList} operatorList list of operators from original filter object
|
|
49
|
+
*/
|
|
50
|
+
const convertFilterToObject = (filter, obj, operatorList) => {
|
|
51
|
+
let temp = _.clone(obj);
|
|
52
|
+
let value;
|
|
53
|
+
if (!filter.type || filter.type === 'STRING' || filter.type === 0) {
|
|
54
|
+
value = filter.value;
|
|
55
|
+
}
|
|
56
|
+
else if ((filter.type === 'NUMBER' || filter.type === 1) && !isNaN(filter.value)) {
|
|
57
|
+
value = Number(filter.value);
|
|
58
|
+
}
|
|
59
|
+
else if (filter.type === 'BOOLEAN' || filter.type === 2) {
|
|
60
|
+
if (filter.value === 'true') {
|
|
61
|
+
value = true;
|
|
62
|
+
}
|
|
63
|
+
else if (filter.value === 'false') {
|
|
64
|
+
value = false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (filter.type === 'ARRAY' || filter.type === 4) {
|
|
68
|
+
try {
|
|
69
|
+
value = JSON.parse(filter.value);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
// to handle JSON string parse error
|
|
73
|
+
if (err.message.indexOf('Unexpected token') > -1) {
|
|
74
|
+
value = JSON.parse(JSON.stringify(filter.value));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (filter.type === 'DATE' || filter.type === 3) {
|
|
82
|
+
value = (new Date(filter.value)).getTime();
|
|
83
|
+
}
|
|
84
|
+
for (let i = 0; i < operatorList.length; i++) {
|
|
85
|
+
if (_.isArray(temp)) {
|
|
86
|
+
temp = _.find(temp, operatorList[i]);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
temp = temp[operatorList[i]];
|
|
90
|
+
}
|
|
91
|
+
if (i === (operatorList.length - 1)) {
|
|
92
|
+
// push for final element in the operatorList array
|
|
93
|
+
if (filter.operation === 'eq' || filter.operation === 0) {
|
|
94
|
+
if (_.isArray(temp)) {
|
|
95
|
+
temp.push({ [filter.field]: value });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
temp[operatorList[i]].push({ [filter.field]: value });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (filter.operation === 'neq' || filter.operation === 8) {
|
|
102
|
+
if (_.isArray(temp)) {
|
|
103
|
+
temp.push({ [filter.field]: { $not: { $eq: value } } });
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
temp[operatorList[i]].push({ [filter.field]: { $not: { $eq: value } } });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
let op, opValue;
|
|
111
|
+
if (typeof filter.operation === 'string' || filter.operation instanceof String) {
|
|
112
|
+
opValue = filter.operation;
|
|
113
|
+
}
|
|
114
|
+
else if (Number.isInteger(filter.operation)) {
|
|
115
|
+
opValue = filterOperationMap.get(filter.operation);
|
|
116
|
+
}
|
|
117
|
+
op = `$${opValue}`;
|
|
118
|
+
if (_.isArray(temp)) {
|
|
119
|
+
temp.push({ [filter.field]: { [op]: value } });
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
temp[operatorList[i]].push({ [filter.field]: { [op]: value } });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return obj;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Inserts the new operator into obj iterating throught the operator list and updates obj
|
|
131
|
+
* @param {obj} obj Converted filter object
|
|
132
|
+
* @param {operatorList} operatorList operator list
|
|
133
|
+
* @param {operatorNew} operatorNew new operator
|
|
134
|
+
*/
|
|
135
|
+
const insertNewOpAndUpdateObj = (obj, operatorList, operatorNew) => {
|
|
136
|
+
let pos = _.clone(obj);
|
|
137
|
+
for (let i = 0; i < operatorList.length; i++) {
|
|
138
|
+
if (_.isArray(pos)) {
|
|
139
|
+
pos = _.find(pos, operatorList[i]);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
pos = pos[operatorList[i]];
|
|
143
|
+
}
|
|
144
|
+
// push new operator after iterating to the last element in operatorList
|
|
145
|
+
if (i === (operatorList.length - 1)) {
|
|
146
|
+
pos.push({ [operatorNew]: [] });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return obj;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* toTraversalFilterObject takes input contained in the proto structure defined in resource_base proto
|
|
153
|
+
* and converts it into Object understandable by the underlying DB implementation in chassis-srv
|
|
154
|
+
* @param {*} input Original filter input object
|
|
155
|
+
* @param {*} obj converted filter objected passed recursively
|
|
156
|
+
* @param {*} operatorList operatorlist updated and passed recursively
|
|
157
|
+
*/
|
|
158
|
+
const toTraversalFilterObject = (input, obj, operatorList) => {
|
|
159
|
+
// since toObject method is called recursively we are not adding the typing to input parameter
|
|
160
|
+
let filters;
|
|
161
|
+
if (input && !_.isEmpty(input.filters)) {
|
|
162
|
+
filters = input.filters;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
filters = input;
|
|
166
|
+
}
|
|
167
|
+
// const filters = _.cloneDeep( (input.filters && input.filters.length > 0) ? input.filters : input);
|
|
168
|
+
// by default use 'and' operator if no operator is specified
|
|
169
|
+
if (filters && _.isArray(filters.filter) && !filters.operator) {
|
|
170
|
+
filters.operator = 'and';
|
|
171
|
+
}
|
|
172
|
+
if (!obj) {
|
|
173
|
+
obj = {};
|
|
174
|
+
}
|
|
175
|
+
if (_.isArray(filters.filter)) {
|
|
176
|
+
let operatorValue;
|
|
177
|
+
if (typeof filters.operator === 'string' || filters.operator instanceof String) {
|
|
178
|
+
operatorValue = filters.operator;
|
|
179
|
+
}
|
|
180
|
+
else if (Number.isInteger(filters.operator)) {
|
|
181
|
+
operatorValue = filterOperatorMap.get(filters.operator);
|
|
182
|
+
}
|
|
183
|
+
const newOperator = `$${operatorValue}`;
|
|
184
|
+
if (operatorList && newOperator) {
|
|
185
|
+
// insert obj with new operator
|
|
186
|
+
obj = insertNewOpAndUpdateObj(obj, operatorList, newOperator);
|
|
187
|
+
operatorList.push(newOperator);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
operatorList = [newOperator];
|
|
191
|
+
obj[newOperator] = [];
|
|
192
|
+
}
|
|
193
|
+
// pass operatorList and obj recursively
|
|
194
|
+
(0, exports.toTraversalFilterObject)(filters.filter, obj, operatorList);
|
|
195
|
+
}
|
|
196
|
+
else if (_.isArray(filters)) {
|
|
197
|
+
for (let filterObj of filters) {
|
|
198
|
+
(0, exports.toTraversalFilterObject)(filterObj, obj, operatorList);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else if (filters.field && (filters.operation || filters.operation === 0) && filters.value) {
|
|
202
|
+
// object contains field, operation and value, update it on obj using convertFilterToObject()
|
|
203
|
+
obj = convertFilterToObject(filters, obj, operatorList);
|
|
204
|
+
}
|
|
205
|
+
return obj;
|
|
206
|
+
};
|
|
207
|
+
exports.toTraversalFilterObject = toTraversalFilterObject;
|
|
208
|
+
/**
|
|
209
|
+
* Auto-casting reference value by using native function of arangoDB
|
|
210
|
+
*
|
|
211
|
+
* @param {string} key
|
|
212
|
+
* @param {object} value - raw value optional
|
|
213
|
+
* @return {object} interpreted value
|
|
214
|
+
*/
|
|
215
|
+
const autoCastKey = (key, value) => {
|
|
216
|
+
if (_.isDate(value)) { // Date
|
|
217
|
+
return `DATE_TIMESTAMP(v.${key})`;
|
|
218
|
+
}
|
|
219
|
+
return 'v.' + key;
|
|
220
|
+
};
|
|
221
|
+
exports.autoCastKey = autoCastKey;
|
|
222
|
+
/**
|
|
223
|
+
* Auto-casting raw data
|
|
224
|
+
*
|
|
225
|
+
* @param {object} value - raw value
|
|
226
|
+
* @returns {any} interpreted value
|
|
227
|
+
*/
|
|
228
|
+
const autoCastValue = (value) => {
|
|
229
|
+
if (_.isArray(value)) {
|
|
230
|
+
return value.map(value => value.toString());
|
|
231
|
+
}
|
|
232
|
+
if (_.isString(value)) { // String
|
|
233
|
+
return JSON.stringify(value);
|
|
234
|
+
}
|
|
235
|
+
if (_.isBoolean(value)) { // Boolean
|
|
236
|
+
return Boolean(value);
|
|
237
|
+
}
|
|
238
|
+
if (_.isNumber(value)) {
|
|
239
|
+
return _.toNumber(value);
|
|
240
|
+
}
|
|
241
|
+
if (long_1.default.isLong(value)) {
|
|
242
|
+
return value.toNumber();
|
|
243
|
+
}
|
|
244
|
+
if (_.isDate(value)) { // Date
|
|
245
|
+
return new Date(value);
|
|
246
|
+
}
|
|
247
|
+
return value;
|
|
248
|
+
};
|
|
249
|
+
exports.autoCastValue = autoCastValue;
|
|
250
|
+
/**
|
|
251
|
+
* Links children of filter together via a comparision operator.
|
|
252
|
+
* @param {any} filter
|
|
253
|
+
* @param {string} op comparision operator
|
|
254
|
+
* @return {any} query template string and bind variables
|
|
255
|
+
*/
|
|
256
|
+
const buildComparison = (filter, op) => {
|
|
257
|
+
const ele = _.map(filter, (e) => {
|
|
258
|
+
if (!_.isArray(e)) {
|
|
259
|
+
e = [e];
|
|
260
|
+
}
|
|
261
|
+
e = (0, exports.buildGraphFilter)(e); // eslint-disable-line
|
|
262
|
+
return e.q;
|
|
263
|
+
});
|
|
264
|
+
let q = '( ';
|
|
265
|
+
for (let i = 0; i < ele.length; i += 1) {
|
|
266
|
+
if (i == ele.length - 1) {
|
|
267
|
+
q = `${q} ${ele[i]} )`;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
q = `${q} ${ele[i]} ${op} `;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return { q };
|
|
274
|
+
};
|
|
275
|
+
exports.buildComparison = buildComparison;
|
|
276
|
+
/**
|
|
277
|
+
* Creates a filter key, value.
|
|
278
|
+
* When the value is a string, boolean, number or date a equal comparision is created.
|
|
279
|
+
* Otherwise if the key corresponds to a known operator, the operator is constructed.
|
|
280
|
+
* @param {string} key
|
|
281
|
+
* @param {string|boolean|number|date|object} value
|
|
282
|
+
* @return {String} query template string
|
|
283
|
+
*/
|
|
284
|
+
const buildGraphField = (key, value) => {
|
|
285
|
+
if (_.isString(value) || _.isBoolean(value) || _.isNumber(value || _.isDate(value))) {
|
|
286
|
+
return (0, exports.autoCastKey)(key, value) + ' == ' + (0, exports.autoCastValue)(value);
|
|
287
|
+
}
|
|
288
|
+
if (!_.isNil(value.$eq)) {
|
|
289
|
+
return (0, exports.autoCastKey)(key, value) + ' == ' + (0, exports.autoCastValue)(value.$eq);
|
|
290
|
+
}
|
|
291
|
+
if (value.$gt) {
|
|
292
|
+
return (0, exports.autoCastKey)(key, value) + ' > ' + (0, exports.autoCastValue)(value.$gt);
|
|
293
|
+
}
|
|
294
|
+
if (value.$gte) {
|
|
295
|
+
return (0, exports.autoCastKey)(key, value) + ' >= ' + (0, exports.autoCastValue)(value.$gte);
|
|
296
|
+
}
|
|
297
|
+
if (value.$lt) {
|
|
298
|
+
return (0, exports.autoCastKey)(key, value) + ' < ' + (0, exports.autoCastValue)(value.$lt);
|
|
299
|
+
}
|
|
300
|
+
if (value.$lte) {
|
|
301
|
+
return (0, exports.autoCastKey)(key, value) + ' <= ' + (0, exports.autoCastValue)(value.$lte);
|
|
302
|
+
}
|
|
303
|
+
if (!_.isNil(value.$ne)) {
|
|
304
|
+
return (0, exports.autoCastKey)(key, value) + ' != ' + (0, exports.autoCastValue)(value.$ne);
|
|
305
|
+
}
|
|
306
|
+
if (value.$inVal) {
|
|
307
|
+
return (0, exports.autoCastValue)(value.$inVal) + ' IN ' + (0, exports.autoCastKey)(key, value);
|
|
308
|
+
}
|
|
309
|
+
if (value.$in) {
|
|
310
|
+
if (_.isString(value.$in)) {
|
|
311
|
+
// if it is a field which should be an array
|
|
312
|
+
// (useful for querying within a document list-like attributen
|
|
313
|
+
return (0, exports.autoCastValue)(value.$in) + ' IN ' + (0, exports.autoCastKey)(key);
|
|
314
|
+
}
|
|
315
|
+
// assuming it is a list of provided values
|
|
316
|
+
return (0, exports.autoCastKey)(key, value) + ' IN ' + (0, exports.autoCastValue)(value.$in);
|
|
317
|
+
}
|
|
318
|
+
if (value.$nin) {
|
|
319
|
+
return (0, exports.autoCastKey)(key, value) + ' NOT IN ' + (0, exports.autoCastValue)(value.$nin);
|
|
320
|
+
}
|
|
321
|
+
if (value.$iLike) {
|
|
322
|
+
// @param 'true' is for case insensitive
|
|
323
|
+
return 'LOWER(' + (0, exports.autoCastKey)(key, value) + ') LIKE ' + (0, exports.autoCastValue)(value.$iLike.toLowerCase());
|
|
324
|
+
}
|
|
325
|
+
if (!_.isNil(value.$not)) {
|
|
326
|
+
const temp = (0, exports.buildGraphField)(key, value.$not);
|
|
327
|
+
return `!(${temp})`;
|
|
328
|
+
}
|
|
329
|
+
if (_.has(value, '$isEmpty')) {
|
|
330
|
+
// will always search for an empty string
|
|
331
|
+
return (0, exports.autoCastKey)(key, '') + ' == ' + (0, exports.autoCastValue)('');
|
|
332
|
+
}
|
|
333
|
+
throw new Error(`unsupported operator ${_.keys(value)} in ${key}`);
|
|
334
|
+
};
|
|
335
|
+
exports.buildGraphField = buildGraphField;
|
|
336
|
+
/**
|
|
337
|
+
* Build ArangoDB query based on filter.
|
|
338
|
+
* @param {Object} filter key, value tree object
|
|
339
|
+
* @return {any} query template string and bind variables
|
|
340
|
+
*/
|
|
341
|
+
const buildGraphFilter = (filter) => {
|
|
342
|
+
if (filter.length > 0) {
|
|
343
|
+
let q = '';
|
|
344
|
+
let multipleFilters = false;
|
|
345
|
+
for (let eachFilter of filter) {
|
|
346
|
+
_.forEach(eachFilter, (value, key) => {
|
|
347
|
+
switch (key) {
|
|
348
|
+
case '$or':
|
|
349
|
+
if (!multipleFilters) {
|
|
350
|
+
if (_.isEmpty(value)) {
|
|
351
|
+
q = true;
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
q = (0, exports.buildComparison)(value, '||').q;
|
|
355
|
+
}
|
|
356
|
+
multipleFilters = true;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
q = q + '&& ' + (0, exports.buildComparison)(value, '||').q;
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
case '$and':
|
|
363
|
+
if (!multipleFilters) {
|
|
364
|
+
if (_.isEmpty(value)) {
|
|
365
|
+
q = false;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
q = (0, exports.buildComparison)(value, '&&').q;
|
|
369
|
+
}
|
|
370
|
+
multipleFilters = true;
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
q = q + '&& ' + (0, exports.buildComparison)(value, '&&').q;
|
|
374
|
+
}
|
|
375
|
+
break;
|
|
376
|
+
default:
|
|
377
|
+
if (_.startsWith(key, '$')) {
|
|
378
|
+
throw new Error(`unsupported query operator ${key}`);
|
|
379
|
+
}
|
|
380
|
+
if (!multipleFilters) {
|
|
381
|
+
q = (0, exports.buildGraphField)(key, value);
|
|
382
|
+
multipleFilters = true;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
q = q + ' && ' + (0, exports.buildGraphField)(key, value);
|
|
386
|
+
}
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
return { q };
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
exports.buildGraphFilter = buildGraphFilter;
|
|
395
|
+
/**
|
|
396
|
+
* Find's the list of entities from edge definition config depending on the direction
|
|
397
|
+
* recursively
|
|
398
|
+
* @param collection - root collection / start vertex
|
|
399
|
+
* @param edgeDefConfig - edge definition cofnig
|
|
400
|
+
* @param direction - direction OUTBOUND / INBOUND
|
|
401
|
+
* @param entitiesList - result of entities in the graph of edge definition config
|
|
402
|
+
*/
|
|
403
|
+
const recursiveFindEntities = (collection, edgeDefConfig, direction, entitiesList) => {
|
|
404
|
+
if (entitiesList.includes(collection)) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
entitiesList.push(collection);
|
|
408
|
+
let items = [];
|
|
409
|
+
if (direction === 'OUTBOUND') {
|
|
410
|
+
items = edgeDefConfig.filter(col => col.from === collection);
|
|
411
|
+
}
|
|
412
|
+
else if (direction === 'INBOUND') {
|
|
413
|
+
items = edgeDefConfig.filter(col => col.to === collection);
|
|
414
|
+
}
|
|
415
|
+
for (let item of items) {
|
|
416
|
+
if (direction === 'OUTBOUND') {
|
|
417
|
+
(0, exports.recursiveFindEntities)(item.to, edgeDefConfig, direction, entitiesList);
|
|
418
|
+
}
|
|
419
|
+
else if (direction === 'INBOUND') {
|
|
420
|
+
(0, exports.recursiveFindEntities)(item.from, edgeDefConfig, direction, entitiesList);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return entitiesList;
|
|
424
|
+
};
|
|
425
|
+
exports.recursiveFindEntities = recursiveFindEntities;
|
|
426
|
+
/**
|
|
427
|
+
* Build limit and offset filters.
|
|
428
|
+
* @param {limit} limit
|
|
429
|
+
* @param {offset} offset
|
|
430
|
+
* @return {String} string limit filter
|
|
431
|
+
*/
|
|
432
|
+
const buildGraphLimiter = (limit, offset) => {
|
|
433
|
+
// LIMIT count
|
|
434
|
+
// LIMIT offset, count
|
|
435
|
+
if (!limit) {
|
|
436
|
+
limit = 1000;
|
|
437
|
+
}
|
|
438
|
+
if (!_.isNil(limit)) {
|
|
439
|
+
if (!_.isNil(offset)) {
|
|
440
|
+
return `LIMIT ${offset}, ${limit}`;
|
|
441
|
+
}
|
|
442
|
+
return `LIMIT ${limit}`;
|
|
443
|
+
}
|
|
444
|
+
return '';
|
|
445
|
+
};
|
|
446
|
+
exports.buildGraphLimiter = buildGraphLimiter;
|
|
447
|
+
/**
|
|
448
|
+
* Auto-casting reference value by using native function of arangoDB
|
|
449
|
+
*
|
|
450
|
+
* @param {string} key
|
|
451
|
+
* @param {object} value - raw value optional
|
|
452
|
+
* @return {object} interpreted value
|
|
453
|
+
*/
|
|
454
|
+
const autoCastRootKey = (key, value) => {
|
|
455
|
+
if (_.isDate(value)) { // Date
|
|
456
|
+
return `DATE_TIMESTAMP(obj.${key})`;
|
|
457
|
+
}
|
|
458
|
+
return 'obj.' + key;
|
|
459
|
+
};
|
|
460
|
+
exports.autoCastRootKey = autoCastRootKey;
|
|
461
|
+
/**
|
|
462
|
+
* Build sort filter.
|
|
463
|
+
* @param {Object} sort sort options
|
|
464
|
+
* @return {any} template sort string
|
|
465
|
+
*/
|
|
466
|
+
const buildGraphSorter = (sortList) => {
|
|
467
|
+
if (_.isNil(sortList) || _.isEmpty(sortList)) {
|
|
468
|
+
return '';
|
|
469
|
+
}
|
|
470
|
+
const sort = _.mapKeys(sortList, (value, key) => {
|
|
471
|
+
return (0, exports.autoCastRootKey)(key);
|
|
472
|
+
});
|
|
473
|
+
let sortKeysOrder = '';
|
|
474
|
+
let i = 1;
|
|
475
|
+
let objLength = Object.keys(sort).length;
|
|
476
|
+
for (let key in sort) {
|
|
477
|
+
if (objLength == i) {
|
|
478
|
+
// Do not append ',' for the last element
|
|
479
|
+
sortKeysOrder = `${sortKeysOrder} ${key} ${sort[key]} `;
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
sortKeysOrder = `${sortKeysOrder} ${key} ${sort[key]},`;
|
|
483
|
+
}
|
|
484
|
+
i += 1;
|
|
485
|
+
}
|
|
486
|
+
return 'SORT ' + sortKeysOrder;
|
|
487
|
+
};
|
|
488
|
+
exports.buildGraphSorter = buildGraphSorter;
|
|
489
|
+
const createGraphsAssociationFilter = (filters, direction, traversalCollectionName, edgeDefConfig, filter) => {
|
|
490
|
+
let filterObj = [];
|
|
491
|
+
let filteredEntities = []; // used to find difference from graph edgeDefConfig and add missing entities to custom filter
|
|
492
|
+
let completeEntities = [];
|
|
493
|
+
let rootEntityFilter;
|
|
494
|
+
// convert the filter from proto structure (field, operation, value and operand) to {field: value } mapping
|
|
495
|
+
if (filters && !_.isEmpty(filters)) {
|
|
496
|
+
if (!_.isArray(filters)) {
|
|
497
|
+
filters = [filters];
|
|
498
|
+
}
|
|
499
|
+
for (let eachFilter of filters) {
|
|
500
|
+
if (eachFilter.entity && eachFilter.entity === traversalCollectionName) {
|
|
501
|
+
rootEntityFilter = (0, exports.toTraversalFilterObject)(eachFilter);
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
const traversalFilterObj = (0, exports.toTraversalFilterObject)(eachFilter);
|
|
505
|
+
if (eachFilter.entity && eachFilter.entity != traversalCollectionName) {
|
|
506
|
+
filteredEntities.push(eachFilter.entity);
|
|
507
|
+
traversalFilterObj.entity = eachFilter.entity;
|
|
508
|
+
}
|
|
509
|
+
else if (eachFilter.edge) {
|
|
510
|
+
// depending on direction
|
|
511
|
+
const entityConnectedToEdge = edgeDefConfig.filter(e => e.collection === eachFilter.edge);
|
|
512
|
+
if (entityConnectedToEdge?.length === 1) {
|
|
513
|
+
if (direction === 'OUTBOUND') {
|
|
514
|
+
filteredEntities.push(entityConnectedToEdge[0].to);
|
|
515
|
+
}
|
|
516
|
+
else if (direction === 'INBOUND') {
|
|
517
|
+
filteredEntities.push(entityConnectedToEdge[0].from);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
traversalFilterObj.edge = eachFilter.edge;
|
|
521
|
+
}
|
|
522
|
+
filterObj.push(traversalFilterObj);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (!_.isArray(filterObj)) {
|
|
526
|
+
filterObj = [filterObj];
|
|
527
|
+
}
|
|
528
|
+
if (filterObj?.length > 0) {
|
|
529
|
+
completeEntities = (0, exports.recursiveFindEntities)(traversalCollectionName, edgeDefConfig, direction, []);
|
|
530
|
+
}
|
|
531
|
+
// construct AQL custom filter based on filterObj using buildFilter api
|
|
532
|
+
let customFilter = '';
|
|
533
|
+
let rootCollectionFilter = '';
|
|
534
|
+
if (filterObj && filterObj.length > 0) {
|
|
535
|
+
for (let i = 0; i < filterObj.length; i++) {
|
|
536
|
+
let entity = '';
|
|
537
|
+
let edge = '';
|
|
538
|
+
if (filterObj[i].entity) {
|
|
539
|
+
entity = filterObj[i].entity;
|
|
540
|
+
delete filterObj[i].entity;
|
|
541
|
+
}
|
|
542
|
+
else if (filterObj[i].edge) {
|
|
543
|
+
edge = filterObj[i].edge;
|
|
544
|
+
delete filterObj[i].edge;
|
|
545
|
+
}
|
|
546
|
+
let filterString = (0, exports.buildGraphFilter)([filterObj[i]]).q;
|
|
547
|
+
if (typeof filterString === 'string' &&
|
|
548
|
+
filterString.startsWith('(') && filterString.endsWith(')')) {
|
|
549
|
+
if (entity) {
|
|
550
|
+
filterString = filterString.substring(0, 1) + ` v._id LIKE "${entity}%" && ` + filterString.substring(1);
|
|
551
|
+
if (traversalCollectionName && entity === traversalCollectionName) {
|
|
552
|
+
rootCollectionFilter = filterString;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else if (edge) {
|
|
556
|
+
filterString = filterString.substring(0, 1) + ` e._id LIKE "${edge}%" && ` + filterString.substring(1);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (i === filterObj.length - 1) {
|
|
560
|
+
customFilter = customFilter + filterString;
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
customFilter = customFilter + filterString + ' || ';
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
if (customFilter) {
|
|
568
|
+
filter = filter + ` FILTER ${customFilter}`;
|
|
569
|
+
// add missing entities to FILTER query
|
|
570
|
+
filteredEntities = filteredEntities.sort();
|
|
571
|
+
completeEntities = completeEntities.sort();
|
|
572
|
+
if (!_.isEqual(filteredEntities, completeEntities)) {
|
|
573
|
+
for (let removeEntity of _.intersection(filteredEntities, completeEntities)) {
|
|
574
|
+
completeEntities.splice(completeEntities.indexOf(removeEntity), 1);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
// AQL query for missing entities
|
|
578
|
+
if (completeEntities && completeEntities.length > 0) {
|
|
579
|
+
for (let missingEntity of completeEntities) {
|
|
580
|
+
filter = filter + ` || ( v._id LIKE "${missingEntity}%" )`;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return { rootEntityFilter, associationFilter: filter };
|
|
585
|
+
};
|
|
586
|
+
exports.createGraphsAssociationFilter = createGraphsAssociationFilter;
|
|
587
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/database/provider/arango/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA4B;AAC5B,gDAAwB;AAGxB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,CAAC,CAAC,EAAE,IAAI,CAAC;IACT,CAAC,CAAC,EAAE,IAAI,CAAC;IACT,CAAC,CAAC,EAAE,KAAK,CAAC;IACV,CAAC,CAAC,EAAE,IAAI,CAAC;IACT,CAAC,CAAC,EAAE,KAAK,CAAC;IACV,CAAC,CAAC,EAAE,SAAS,CAAC;IACd,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,CAAC,CAAC,EAAE,IAAI,CAAC;IACT,CAAC,CAAC,EAAE,KAAK,CAAC;CACX,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,CAAC,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