@restorecommerce/resource-base-interface 0.1.0 → 0.2.2
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 +21 -0
- package/lib/core/GraphResourcesServiceBase.d.ts +3 -1
- package/lib/core/GraphResourcesServiceBase.js +104 -68
- package/lib/core/GraphResourcesServiceBase.js.map +1 -1
- package/lib/core/ResourcesAPI.d.ts +3 -2
- package/lib/core/ResourcesAPI.js +136 -86
- package/lib/core/ResourcesAPI.js.map +1 -1
- package/lib/core/ServiceBase.d.ts +2 -0
- package/lib/core/ServiceBase.js +237 -57
- package/lib/core/ServiceBase.js.map +1 -1
- package/lib/core/interfaces.d.ts +34 -1
- package/lib/core/interfaces.js +29 -0
- package/lib/core/interfaces.js.map +1 -1
- package/lib/index.d.ts +9 -2
- package/lib/index.js +167 -63
- package/lib/index.js.map +1 -1
- package/package.json +17 -17
- package/test.js +16 -0
- package/testFilter.js +221 -0
package/lib/core/ServiceBase.js
CHANGED
|
@@ -14,6 +14,18 @@ const _ = require("lodash");
|
|
|
14
14
|
const chassis = require("@restorecommerce/chassis-srv");
|
|
15
15
|
const index_1 = require("../index");
|
|
16
16
|
const errors = chassis.errors;
|
|
17
|
+
// Mapping of arangodb error codes to standard HTTP error codes
|
|
18
|
+
const arangoHttpErrCodeMap = new Map([
|
|
19
|
+
[1210, 409],
|
|
20
|
+
[1200, 409],
|
|
21
|
+
[1201, 400],
|
|
22
|
+
[1202, 404],
|
|
23
|
+
[1203, 404],
|
|
24
|
+
[1204, 400],
|
|
25
|
+
[1205, 400],
|
|
26
|
+
[1207, 409],
|
|
27
|
+
[1228, 404], // ERROR_ARANGO_DATABASE_NOT_FOUND
|
|
28
|
+
]);
|
|
17
29
|
/**
|
|
18
30
|
* A microservice chassis ready class which provides endpoints for
|
|
19
31
|
* CRUD resource operations.
|
|
@@ -33,6 +45,7 @@ class ServiceBase {
|
|
|
33
45
|
entity: entityEvents
|
|
34
46
|
};
|
|
35
47
|
this.resourceapi = resourceapi;
|
|
48
|
+
this.resourceapi.logger = logger;
|
|
36
49
|
this.isEventsEnabled = isEventsEnabled;
|
|
37
50
|
}
|
|
38
51
|
/**
|
|
@@ -43,8 +56,13 @@ class ServiceBase {
|
|
|
43
56
|
*/
|
|
44
57
|
read(call, context) {
|
|
45
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
let docs = {};
|
|
46
60
|
if (!_.isEmpty(call.request.search)) {
|
|
47
|
-
|
|
61
|
+
docs.operation_status = {
|
|
62
|
+
code: 404,
|
|
63
|
+
message: 'Full-text search is not implemented'
|
|
64
|
+
};
|
|
65
|
+
return docs;
|
|
48
66
|
}
|
|
49
67
|
try {
|
|
50
68
|
let objectEntities = [];
|
|
@@ -74,12 +92,17 @@ class ServiceBase {
|
|
|
74
92
|
}
|
|
75
93
|
const offset = call.request.offset;
|
|
76
94
|
let filter = {};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
// convert the filter from proto structure (field, operation, value and operand) to {field: value } mapping
|
|
96
|
+
if (!_.isEmpty(call.request.filters)) {
|
|
97
|
+
if (_.isArray(call.request.filters)) {
|
|
98
|
+
for (let eachFilter of call.request.filters) {
|
|
99
|
+
let prevFilter = filter;
|
|
100
|
+
filter = (0, index_1.toObject)(eachFilter);
|
|
101
|
+
Object.assign(filter, prevFilter);
|
|
102
|
+
}
|
|
80
103
|
}
|
|
81
104
|
else {
|
|
82
|
-
filter = index_1.toObject(call.request.
|
|
105
|
+
filter = (0, index_1.toObject)(call.request.filters);
|
|
83
106
|
}
|
|
84
107
|
}
|
|
85
108
|
const field = {};
|
|
@@ -93,22 +116,130 @@ class ServiceBase {
|
|
|
93
116
|
const customQueries = call.request.custom_queries;
|
|
94
117
|
const customArgs = call.request.custom_arguments || {};
|
|
95
118
|
objectEntities = (yield this.resourceapi.read(filter, limit, offset, sort, field, customQueries, customArgs)) || [];
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
let readResponseWithStatus = [];
|
|
120
|
+
for (let object of objectEntities) {
|
|
121
|
+
readResponseWithStatus.push({
|
|
122
|
+
payload: object,
|
|
123
|
+
status: {
|
|
124
|
+
code: 200,
|
|
125
|
+
message: 'success'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
docs = {
|
|
130
|
+
items: readResponseWithStatus,
|
|
98
131
|
total_count: objectEntities.length,
|
|
132
|
+
operation_status: {
|
|
133
|
+
code: 200,
|
|
134
|
+
message: 'success'
|
|
135
|
+
}
|
|
99
136
|
};
|
|
137
|
+
return docs;
|
|
100
138
|
}
|
|
101
139
|
catch (e) {
|
|
102
|
-
const { code, message
|
|
140
|
+
const { code, message } = e;
|
|
103
141
|
this.logger.error('Error caught while processing read request', { code, message });
|
|
104
|
-
if (
|
|
105
|
-
|
|
142
|
+
if (!docs.status) {
|
|
143
|
+
docs.status = {};
|
|
144
|
+
}
|
|
145
|
+
docs.status = {
|
|
146
|
+
id: '',
|
|
147
|
+
code: e.code,
|
|
148
|
+
message: e.details ? e.details : e.message
|
|
149
|
+
};
|
|
150
|
+
return docs;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
generateStatusResponse(responseItems, inputItems, deleteIds) {
|
|
155
|
+
let statusArray = [];
|
|
156
|
+
if (!_.isArray(responseItems)) {
|
|
157
|
+
responseItems = [responseItems];
|
|
158
|
+
}
|
|
159
|
+
if (!_.isArray(inputItems)) {
|
|
160
|
+
inputItems = [inputItems];
|
|
161
|
+
}
|
|
162
|
+
for (let i = 0; i < responseItems.length; i++) {
|
|
163
|
+
const item = responseItems[i];
|
|
164
|
+
if (item.error) {
|
|
165
|
+
let code;
|
|
166
|
+
let id;
|
|
167
|
+
if (!deleteIds) {
|
|
168
|
+
id = inputItems[i].id;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
id = inputItems[i]; // for delete operation ids is a string and not object
|
|
172
|
+
}
|
|
173
|
+
// map arango error code to http error code
|
|
174
|
+
arangoHttpErrCodeMap.forEach((value, key) => {
|
|
175
|
+
if (key === item.errorNum) {
|
|
176
|
+
code = value;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
statusArray.push({
|
|
180
|
+
id,
|
|
181
|
+
code: code ? code : item.errorNum,
|
|
182
|
+
message: item.errorMessage
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
statusArray.push({
|
|
187
|
+
id: item.id,
|
|
188
|
+
code: 200,
|
|
189
|
+
message: 'success'
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return statusArray;
|
|
194
|
+
}
|
|
195
|
+
generateResponseWithStatus(responseItems, inputItems, deleteIds) {
|
|
196
|
+
let statusArray = [];
|
|
197
|
+
let responseItemsWithStatus = [];
|
|
198
|
+
if (!_.isArray(responseItems)) {
|
|
199
|
+
responseItems = [responseItems];
|
|
200
|
+
}
|
|
201
|
+
if (!_.isArray(inputItems)) {
|
|
202
|
+
inputItems = [inputItems];
|
|
203
|
+
}
|
|
204
|
+
for (let i = 0; i < responseItems.length; i++) {
|
|
205
|
+
const item = responseItems[i];
|
|
206
|
+
if (item.error) {
|
|
207
|
+
let code;
|
|
208
|
+
let id;
|
|
209
|
+
if (!deleteIds) {
|
|
210
|
+
id = inputItems[i].id;
|
|
106
211
|
}
|
|
107
212
|
else {
|
|
108
|
-
|
|
213
|
+
id = inputItems[i]; // for delete operation ids is a string and not object
|
|
109
214
|
}
|
|
215
|
+
// map arango error code to http error code
|
|
216
|
+
arangoHttpErrCodeMap.forEach((value, key) => {
|
|
217
|
+
if (key === item.errorNum) {
|
|
218
|
+
code = value;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
responseItemsWithStatus.push({
|
|
222
|
+
payload: undefined,
|
|
223
|
+
status: {
|
|
224
|
+
id,
|
|
225
|
+
code: code ? code : item.errorNum,
|
|
226
|
+
message: item.errorMessage
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
statusArray.push();
|
|
110
230
|
}
|
|
111
|
-
|
|
231
|
+
else {
|
|
232
|
+
responseItemsWithStatus.push({
|
|
233
|
+
payload: item,
|
|
234
|
+
status: {
|
|
235
|
+
id: item.id,
|
|
236
|
+
code: 200,
|
|
237
|
+
message: 'success'
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return responseItemsWithStatus;
|
|
112
243
|
}
|
|
113
244
|
/**
|
|
114
245
|
* Endpoint create.
|
|
@@ -118,28 +249,37 @@ class ServiceBase {
|
|
|
118
249
|
*/
|
|
119
250
|
create(call, context) {
|
|
120
251
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
let docs = {};
|
|
121
253
|
try {
|
|
122
|
-
|
|
254
|
+
const createDocs = _.cloneDeep(call.request.items);
|
|
255
|
+
let createResponse = yield this.resourceapi.create(createDocs);
|
|
123
256
|
const dispatch = [];
|
|
124
257
|
const events = this.events.entity;
|
|
125
|
-
this.logger.info(this.name + ' created', { items: call.request.items });
|
|
126
258
|
if (this.isEventsEnabled) {
|
|
127
|
-
_.forEach(
|
|
128
|
-
|
|
259
|
+
_.forEach(createResponse, (item) => {
|
|
260
|
+
if (!item.error) {
|
|
261
|
+
dispatch.push(events.emit(`${this.name}Created`, item));
|
|
262
|
+
}
|
|
129
263
|
});
|
|
130
264
|
yield dispatch;
|
|
131
265
|
}
|
|
132
|
-
|
|
266
|
+
let createResponseWithStatus = this.generateResponseWithStatus(createResponse, createDocs);
|
|
267
|
+
const operation_status = {
|
|
268
|
+
code: 200,
|
|
269
|
+
message: 'success'
|
|
270
|
+
};
|
|
271
|
+
docs = { items: createResponseWithStatus, total_count: createResponseWithStatus.length, operation_status };
|
|
272
|
+
this.logger.info(this.name + ' create response', docs);
|
|
273
|
+
return docs;
|
|
133
274
|
}
|
|
134
275
|
catch (e) {
|
|
135
|
-
const { code, message
|
|
276
|
+
const { code, message } = e;
|
|
136
277
|
this.logger.error('Error caught while processing create request', { code, message });
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
278
|
+
docs.operation_status = {
|
|
279
|
+
code: e.code,
|
|
280
|
+
message: e.details ? e.details : e.message
|
|
281
|
+
};
|
|
282
|
+
return docs;
|
|
143
283
|
}
|
|
144
284
|
});
|
|
145
285
|
}
|
|
@@ -151,6 +291,7 @@ class ServiceBase {
|
|
|
151
291
|
*/
|
|
152
292
|
delete(call, context) {
|
|
153
293
|
return __awaiter(this, void 0, void 0, function* () {
|
|
294
|
+
let deleteResponse = { status: [], operation_status: {} };
|
|
154
295
|
try {
|
|
155
296
|
const events = this.events.entity;
|
|
156
297
|
let docs;
|
|
@@ -159,8 +300,17 @@ class ServiceBase {
|
|
|
159
300
|
this.logger.info(`${this.name} deleted`);
|
|
160
301
|
}
|
|
161
302
|
else {
|
|
162
|
-
yield this.resourceapi.delete(call.request.ids);
|
|
163
|
-
|
|
303
|
+
docs = yield this.resourceapi.delete(call.request.ids);
|
|
304
|
+
}
|
|
305
|
+
// sanitize delete response for docs
|
|
306
|
+
for (let doc of docs) {
|
|
307
|
+
if (doc._id && doc._key && doc._rev) {
|
|
308
|
+
delete doc._id;
|
|
309
|
+
const id = doc._key;
|
|
310
|
+
doc.id = id;
|
|
311
|
+
delete doc._key;
|
|
312
|
+
delete doc._rev;
|
|
313
|
+
}
|
|
164
314
|
}
|
|
165
315
|
if (this.isEventsEnabled) {
|
|
166
316
|
const dispatch = [];
|
|
@@ -168,21 +318,35 @@ class ServiceBase {
|
|
|
168
318
|
if (typeof id == 'string') {
|
|
169
319
|
id = { id };
|
|
170
320
|
}
|
|
171
|
-
|
|
321
|
+
if (!id.error) {
|
|
322
|
+
dispatch.push(events.emit(`${this.name}Deleted`, id));
|
|
323
|
+
}
|
|
172
324
|
});
|
|
173
325
|
yield dispatch;
|
|
174
326
|
}
|
|
175
|
-
|
|
327
|
+
// if complete collection is dropped then there are no input ids provided,
|
|
328
|
+
// iterate docs and put ids to call.request.ids
|
|
329
|
+
if (call.request.collection && (_.isNil(call.request.ids) || _.isEmpty(call.request.ids))) {
|
|
330
|
+
call.request.ids = [];
|
|
331
|
+
for (let doc of docs) {
|
|
332
|
+
call.request.ids.push(doc.id);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
let statusArray = this.generateStatusResponse(docs, call.request.ids, true);
|
|
336
|
+
const operation_status = {
|
|
337
|
+
code: 200,
|
|
338
|
+
message: 'success'
|
|
339
|
+
};
|
|
340
|
+
return { status: statusArray, operation_status };
|
|
176
341
|
}
|
|
177
342
|
catch (e) {
|
|
178
|
-
const { code, message
|
|
343
|
+
const { code, message } = e;
|
|
179
344
|
this.logger.error('Error caught while processing delete request', { code, message });
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
345
|
+
deleteResponse.operation_status = {
|
|
346
|
+
code: e.code,
|
|
347
|
+
message: e.details ? e.details : e.message
|
|
348
|
+
};
|
|
349
|
+
return deleteResponse;
|
|
186
350
|
}
|
|
187
351
|
});
|
|
188
352
|
}
|
|
@@ -194,28 +358,37 @@ class ServiceBase {
|
|
|
194
358
|
*/
|
|
195
359
|
update(call, context) {
|
|
196
360
|
return __awaiter(this, void 0, void 0, function* () {
|
|
361
|
+
let docs = {};
|
|
197
362
|
try {
|
|
198
|
-
|
|
199
|
-
this.
|
|
363
|
+
let updateDocs = _.cloneDeep(call.request.items);
|
|
364
|
+
let updateResponse = yield this.resourceapi.update(updateDocs);
|
|
200
365
|
if (this.isEventsEnabled) {
|
|
201
366
|
const dispatch = [];
|
|
202
367
|
const events = this.events.entity;
|
|
203
|
-
_.forEach(
|
|
204
|
-
|
|
368
|
+
_.forEach(updateResponse, (update) => {
|
|
369
|
+
if (!update.error) {
|
|
370
|
+
dispatch.push(events.emit(`${this.name}Modified`, update));
|
|
371
|
+
}
|
|
205
372
|
});
|
|
206
373
|
yield dispatch;
|
|
207
374
|
}
|
|
208
|
-
|
|
375
|
+
let responseWithStatus = this.generateResponseWithStatus(updateResponse, updateDocs);
|
|
376
|
+
const operation_status = {
|
|
377
|
+
code: 200,
|
|
378
|
+
message: 'success'
|
|
379
|
+
};
|
|
380
|
+
docs = { items: responseWithStatus, total_count: responseWithStatus.length, operation_status };
|
|
381
|
+
this.logger.info(this.name + ' update response', docs);
|
|
382
|
+
return docs;
|
|
209
383
|
}
|
|
210
384
|
catch (e) {
|
|
211
|
-
const { code, message
|
|
385
|
+
const { code, message } = e;
|
|
212
386
|
this.logger.error('Error caught while processing update request', { code, message });
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
387
|
+
docs.operation_status = {
|
|
388
|
+
code: e.code,
|
|
389
|
+
message: e.details ? e.details : e.message
|
|
390
|
+
};
|
|
391
|
+
return docs;
|
|
219
392
|
}
|
|
220
393
|
});
|
|
221
394
|
}
|
|
@@ -227,20 +400,27 @@ class ServiceBase {
|
|
|
227
400
|
*/
|
|
228
401
|
upsert(call, context) {
|
|
229
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
403
|
+
let docs = {};
|
|
230
404
|
try {
|
|
231
|
-
|
|
232
|
-
this.
|
|
233
|
-
|
|
405
|
+
let upsertDocs = _.cloneDeep(call.request.items);
|
|
406
|
+
let upsertResponse = yield this.resourceapi.upsert(upsertDocs, this.events.entity, this.name);
|
|
407
|
+
let responseWithStatus = this.generateResponseWithStatus(upsertResponse, upsertDocs);
|
|
408
|
+
const operation_status = {
|
|
409
|
+
code: 200,
|
|
410
|
+
message: 'success'
|
|
411
|
+
};
|
|
412
|
+
docs = { items: responseWithStatus, total_count: responseWithStatus.length, operation_status };
|
|
413
|
+
this.logger.info(`${this.name} upsert response`, { items: upsertResponse });
|
|
414
|
+
return docs;
|
|
234
415
|
}
|
|
235
416
|
catch (e) {
|
|
236
|
-
const { code, message
|
|
417
|
+
const { code, message } = e;
|
|
237
418
|
this.logger.error('Error caught while processing upsert request', { code, message });
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
419
|
+
docs.operation_status = {
|
|
420
|
+
code: e.code,
|
|
421
|
+
message: e.details ? e.details : e.message
|
|
422
|
+
};
|
|
423
|
+
return docs;
|
|
244
424
|
}
|
|
245
425
|
});
|
|
246
426
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceBase.js","sourceRoot":"","sources":["../../src/core/ServiceBase.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4BAA4B;AAC5B,wDAAwD;AACxD,oCAAoC;AAMpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AAE9B;;;GAGG;AACH,MAAa,WAAW;IAMtB;;;;;;OAMG;IACH,YAAY,UAAkB,EAAE,YAAiB,EAAE,MAAc,EAC/D,WAA6B,EAAE,eAAyB;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,YAAY;SACrB,CAAC;QACF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACG,IAAI,CAAC,IAA8B,EAAE,OAAa;;YACtD,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACnC,MAAM,IAAI,MAAM,CAAC,aAAa,CAAC,qCAAqC,CAAC,CAAC;aACvE;YAED,IAAI;gBACF,IAAI,cAAc,GAAG,EAAE,CAAC;gBACxB,IAAI,IAAI,CAAC;gBACT,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EA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3
|
request: TRequest;
|
|
4
4
|
}
|
|
5
5
|
export declare type SortType = 'ASCENDING' | 'DESCENDING' | 'UNSORTED' | 2 | 1 | 0;
|
|
6
|
+
export declare enum FilterOperation {
|
|
7
|
+
eq = 0,
|
|
8
|
+
lt = 1,
|
|
9
|
+
lte = 2,
|
|
10
|
+
gt = 3,
|
|
11
|
+
gte = 4,
|
|
12
|
+
isEmpty = 5,
|
|
13
|
+
iLike = 6,
|
|
14
|
+
in = 7,
|
|
15
|
+
neq = 8
|
|
16
|
+
}
|
|
17
|
+
export declare enum FilterValueType {
|
|
18
|
+
STRING = 0,
|
|
19
|
+
NUMBER = 1,
|
|
20
|
+
BOOLEAN = 2,
|
|
21
|
+
DATE = 3,
|
|
22
|
+
ARRAY = 4
|
|
23
|
+
}
|
|
24
|
+
export declare enum OperatorType {
|
|
25
|
+
and = 0,
|
|
26
|
+
or = 1
|
|
27
|
+
}
|
|
28
|
+
export interface Filter {
|
|
29
|
+
field: string;
|
|
30
|
+
operation: FilterOperation;
|
|
31
|
+
value: string;
|
|
32
|
+
type?: FilterValueType;
|
|
33
|
+
filters?: FilterOp[];
|
|
34
|
+
}
|
|
35
|
+
export interface FilterOp {
|
|
36
|
+
filter?: Filter[];
|
|
37
|
+
operator?: OperatorType;
|
|
38
|
+
}
|
|
6
39
|
export interface ReadRequest {
|
|
7
40
|
search?: string;
|
|
8
41
|
sort?: {
|
|
@@ -15,7 +48,7 @@ export interface ReadRequest {
|
|
|
15
48
|
name: string;
|
|
16
49
|
include: boolean;
|
|
17
50
|
}[];
|
|
18
|
-
|
|
51
|
+
filters?: FilterOp[];
|
|
19
52
|
custom_queries?: string[];
|
|
20
53
|
custom_arguments?: any;
|
|
21
54
|
}
|
package/lib/core/interfaces.js
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperatorType = exports.FilterValueType = exports.FilterOperation = void 0;
|
|
4
|
+
var FilterOperation;
|
|
5
|
+
(function (FilterOperation) {
|
|
6
|
+
FilterOperation[FilterOperation["eq"] = 0] = "eq";
|
|
7
|
+
FilterOperation[FilterOperation["lt"] = 1] = "lt";
|
|
8
|
+
FilterOperation[FilterOperation["lte"] = 2] = "lte";
|
|
9
|
+
FilterOperation[FilterOperation["gt"] = 3] = "gt";
|
|
10
|
+
FilterOperation[FilterOperation["gte"] = 4] = "gte";
|
|
11
|
+
FilterOperation[FilterOperation["isEmpty"] = 5] = "isEmpty";
|
|
12
|
+
FilterOperation[FilterOperation["iLike"] = 6] = "iLike";
|
|
13
|
+
FilterOperation[FilterOperation["in"] = 7] = "in";
|
|
14
|
+
FilterOperation[FilterOperation["neq"] = 8] = "neq";
|
|
15
|
+
})(FilterOperation = exports.FilterOperation || (exports.FilterOperation = {}));
|
|
16
|
+
;
|
|
17
|
+
var FilterValueType;
|
|
18
|
+
(function (FilterValueType) {
|
|
19
|
+
FilterValueType[FilterValueType["STRING"] = 0] = "STRING";
|
|
20
|
+
FilterValueType[FilterValueType["NUMBER"] = 1] = "NUMBER";
|
|
21
|
+
FilterValueType[FilterValueType["BOOLEAN"] = 2] = "BOOLEAN";
|
|
22
|
+
FilterValueType[FilterValueType["DATE"] = 3] = "DATE";
|
|
23
|
+
FilterValueType[FilterValueType["ARRAY"] = 4] = "ARRAY";
|
|
24
|
+
})(FilterValueType = exports.FilterValueType || (exports.FilterValueType = {}));
|
|
25
|
+
;
|
|
26
|
+
var OperatorType;
|
|
27
|
+
(function (OperatorType) {
|
|
28
|
+
OperatorType[OperatorType["and"] = 0] = "and";
|
|
29
|
+
OperatorType[OperatorType["or"] = 1] = "or";
|
|
30
|
+
})(OperatorType = exports.OperatorType || (exports.OperatorType = {}));
|
|
31
|
+
;
|
|
3
32
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/core/interfaces.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/core/interfaces.ts"],"names":[],"mappings":";;;AAOA,IAAY,eAUX;AAVD,WAAY,eAAe;IACzB,iDAAM,CAAA;IACN,iDAAM,CAAA;IACN,mDAAO,CAAA;IACP,iDAAM,CAAA;IACN,mDAAO,CAAA;IACP,2DAAW,CAAA;IACX,uDAAS,CAAA;IACT,iDAAM,CAAA;IACN,mDAAO,CAAA;AACT,CAAC,EAVW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAU1B;AAAA,CAAC;AAEF,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,yDAAU,CAAA;IACV,yDAAU,CAAA;IACV,2DAAW,CAAA;IACX,qDAAQ,CAAA;IACR,uDAAS,CAAA;AACX,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAAA,CAAC;AAEF,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6CAAO,CAAA;IACP,2CAAM,CAAA;AACR,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB;AAAA,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* toObject takes input contained in the proto structure defined in resource_base proto
|
|
3
|
+
* and converts it into Object understandable by the underlying DB implementation in chassis-srv
|
|
4
|
+
* @param {*} input Original filter input object
|
|
5
|
+
* @param {*} obj converted filter objected passed recursively
|
|
6
|
+
* @param {*} operatorList operatorlist updated and passed recursively
|
|
7
|
+
*/
|
|
8
|
+
export declare const toObject: (input: any, obj?: any, operatorList?: string[]) => any;
|
|
3
9
|
import { ResourcesAPIBase } from './core/ResourcesAPI';
|
|
4
10
|
export { ResourcesAPIBase };
|
|
5
11
|
import { ServiceBase } from './core/ServiceBase';
|
|
6
12
|
export { ServiceBase };
|
|
7
13
|
import { GraphResourcesServiceBase } from './core/GraphResourcesServiceBase';
|
|
8
14
|
export { GraphResourcesServiceBase };
|
|
15
|
+
export { Filter, FilterOp, FilterOperation, FilterValueType, OperatorType } from './core/interfaces';
|