dbgate-filterparser 5.3.3 → 5.4.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/lib/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './parseFilter';
2
- export * from './getFilterType';
3
2
  export * from './filterTool';
package/lib/index.js CHANGED
@@ -15,5 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./parseFilter"), exports);
18
- __exportStar(require("./getFilterType"), exports);
19
18
  __exportStar(require("./filterTool"), exports);
@@ -1,3 +1,3 @@
1
- import { FilterType } from './types';
2
1
  import { Condition } from 'dbgate-sqltree';
3
- export declare function parseFilter(value: string, filterType: FilterType): Condition;
2
+ import { FilterBehaviour } from 'dbgate-types';
3
+ export declare function parseFilter(value: string, filterBehaviour: FilterBehaviour): Condition;
@@ -5,21 +5,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseFilter = void 0;
7
7
  const parsimmon_1 = __importDefault(require("parsimmon"));
8
+ const moment_1 = __importDefault(require("moment"));
8
9
  const common_1 = require("./common");
9
- const mongoParser_1 = require("./mongoParser");
10
- const datetimeParser_1 = require("./datetimeParser");
11
10
  const dbgate_tools_1 = require("dbgate-tools");
12
- const binaryCondition = operator => value => ({
13
- conditionType: 'binary',
14
- operator,
15
- left: {
16
- exprType: 'placeholder',
17
- },
18
- right: {
19
- exprType: 'value',
20
- value,
21
- },
22
- });
11
+ const binaryCondition = (operator, numberDualTesting = false) => value => {
12
+ const numValue = parseFloat(value);
13
+ if (numberDualTesting && !isNaN(numValue)) {
14
+ return {
15
+ conditionType: 'or',
16
+ conditions: [
17
+ {
18
+ conditionType: 'binary',
19
+ operator,
20
+ left: {
21
+ exprType: 'placeholder',
22
+ },
23
+ right: {
24
+ exprType: 'value',
25
+ value,
26
+ },
27
+ },
28
+ {
29
+ conditionType: 'binary',
30
+ operator,
31
+ left: {
32
+ exprType: 'placeholder',
33
+ },
34
+ right: {
35
+ exprType: 'value',
36
+ value: numValue,
37
+ },
38
+ },
39
+ ],
40
+ };
41
+ }
42
+ return {
43
+ conditionType: 'binary',
44
+ operator,
45
+ left: {
46
+ exprType: 'placeholder',
47
+ },
48
+ right: {
49
+ exprType: 'value',
50
+ value,
51
+ },
52
+ };
53
+ };
23
54
  const likeCondition = (conditionType, likeString) => value => ({
24
55
  conditionType,
25
56
  left: {
@@ -65,6 +96,53 @@ const negateCondition = condition => {
65
96
  condition,
66
97
  };
67
98
  };
99
+ const numberTestCondition = () => value => {
100
+ return {
101
+ conditionType: 'or',
102
+ conditions: [
103
+ {
104
+ conditionType: 'like',
105
+ left: {
106
+ exprType: 'placeholder',
107
+ },
108
+ right: {
109
+ exprType: 'value',
110
+ value: `.*${value}.*`,
111
+ },
112
+ },
113
+ {
114
+ conditionType: 'binary',
115
+ operator: '=',
116
+ left: {
117
+ exprType: 'placeholder',
118
+ },
119
+ right: {
120
+ exprType: 'value',
121
+ value,
122
+ },
123
+ },
124
+ ],
125
+ };
126
+ };
127
+ const idRegex = /[('"]([0-9a-f]{24})['")]/;
128
+ const objectIdTestCondition = () => value => ({
129
+ conditionType: 'binary',
130
+ operator: '=',
131
+ left: {
132
+ exprType: 'placeholder',
133
+ },
134
+ right: {
135
+ exprType: 'value',
136
+ value: { $oid: value.match(idRegex)[1] },
137
+ },
138
+ });
139
+ const specificPredicateCondition = predicate => () => ({
140
+ conditionType: 'specificPredicate',
141
+ predicate,
142
+ expr: {
143
+ exprType: 'placeholder',
144
+ },
145
+ });
68
146
  const sqlTemplate = templateSql => {
69
147
  return {
70
148
  conditionType: 'rawTemplate',
@@ -74,7 +152,136 @@ const sqlTemplate = templateSql => {
74
152
  },
75
153
  };
76
154
  };
77
- const createParser = (filterType) => {
155
+ function getTransformCondition(transform, value) {
156
+ return {
157
+ conditionType: 'binary',
158
+ operator: '=',
159
+ left: {
160
+ exprType: 'transform',
161
+ transform,
162
+ expr: {
163
+ exprType: 'placeholder',
164
+ },
165
+ },
166
+ right: {
167
+ exprType: 'value',
168
+ value,
169
+ },
170
+ };
171
+ }
172
+ const yearCondition = () => value => {
173
+ return getTransformCondition('YEAR', value);
174
+ };
175
+ const yearMonthCondition = () => value => {
176
+ const m = value.match(/(\d\d\d\d)-(\d\d?)/);
177
+ return {
178
+ conditionType: 'and',
179
+ conditions: [getTransformCondition('YEAR', m[1]), getTransformCondition('MONTH', m[2])],
180
+ };
181
+ };
182
+ const yearMonthDayCondition = () => value => {
183
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)/);
184
+ return {
185
+ conditionType: 'and',
186
+ conditions: [
187
+ getTransformCondition('YEAR', m[1]),
188
+ getTransformCondition('MONTH', m[2]),
189
+ getTransformCondition('DAY', m[3]),
190
+ ],
191
+ };
192
+ };
193
+ const yearEdge = edgeFunction => value => {
194
+ return (0, moment_1.default)(new Date(parseInt(value), 0, 1))[edgeFunction]('year')
195
+ .format('YYYY-MM-DDTHH:mm:ss.SSS');
196
+ };
197
+ const yearMonthEdge = edgeFunction => value => {
198
+ const m = value.match(/(\d\d\d\d)-(\d\d?)/);
199
+ return (0, moment_1.default)(new Date(parseInt(m[1]), parseInt(m[2]) - 1, 1))[edgeFunction]('month')
200
+ .format('YYYY-MM-DDTHH:mm:ss.SSS');
201
+ };
202
+ const yearMonthDayEdge = edgeFunction => value => {
203
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)/);
204
+ return (0, moment_1.default)(new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])))[edgeFunction]('day')
205
+ .format('YYYY-MM-DDTHH:mm:ss.SSS');
206
+ };
207
+ const yearMonthDayMinuteEdge = edgeFunction => value => {
208
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)\s+(\d\d?):(\d\d?)/);
209
+ const year = m[1];
210
+ const month = m[2];
211
+ const day = m[3];
212
+ const hour = m[4];
213
+ const minute = m[5];
214
+ const dateObject = new Date(year, month - 1, day, hour, minute);
215
+ return (0, moment_1.default)(dateObject)[edgeFunction]('minute').format('YYYY-MM-DDTHH:mm:ss.SSS');
216
+ };
217
+ const yearMonthDayMinuteSecondEdge = edgeFunction => value => {
218
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)(T|\s+)(\d\d?):(\d\d?):(\d\d?)/);
219
+ const year = m[1];
220
+ const month = m[2];
221
+ const day = m[3];
222
+ const hour = m[5];
223
+ const minute = m[6];
224
+ const second = m[7];
225
+ const dateObject = new Date(year, month - 1, day, hour, minute, second);
226
+ return (0, moment_1.default)(dateObject)[edgeFunction]('second').format('YYYY-MM-DDTHH:mm:ss.SSS');
227
+ };
228
+ const createIntervalCondition = (start, end) => {
229
+ return {
230
+ conditionType: 'and',
231
+ conditions: [
232
+ {
233
+ conditionType: 'binary',
234
+ operator: '>=',
235
+ left: {
236
+ exprType: 'placeholder',
237
+ },
238
+ right: {
239
+ exprType: 'value',
240
+ value: start,
241
+ },
242
+ },
243
+ {
244
+ conditionType: 'binary',
245
+ operator: '<=',
246
+ left: {
247
+ exprType: 'placeholder',
248
+ },
249
+ right: {
250
+ exprType: 'value',
251
+ value: end,
252
+ },
253
+ },
254
+ ],
255
+ };
256
+ };
257
+ const createDateIntervalCondition = (start, end) => {
258
+ return createIntervalCondition(start.format('YYYY-MM-DDTHH:mm:ss.SSS'), end.format('YYYY-MM-DDTHH:mm:ss.SSS'));
259
+ };
260
+ const fixedMomentIntervalCondition = (intervalType, diff) => () => {
261
+ return createDateIntervalCondition((0, moment_1.default)().add(intervalType, diff).startOf(intervalType), (0, moment_1.default)().add(intervalType, diff).endOf(intervalType));
262
+ };
263
+ const yearMonthDayMinuteCondition = () => value => {
264
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)\s+(\d\d?):(\d\d?)/);
265
+ const year = m[1];
266
+ const month = m[2];
267
+ const day = m[3];
268
+ const hour = m[4];
269
+ const minute = m[5];
270
+ const dateObject = new Date(year, month - 1, day, hour, minute);
271
+ return createDateIntervalCondition((0, moment_1.default)(dateObject).startOf('minute'), (0, moment_1.default)(dateObject).endOf('minute'));
272
+ };
273
+ const yearMonthDaySecondCondition = () => value => {
274
+ const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)(T|\s+)(\d\d?):(\d\d?):(\d\d?)/);
275
+ const year = m[1];
276
+ const month = m[2];
277
+ const day = m[3];
278
+ const hour = m[5];
279
+ const minute = m[6];
280
+ const second = m[7];
281
+ const dateObject = new Date(year, month - 1, day, hour, minute, second);
282
+ return createDateIntervalCondition((0, moment_1.default)(dateObject).startOf('second'), (0, moment_1.default)(dateObject).endOf('second'));
283
+ };
284
+ const createParser = (filterBehaviour) => {
78
285
  const langDef = {
79
286
  string1: () => (0, common_1.token)(parsimmon_1.default.regexp(/"((?:\\.|.)*?)"/, 1))
80
287
  .map(common_1.interpretEscapes)
@@ -91,6 +298,7 @@ const createParser = (filterType) => {
91
298
  number: () => (0, common_1.token)(parsimmon_1.default.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/))
92
299
  .map(Number)
93
300
  .desc('number'),
301
+ objectid: () => (0, common_1.token)(parsimmon_1.default.regexp(/ObjectId\(['"]?[0-9a-f]{24}['"]?\)/)).desc('ObjectId'),
94
302
  hexstring: () => (0, common_1.token)(parsimmon_1.default.regexp(/0x(([0-9a-fA-F][0-9a-fA-F])+)/, 1))
95
303
  .map(x => ({
96
304
  type: 'Buffer',
@@ -105,23 +313,70 @@ const createParser = (filterType) => {
105
313
  valueTestEq: r => r.value.map(binaryCondition('=')),
106
314
  hexTestEq: r => r.hexstring.map(binaryCondition('=')),
107
315
  valueTestStr: r => r.value.map(likeCondition('like', '%#VALUE#%')),
316
+ valueTestNum: r => r.number.map(numberTestCondition()),
317
+ valueTestObjectId: r => r.objectid.map(objectIdTestCondition()),
318
+ notExists: r => r.not.then(r.exists).map(specificPredicateCondition('notExists')),
319
+ notEmptyArray: r => r.not.then(r.empty).then(r.array).map(specificPredicateCondition('notEmptyArray')),
320
+ emptyArray: r => r.empty.then(r.array).map(specificPredicateCondition('emptyArray')),
321
+ exists: () => (0, common_1.word)('EXISTS').map(specificPredicateCondition('exists')),
322
+ this: () => (0, common_1.word)('THIS'),
323
+ last: () => (0, common_1.word)('LAST'),
324
+ next: () => (0, common_1.word)('NEXT'),
325
+ week: () => (0, common_1.word)('WEEK'),
326
+ month: () => (0, common_1.word)('MONTH'),
327
+ year: () => (0, common_1.word)('YEAR'),
328
+ yesterday: () => (0, common_1.word)('YESTERDAY').map(fixedMomentIntervalCondition('day', -1)),
329
+ today: () => (0, common_1.word)('TODAY').map(fixedMomentIntervalCondition('day', 0)),
330
+ tomorrow: () => (0, common_1.word)('TOMORROW').map(fixedMomentIntervalCondition('day', 1)),
331
+ lastWeek: r => r.last.then(r.week).map(fixedMomentIntervalCondition('week', -1)),
332
+ thisWeek: r => r.this.then(r.week).map(fixedMomentIntervalCondition('week', 0)),
333
+ nextWeek: r => r.next.then(r.week).map(fixedMomentIntervalCondition('week', 1)),
334
+ lastMonth: r => r.last.then(r.month).map(fixedMomentIntervalCondition('month', -1)),
335
+ thisMonth: r => r.this.then(r.month).map(fixedMomentIntervalCondition('month', 0)),
336
+ nextMonth: r => r.next.then(r.month).map(fixedMomentIntervalCondition('month', 1)),
337
+ lastYear: r => r.last.then(r.year).map(fixedMomentIntervalCondition('year', -1)),
338
+ thisYear: r => r.this.then(r.year).map(fixedMomentIntervalCondition('year', 0)),
339
+ nextYear: r => r.next.then(r.year).map(fixedMomentIntervalCondition('year', 1)),
340
+ dateValueStart: r => parsimmon_1.default.alt(r.yearMonthDayMinuteSecondStart, r.yearMonthDayMinuteStart, r.yearMonthDayStart, r.yearMonthStart, r.yearNumStart),
341
+ dateValueEnd: r => parsimmon_1.default.alt(r.yearMonthDayMinuteSecondEnd, r.yearMonthDayMinuteEnd, r.yearMonthDayEnd, r.yearMonthEnd, r.yearNumEnd),
342
+ dateLe: r => (0, common_1.word)('<=').then(r.dateValueEnd).map(binaryCondition('<=')),
343
+ dateGe: r => (0, common_1.word)('>=').then(r.dateValueStart).map(binaryCondition('>=')),
344
+ dateLt: r => (0, common_1.word)('<').then(r.dateValueStart).map(binaryCondition('<')),
345
+ dateGt: r => (0, common_1.word)('>').then(r.dateValueEnd).map(binaryCondition('>')),
346
+ yearNum: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearCondition()),
347
+ yearMonthNum: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthCondition()),
348
+ yearMonthDayNum: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayCondition()),
349
+ yearMonthDayMinute: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteCondition()),
350
+ yearMonthDaySecond: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDaySecondCondition()),
351
+ yearNumStart: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearEdge('startOf')),
352
+ yearNumEnd: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearEdge('endOf')),
353
+ yearMonthStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthEdge('startOf')),
354
+ yearMonthEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthEdge('endOf')),
355
+ yearMonthDayStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayEdge('startOf')),
356
+ yearMonthDayEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayEdge('endOf')),
357
+ yearMonthDayMinuteStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteEdge('startOf')),
358
+ yearMonthDayMinuteEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteEdge('endOf')),
359
+ yearMonthDayMinuteSecondStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDayMinuteSecondEdge('startOf')),
360
+ yearMonthDayMinuteSecondEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDayMinuteSecondEdge('endOf')),
108
361
  comma: () => (0, common_1.word)(','),
109
362
  not: () => (0, common_1.word)('NOT'),
363
+ empty: () => (0, common_1.word)('EMPTY'),
364
+ array: () => (0, common_1.word)('ARRAY'),
110
365
  notNull: r => r.not.then(r.null).map(unaryCondition('isNotNull')),
111
366
  null: () => (0, common_1.word)('NULL').map(unaryCondition('isNull')),
112
- empty: () => (0, common_1.word)('EMPTY').map(unaryCondition('isEmpty')),
113
- notEmpty: r => r.not.then(r.empty).map(unaryCondition('isNotEmpty')),
367
+ isEmpty: r => r.empty.map(unaryCondition('isEmpty')),
368
+ isNotEmpty: r => r.not.then(r.empty).map(unaryCondition('isNotEmpty')),
114
369
  true: () => parsimmon_1.default.regexp(/true/i).map(binaryFixedValueCondition('1')),
115
370
  false: () => parsimmon_1.default.regexp(/false/i).map(binaryFixedValueCondition('0')),
116
371
  trueNum: () => (0, common_1.word)('1').map(binaryFixedValueCondition('1')),
117
372
  falseNum: () => (0, common_1.word)('0').map(binaryFixedValueCondition('0')),
118
- eq: r => (0, common_1.word)('=').then(r.value).map(binaryCondition('=')),
119
- ne: r => (0, common_1.word)('!=').then(r.value).map(binaryCondition('<>')),
120
- ne2: r => (0, common_1.word)('<>').then(r.value).map(binaryCondition('<>')),
121
- le: r => (0, common_1.word)('<=').then(r.value).map(binaryCondition('<=')),
122
- ge: r => (0, common_1.word)('>=').then(r.value).map(binaryCondition('>=')),
123
- lt: r => (0, common_1.word)('<').then(r.value).map(binaryCondition('<')),
124
- gt: r => (0, common_1.word)('>').then(r.value).map(binaryCondition('>')),
373
+ eq: r => (0, common_1.word)('=').then(r.value).map(binaryCondition('=', filterBehaviour.allowNumberDualTesting)),
374
+ ne: r => (0, common_1.word)('!=').then(r.value).map(binaryCondition('<>', filterBehaviour.allowNumberDualTesting)),
375
+ ne2: r => (0, common_1.word)('<>').then(r.value).map(binaryCondition('<>', filterBehaviour.allowNumberDualTesting)),
376
+ le: r => (0, common_1.word)('<=').then(r.value).map(binaryCondition('<=', filterBehaviour.allowNumberDualTesting)),
377
+ ge: r => (0, common_1.word)('>=').then(r.value).map(binaryCondition('>=', filterBehaviour.allowNumberDualTesting)),
378
+ lt: r => (0, common_1.word)('<').then(r.value).map(binaryCondition('<', filterBehaviour.allowNumberDualTesting)),
379
+ gt: r => (0, common_1.word)('>').then(r.value).map(binaryCondition('>', filterBehaviour.allowNumberDualTesting)),
125
380
  startsWith: r => (0, common_1.word)('^').then(r.value).map(likeCondition('like', '#VALUE#%')),
126
381
  endsWith: r => (0, common_1.word)('$').then(r.value).map(likeCondition('like', '%#VALUE#')),
127
382
  contains: r => (0, common_1.word)('+').then(r.value).map(likeCondition('like', '%#VALUE#%')),
@@ -133,30 +388,65 @@ const createParser = (filterType) => {
133
388
  list: r => r.factor.sepBy(r.comma).map(compoudCondition('or')),
134
389
  };
135
390
  const allowedValues = []; // 'string1', 'string2', 'number', 'noQuotedString'];
136
- if (filterType == 'string' || filterType == 'eval') {
391
+ if (filterBehaviour.allowStringToken) {
137
392
  allowedValues.push('string1', 'string2', 'noQuotedString');
138
393
  }
139
- if (filterType == 'number') {
394
+ if (filterBehaviour.allowNumberToken) {
140
395
  allowedValues.push('string1Num', 'string2Num', 'number');
141
396
  }
142
- const allowedElements = ['null', 'notNull', 'eq', 'ne', 'ne2', 'sql'];
143
- if (filterType == 'number' || filterType == 'datetime' || filterType == 'eval') {
397
+ const allowedElements = [];
398
+ if (filterBehaviour.supportDatetimeComparison) {
399
+ allowedElements.push('yearMonthDaySecond', 'yearMonthDayMinute', 'yearMonthDayNum', 'yearMonthNum', 'yearNum');
400
+ }
401
+ if (filterBehaviour.supportDatetimeSymbols) {
402
+ allowedElements.push('today', 'tomorrow', 'lastWeek', 'thisWeek', 'nextWeek', 'lastMonth', 'thisMonth', 'nextMonth', 'lastYear', 'thisYear', 'nextYear');
403
+ }
404
+ if (filterBehaviour.supportDatetimeComparison) {
405
+ allowedElements.push('dateLe', 'dateGe', 'dateLt', 'dateGt');
406
+ }
407
+ if (filterBehaviour.supportExistsTesting) {
408
+ allowedElements.push('exists', 'notExists');
409
+ }
410
+ if (filterBehaviour.supportArrayTesting) {
411
+ allowedElements.push('emptyArray', 'notEmptyArray');
412
+ }
413
+ if (filterBehaviour.supportNullTesting) {
414
+ allowedElements.push('null', 'notNull');
415
+ }
416
+ if (filterBehaviour.supportEquals) {
417
+ allowedElements.push('eq', 'ne', 'ne2');
418
+ }
419
+ if (filterBehaviour.supportSqlCondition) {
420
+ allowedElements.push('sql');
421
+ }
422
+ if (filterBehaviour.supportNumberLikeComparison || filterBehaviour.supportDatetimeComparison) {
144
423
  allowedElements.push('le', 'ge', 'lt', 'gt');
145
424
  }
146
- if (filterType == 'string') {
147
- allowedElements.push('empty', 'notEmpty', 'hexTestEq');
425
+ if (filterBehaviour.supportEmpty) {
426
+ allowedElements.push('isEmpty', 'isNotEmpty');
148
427
  }
149
- if (filterType == 'eval' || filterType == 'string') {
428
+ if (filterBehaviour.allowHexString) {
429
+ allowedElements.push('hexTestEq');
430
+ }
431
+ if (filterBehaviour.supportStringInclusion) {
150
432
  allowedElements.push('startsWith', 'endsWith', 'contains', 'startsWithNot', 'endsWithNot', 'containsNot');
151
433
  }
152
- if (filterType == 'logical') {
153
- allowedElements.push('true', 'false', 'trueNum', 'falseNum');
434
+ if (filterBehaviour.supportBooleanValues) {
435
+ if (filterBehaviour.allowNumberToken || filterBehaviour.allowStringToken) {
436
+ allowedElements.push('true', 'false');
437
+ }
438
+ else {
439
+ allowedElements.push('true', 'false', 'trueNum', 'falseNum');
440
+ }
441
+ }
442
+ if (filterBehaviour.allowNumberDualTesting) {
443
+ allowedElements.push('valueTestNum');
154
444
  }
155
- if (filterType == 'eval') {
156
- allowedElements.push('true', 'false');
445
+ if (filterBehaviour.allowObjectIdTesting) {
446
+ allowedElements.push('valueTestObjectId');
157
447
  }
158
448
  // must be last
159
- if (filterType == 'string' || filterType == 'eval') {
449
+ if (filterBehaviour.allowStringToken) {
160
450
  allowedElements.push('valueTestStr');
161
451
  }
162
452
  else {
@@ -164,17 +454,19 @@ const createParser = (filterType) => {
164
454
  }
165
455
  return parsimmon_1.default.createLanguage(langDef);
166
456
  };
167
- const parsers = {
168
- number: createParser('number'),
169
- string: createParser('string'),
170
- logical: createParser('logical'),
171
- eval: createParser('eval'),
172
- mongo: mongoParser_1.mongoParser,
173
- datetime: datetimeParser_1.datetimeParser,
174
- };
175
- function parseFilter(value, filterType) {
176
- // console.log('PARSING', value, 'WITH', filterType);
177
- const ast = parsers[filterType].list.tryParse(value);
457
+ const cachedFilters = {};
458
+ function getParser(filterBehaviour) {
459
+ const key = JSON.stringify(filterBehaviour);
460
+ if (!cachedFilters[key]) {
461
+ cachedFilters[key] = createParser(filterBehaviour);
462
+ }
463
+ return cachedFilters[key];
464
+ }
465
+ function parseFilter(value, filterBehaviour) {
466
+ const parser = getParser(filterBehaviour);
467
+ // console.log('value', value);
468
+ // console.log('filterBehaviour', filterBehaviour);
469
+ const ast = parser.list.tryParse(value);
178
470
  // console.log('AST', ast);
179
471
  return ast;
180
472
  }
@@ -1 +1,2 @@
1
1
  declare const parseFilter: any;
2
+ declare const stringFilterBehaviour: any;
@@ -1,6 +1,7 @@
1
1
  const { parseFilter } = require('./parseFilter');
2
+ const { stringFilterBehaviour } = require('dbgate-tools');
2
3
  test('parse string', () => {
3
- const ast = parseFilter('"123"', 'string');
4
+ const ast = parseFilter('"123"', stringFilterBehaviour);
4
5
  console.log(JSON.stringify(ast));
5
6
  expect(ast).toEqual({
6
7
  conditionType: 'like',
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.3.3",
2
+ "version": "5.4.0",
3
3
  "name": "dbgate-filterparser",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "lib"
14
14
  ],
15
15
  "devDependencies": {
16
- "dbgate-types": "^5.3.3",
16
+ "dbgate-types": "^5.4.0",
17
17
  "@types/jest": "^25.1.4",
18
18
  "@types/node": "^13.7.0",
19
19
  "jest": "^28.1.3",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@types/parsimmon": "^1.10.1",
25
- "dbgate-tools": "^5.3.3",
25
+ "dbgate-tools": "^5.4.0",
26
26
  "lodash": "^4.17.21",
27
27
  "moment": "^2.24.0",
28
28
  "parsimmon": "^1.13.0"
@@ -1,2 +0,0 @@
1
- import P from 'parsimmon';
2
- export declare const datetimeParser: P.Language;
@@ -1,228 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.datetimeParser = void 0;
7
- const parsimmon_1 = __importDefault(require("parsimmon"));
8
- const moment_1 = __importDefault(require("moment"));
9
- const common_1 = require("./common");
10
- const compoudCondition = conditionType => conditions => {
11
- if (conditions.length == 1)
12
- return conditions[0];
13
- return {
14
- [conditionType]: conditions,
15
- };
16
- };
17
- function getTransformCondition(transform, value) {
18
- return {
19
- conditionType: 'binary',
20
- operator: '=',
21
- left: {
22
- exprType: 'transform',
23
- transform,
24
- expr: {
25
- exprType: 'placeholder',
26
- },
27
- },
28
- right: {
29
- exprType: 'value',
30
- value,
31
- },
32
- };
33
- }
34
- const yearCondition = () => value => {
35
- return getTransformCondition('YEAR', value);
36
- };
37
- const yearMonthCondition = () => value => {
38
- const m = value.match(/(\d\d\d\d)-(\d\d?)/);
39
- return {
40
- conditionType: 'and',
41
- conditions: [getTransformCondition('YEAR', m[1]), getTransformCondition('MONTH', m[2])],
42
- };
43
- };
44
- const yearMonthDayCondition = () => value => {
45
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)/);
46
- return {
47
- conditionType: 'and',
48
- conditions: [
49
- getTransformCondition('YEAR', m[1]),
50
- getTransformCondition('MONTH', m[2]),
51
- getTransformCondition('DAY', m[3]),
52
- ],
53
- };
54
- };
55
- const yearEdge = edgeFunction => value => {
56
- return (0, moment_1.default)(new Date(parseInt(value), 0, 1))[edgeFunction]('year')
57
- .format('YYYY-MM-DDTHH:mm:ss.SSS');
58
- };
59
- const yearMonthEdge = edgeFunction => value => {
60
- const m = value.match(/(\d\d\d\d)-(\d\d?)/);
61
- return (0, moment_1.default)(new Date(parseInt(m[1]), parseInt(m[2]) - 1, 1))[edgeFunction]('month')
62
- .format('YYYY-MM-DDTHH:mm:ss.SSS');
63
- };
64
- const yearMonthDayEdge = edgeFunction => value => {
65
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)/);
66
- return (0, moment_1.default)(new Date(parseInt(m[1]), parseInt(m[2]) - 1, parseInt(m[3])))[edgeFunction]('day')
67
- .format('YYYY-MM-DDTHH:mm:ss.SSS');
68
- };
69
- const yearMonthDayMinuteEdge = edgeFunction => value => {
70
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)\s+(\d\d?):(\d\d?)/);
71
- const year = m[1];
72
- const month = m[2];
73
- const day = m[3];
74
- const hour = m[4];
75
- const minute = m[5];
76
- const dateObject = new Date(year, month - 1, day, hour, minute);
77
- return (0, moment_1.default)(dateObject)[edgeFunction]('minute').format('YYYY-MM-DDTHH:mm:ss.SSS');
78
- };
79
- const yearMonthDayMinuteSecondEdge = edgeFunction => value => {
80
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)(T|\s+)(\d\d?):(\d\d?):(\d\d?)/);
81
- const year = m[1];
82
- const month = m[2];
83
- const day = m[3];
84
- const hour = m[5];
85
- const minute = m[6];
86
- const second = m[7];
87
- const dateObject = new Date(year, month - 1, day, hour, minute, second);
88
- return (0, moment_1.default)(dateObject)[edgeFunction]('second').format('YYYY-MM-DDTHH:mm:ss.SSS');
89
- };
90
- const createIntervalCondition = (start, end) => {
91
- return {
92
- conditionType: 'and',
93
- conditions: [
94
- {
95
- conditionType: 'binary',
96
- operator: '>=',
97
- left: {
98
- exprType: 'placeholder',
99
- },
100
- right: {
101
- exprType: 'value',
102
- value: start,
103
- },
104
- },
105
- {
106
- conditionType: 'binary',
107
- operator: '<=',
108
- left: {
109
- exprType: 'placeholder',
110
- },
111
- right: {
112
- exprType: 'value',
113
- value: end,
114
- },
115
- },
116
- ],
117
- };
118
- };
119
- const createDateIntervalCondition = (start, end) => {
120
- return createIntervalCondition(start.format('YYYY-MM-DDTHH:mm:ss.SSS'), end.format('YYYY-MM-DDTHH:mm:ss.SSS'));
121
- };
122
- const fixedMomentIntervalCondition = (intervalType, diff) => () => {
123
- return createDateIntervalCondition((0, moment_1.default)().add(intervalType, diff).startOf(intervalType), (0, moment_1.default)().add(intervalType, diff).endOf(intervalType));
124
- };
125
- const yearMonthDayMinuteCondition = () => value => {
126
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)\s+(\d\d?):(\d\d?)/);
127
- const year = m[1];
128
- const month = m[2];
129
- const day = m[3];
130
- const hour = m[4];
131
- const minute = m[5];
132
- const dateObject = new Date(year, month - 1, day, hour, minute);
133
- return createDateIntervalCondition((0, moment_1.default)(dateObject).startOf('minute'), (0, moment_1.default)(dateObject).endOf('minute'));
134
- };
135
- const yearMonthDaySecondCondition = () => value => {
136
- const m = value.match(/(\d\d\d\d)-(\d\d?)-(\d\d?)(T|\s+)(\d\d?):(\d\d?):(\d\d?)/);
137
- const year = m[1];
138
- const month = m[2];
139
- const day = m[3];
140
- const hour = m[5];
141
- const minute = m[6];
142
- const second = m[7];
143
- const dateObject = new Date(year, month - 1, day, hour, minute, second);
144
- return createDateIntervalCondition((0, moment_1.default)(dateObject).startOf('second'), (0, moment_1.default)(dateObject).endOf('second'));
145
- };
146
- const binaryCondition = operator => value => ({
147
- conditionType: 'binary',
148
- operator,
149
- left: {
150
- exprType: 'placeholder',
151
- },
152
- right: {
153
- exprType: 'value',
154
- value,
155
- },
156
- });
157
- const unaryCondition = conditionType => () => {
158
- return {
159
- conditionType,
160
- expr: {
161
- exprType: 'placeholder',
162
- },
163
- };
164
- };
165
- const sqlTemplate = templateSql => {
166
- return {
167
- conditionType: 'rawTemplate',
168
- templateSql,
169
- expr: {
170
- exprType: 'placeholder',
171
- },
172
- };
173
- };
174
- const createParser = () => {
175
- const langDef = {
176
- comma: () => (0, common_1.word)(','),
177
- not: () => (0, common_1.word)('NOT'),
178
- notNull: r => r.not.then(r.null).map(unaryCondition('isNotNull')),
179
- null: () => (0, common_1.word)('NULL').map(unaryCondition('isNull')),
180
- sql: () => (0, common_1.token)(parsimmon_1.default.regexp(/\{(.*?)\}/, 1))
181
- .map(sqlTemplate)
182
- .desc('sql literal'),
183
- yearNum: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearCondition()),
184
- yearMonthNum: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthCondition()),
185
- yearMonthDayNum: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayCondition()),
186
- yearMonthDayMinute: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteCondition()),
187
- yearMonthDaySecond: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDaySecondCondition()),
188
- yearNumStart: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearEdge('startOf')),
189
- yearNumEnd: () => parsimmon_1.default.regexp(/\d\d\d\d/).map(yearEdge('endOf')),
190
- yearMonthStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthEdge('startOf')),
191
- yearMonthEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?/).map(yearMonthEdge('endOf')),
192
- yearMonthDayStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayEdge('startOf')),
193
- yearMonthDayEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayEdge('endOf')),
194
- yearMonthDayMinuteStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteEdge('startOf')),
195
- yearMonthDayMinuteEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?\s+\d\d?:\d\d?/).map(yearMonthDayMinuteEdge('endOf')),
196
- yearMonthDayMinuteSecondStart: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDayMinuteSecondEdge('startOf')),
197
- yearMonthDayMinuteSecondEnd: () => parsimmon_1.default.regexp(/\d\d\d\d-\d\d?-\d\d?(\s+|T)\d\d?:\d\d?:\d\d?/).map(yearMonthDayMinuteSecondEdge('endOf')),
198
- this: () => (0, common_1.word)('THIS'),
199
- last: () => (0, common_1.word)('LAST'),
200
- next: () => (0, common_1.word)('NEXT'),
201
- week: () => (0, common_1.word)('WEEK'),
202
- month: () => (0, common_1.word)('MONTH'),
203
- year: () => (0, common_1.word)('YEAR'),
204
- yesterday: () => (0, common_1.word)('YESTERDAY').map(fixedMomentIntervalCondition('day', -1)),
205
- today: () => (0, common_1.word)('TODAY').map(fixedMomentIntervalCondition('day', 0)),
206
- tomorrow: () => (0, common_1.word)('TOMORROW').map(fixedMomentIntervalCondition('day', 1)),
207
- lastWeek: r => r.last.then(r.week).map(fixedMomentIntervalCondition('week', -1)),
208
- thisWeek: r => r.this.then(r.week).map(fixedMomentIntervalCondition('week', 0)),
209
- nextWeek: r => r.next.then(r.week).map(fixedMomentIntervalCondition('week', 1)),
210
- lastMonth: r => r.last.then(r.month).map(fixedMomentIntervalCondition('month', -1)),
211
- thisMonth: r => r.this.then(r.month).map(fixedMomentIntervalCondition('month', 0)),
212
- nextMonth: r => r.next.then(r.month).map(fixedMomentIntervalCondition('month', 1)),
213
- lastYear: r => r.last.then(r.year).map(fixedMomentIntervalCondition('year', -1)),
214
- thisYear: r => r.this.then(r.year).map(fixedMomentIntervalCondition('year', 0)),
215
- nextYear: r => r.next.then(r.year).map(fixedMomentIntervalCondition('year', 1)),
216
- valueStart: r => parsimmon_1.default.alt(r.yearMonthDayMinuteSecondStart, r.yearMonthDayMinuteStart, r.yearMonthDayStart, r.yearMonthStart, r.yearNumStart),
217
- valueEnd: r => parsimmon_1.default.alt(r.yearMonthDayMinuteSecondEnd, r.yearMonthDayMinuteEnd, r.yearMonthDayEnd, r.yearMonthEnd, r.yearNumEnd),
218
- le: r => (0, common_1.word)('<=').then(r.valueEnd).map(binaryCondition('<=')),
219
- ge: r => (0, common_1.word)('>=').then(r.valueStart).map(binaryCondition('>=')),
220
- lt: r => (0, common_1.word)('<').then(r.valueStart).map(binaryCondition('<')),
221
- gt: r => (0, common_1.word)('>').then(r.valueEnd).map(binaryCondition('>')),
222
- element: r => parsimmon_1.default.alt(r.yearMonthDaySecond, r.yearMonthDayMinute, r.yearMonthDayNum, r.yearMonthNum, r.yearNum, r.yesterday, r.today, r.tomorrow, r.lastWeek, r.thisWeek, r.nextWeek, r.lastMonth, r.thisMonth, r.nextMonth, r.lastYear, r.thisYear, r.nextYear, r.null, r.notNull, r.le, r.lt, r.ge, r.gt, r.sql).trim(common_1.whitespace),
223
- factor: r => r.element.sepBy(common_1.whitespace).map(compoudCondition('$and')),
224
- list: r => r.factor.sepBy(r.comma).map(compoudCondition('$or')),
225
- };
226
- return parsimmon_1.default.createLanguage(langDef);
227
- };
228
- exports.datetimeParser = createParser();
@@ -1,2 +0,0 @@
1
- import { FilterType } from './types';
2
- export declare function getFilterType(dataType: string): FilterType;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFilterType = void 0;
4
- const dbgate_tools_1 = require("dbgate-tools");
5
- function getFilterType(dataType) {
6
- if (!dataType)
7
- return 'string';
8
- if ((0, dbgate_tools_1.isTypeNumber)(dataType))
9
- return 'number';
10
- if ((0, dbgate_tools_1.isTypeString)(dataType))
11
- return 'string';
12
- if ((0, dbgate_tools_1.isTypeLogical)(dataType))
13
- return 'logical';
14
- if ((0, dbgate_tools_1.isTypeDateTime)(dataType))
15
- return 'datetime';
16
- return 'string';
17
- }
18
- exports.getFilterType = getFilterType;
@@ -1,2 +0,0 @@
1
- import P from 'parsimmon';
2
- export declare const mongoParser: P.Language;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.mongoParser = void 0;
7
- const parsimmon_1 = __importDefault(require("parsimmon"));
8
- const common_1 = require("./common");
9
- const operatorCondition = operator => value => ({
10
- __placeholder__: {
11
- [operator]: value,
12
- },
13
- });
14
- const regexCondition = regexString => value => ({
15
- __placeholder__: {
16
- $regex: regexString.replace('#VALUE#', value),
17
- $options: 'i',
18
- },
19
- });
20
- const numberTestCondition = () => value => ({
21
- $or: [
22
- {
23
- __placeholder__: {
24
- $regex: `.*${value}.*`,
25
- $options: 'i',
26
- },
27
- },
28
- {
29
- __placeholder__: value,
30
- },
31
- ],
32
- });
33
- const idRegex = /[('"]([0-9a-f]{24})['")]/;
34
- const objectIdTestCondition = () => value => ({
35
- $or: [
36
- {
37
- __placeholder__: { $oid: value.match(idRegex)[1] },
38
- },
39
- ],
40
- });
41
- const testCondition = (operator, value) => () => ({
42
- __placeholder__: {
43
- [operator]: value,
44
- },
45
- });
46
- const multiTestCondition = condition => () => ({
47
- __placeholder__: condition,
48
- });
49
- const compoudCondition = conditionType => conditions => {
50
- if (conditions.length == 1)
51
- return conditions[0];
52
- return {
53
- [conditionType]: conditions,
54
- };
55
- };
56
- const negateCondition = condition => ({
57
- __placeholder__: {
58
- $not: condition.__placeholder__,
59
- },
60
- });
61
- const createParser = () => {
62
- const langDef = {
63
- string1: () => (0, common_1.token)(parsimmon_1.default.regexp(/"((?:\\.|.)*?)"/, 1))
64
- .map(common_1.interpretEscapes)
65
- .desc('string quoted'),
66
- string2: () => (0, common_1.token)(parsimmon_1.default.regexp(/'((?:\\.|.)*?)'/, 1))
67
- .map(common_1.interpretEscapes)
68
- .desc('string quoted'),
69
- number: () => (0, common_1.token)(parsimmon_1.default.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/))
70
- .map(Number)
71
- .desc('number'),
72
- objectid: () => (0, common_1.token)(parsimmon_1.default.regexp(/ObjectId\(['"]?[0-9a-f]{24}['"]?\)/)).desc('ObjectId'),
73
- noQuotedString: () => parsimmon_1.default.regexp(/[^\s^,^'^"]+/).desc('string unquoted'),
74
- value: r => parsimmon_1.default.alt(r.objectid, r.string1, r.string2, r.number, r.noQuotedString),
75
- valueTestObjectId: r => r.objectid.map(objectIdTestCondition()),
76
- valueTestNum: r => r.number.map(numberTestCondition()),
77
- valueTest: r => r.value.map(regexCondition('.*#VALUE#.*')),
78
- comma: () => (0, common_1.word)(','),
79
- not: () => (0, common_1.word)('NOT'),
80
- empty: () => (0, common_1.word)('EMPTY'),
81
- array: () => (0, common_1.word)('ARRAY'),
82
- notExists: r => r.not.then(r.exists).map(testCondition('$exists', false)),
83
- notEmptyArray: r => r.not
84
- .then(r.empty)
85
- .then(r.array)
86
- .map(multiTestCondition({ $exists: true, $type: 'array', $ne: [] })),
87
- emptyArray: r => r.empty.then(r.array).map(multiTestCondition({ $exists: true, $eq: [] })),
88
- exists: () => (0, common_1.word)('EXISTS').map(testCondition('$exists', true)),
89
- true: () => (0, common_1.word)('TRUE').map(testCondition('$eq', true)),
90
- false: () => (0, common_1.word)('FALSE').map(testCondition('$eq', false)),
91
- eq: r => (0, common_1.word)('=').then(r.value).map(operatorCondition('$eq')),
92
- ne: r => (0, common_1.word)('!=').then(r.value).map(operatorCondition('$ne')),
93
- ne2: r => (0, common_1.word)('<>').then(r.value).map(operatorCondition('$ne')),
94
- lt: r => (0, common_1.word)('<').then(r.value).map(operatorCondition('$lt')),
95
- gt: r => (0, common_1.word)('>').then(r.value).map(operatorCondition('$gt')),
96
- le: r => (0, common_1.word)('<=').then(r.value).map(operatorCondition('$lte')),
97
- ge: r => (0, common_1.word)('>=').then(r.value).map(operatorCondition('$gte')),
98
- startsWith: r => (0, common_1.word)('^').then(r.value).map(regexCondition('#VALUE#.*')),
99
- endsWith: r => (0, common_1.word)('$').then(r.value).map(regexCondition('.*#VALUE#')),
100
- contains: r => (0, common_1.word)('+').then(r.value).map(regexCondition('.*#VALUE#.*')),
101
- startsWithNot: r => (0, common_1.word)('!^').then(r.value).map(regexCondition('#VALUE#.*')).map(negateCondition),
102
- endsWithNot: r => (0, common_1.word)('!$').then(r.value).map(regexCondition('.*#VALUE#')).map(negateCondition),
103
- containsNot: r => (0, common_1.word)('~').then(r.value).map(regexCondition('.*#VALUE#.*')).map(negateCondition),
104
- element: r => parsimmon_1.default.alt(r.exists, r.notExists, r.true, r.false, r.eq, r.ne, r.ne2, r.lt, r.gt, r.le, r.ge, r.notEmptyArray, r.emptyArray, r.startsWith, r.endsWith, r.contains, r.startsWithNot, r.endsWithNot, r.containsNot, r.valueTestObjectId, r.valueTestNum, r.valueTest).trim(common_1.whitespace),
105
- factor: r => r.element.sepBy(common_1.whitespace).map(compoudCondition('$and')),
106
- list: r => r.factor.sepBy(r.comma).map(compoudCondition('$or')),
107
- };
108
- return parsimmon_1.default.createLanguage(langDef);
109
- };
110
- exports.mongoParser = createParser();
package/lib/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export type FilterType = 'number' | 'string' | 'datetime' | 'logical' | 'eval' | 'mongo';
package/lib/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // import types from 'dbgate-types';
3
- Object.defineProperty(exports, "__esModule", { value: true });