@lowdefy/operators 3.23.0 → 4.0.0-alpha.5
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/common/change_case.js +114 -160
- package/dist/common/index.js +39 -54
- package/dist/common/mql.js +93 -102
- package/dist/common/uuid.js +48 -59
- package/dist/common/yaml.js +56 -63
- package/dist/getFromArray.js +22 -44
- package/dist/getFromObject.js +25 -70
- package/dist/index.js +18 -20
- package/dist/node/diff.js +30 -47
- package/dist/node/index.js +6 -14
- package/dist/nodeParser.js +83 -146
- package/dist/runClass.js +57 -82
- package/dist/runInstance.js +60 -84
- package/dist/web/format.js +15 -37
- package/dist/web/index.js +17 -21
- package/dist/web/js.js +10 -30
- package/dist/webParser.js +99 -157
- package/package.json +16 -15
- package/dist/common/_index.js +0 -45
- package/dist/common/and.js +0 -39
- package/dist/common/args.js +0 -46
- package/dist/common/array.js +0 -170
- package/dist/common/date.js +0 -75
- package/dist/common/divide.js +0 -51
- package/dist/common/eq.js +0 -43
- package/dist/common/event.js +0 -46
- package/dist/common/function.js +0 -78
- package/dist/common/get.js +0 -61
- package/dist/common/global.js +0 -50
- package/dist/common/gt.js +0 -43
- package/dist/common/gte.js +0 -43
- package/dist/common/if.js +0 -41
- package/dist/common/if_none.js +0 -47
- package/dist/common/input.js +0 -50
- package/dist/common/json.js +0 -64
- package/dist/common/log.js +0 -33
- package/dist/common/lt.js +0 -43
- package/dist/common/lte.js +0 -43
- package/dist/common/math.js +0 -210
- package/dist/common/ne.js +0 -43
- package/dist/common/not.js +0 -31
- package/dist/common/number.js +0 -125
- package/dist/common/nunjucks.js +0 -60
- package/dist/common/object.js +0 -118
- package/dist/common/operator.js +0 -49
- package/dist/common/or.js +0 -39
- package/dist/common/product.js +0 -45
- package/dist/common/random.js +0 -132
- package/dist/common/regex.js +0 -65
- package/dist/common/state.js +0 -50
- package/dist/common/string.js +0 -188
- package/dist/common/subtract.js +0 -47
- package/dist/common/sum.js +0 -45
- package/dist/common/switch.js +0 -49
- package/dist/common/type.js +0 -82
- package/dist/common/uri.js +0 -67
- package/dist/common/url_query.js +0 -50
- package/dist/common/user.js +0 -50
- package/dist/getFromOtherContext.js +0 -96
- package/dist/node/base64.js +0 -69
- package/dist/node/hash.js +0 -100
- package/dist/node/secret.js +0 -54
- package/dist/web/actions.js +0 -46
- package/dist/web/base64.js +0 -67
- package/dist/web/event_log.js +0 -50
- package/dist/web/list_contexts.js +0 -31
- package/dist/web/location.js +0 -74
- package/dist/web/media.js +0 -90
- package/dist/web/menu.js +0 -43
- package/dist/web/request.js +0 -56
- package/dist/web/request_details.js +0 -50
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _changeCase = require("change-case");
|
|
9
|
-
|
|
10
|
-
var _helpers = require("@lowdefy/helpers");
|
|
11
|
-
|
|
12
|
-
var _runClass = _interopRequireDefault(require("../runClass"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
1
|
/*
|
|
17
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
18
3
|
|
|
@@ -27,159 +12,128 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
13
|
See the License for the specific language governing permissions and
|
|
29
14
|
limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
15
|
+
*/ /* eslint-disable import/namespace */ import { camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase } from 'change-case';
|
|
16
|
+
import { get, type } from '@lowdefy/helpers';
|
|
17
|
+
import runClass from '../runClass.js';
|
|
18
|
+
const changeCase = {
|
|
19
|
+
camelCase,
|
|
20
|
+
capitalCase,
|
|
21
|
+
constantCase,
|
|
22
|
+
dotCase,
|
|
23
|
+
headerCase,
|
|
24
|
+
noCase,
|
|
25
|
+
paramCase,
|
|
26
|
+
pascalCase,
|
|
27
|
+
pathCase,
|
|
28
|
+
sentenceCase,
|
|
29
|
+
snakeCase
|
|
45
30
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (!_helpers.type.isObject(regex)) {
|
|
53
|
-
throw new Error("Operator Error: regex must be string or an object. Received ".concat(JSON.stringify(prop), " at ").concat(location, "."));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
return new RegExp(regex.pattern, regex.flags || 'gm');
|
|
58
|
-
} catch (e) {
|
|
59
|
-
throw new Error("Operator Error: ".concat(e.message, ". Received: ").concat(JSON.stringify(prop), " at ").concat(location, "."));
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var prep = (args, _ref) => {
|
|
64
|
-
var {
|
|
65
|
-
location
|
|
66
|
-
} = _ref;
|
|
67
|
-
var options = args[1];
|
|
68
|
-
|
|
69
|
-
if (!_helpers.type.isNone(options) && !_helpers.type.isObject(options)) {
|
|
70
|
-
throw new Error("Operator Error: options must be an object. Received ".concat(JSON.stringify(options), " at ").concat(location, "."));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (_helpers.type.isObject(options)) {
|
|
74
|
-
if (options.splitRegexp) {
|
|
75
|
-
options.splitRegexp = prepRegex(options.splitRegexp, location);
|
|
31
|
+
const prepRegex = (prop, location)=>{
|
|
32
|
+
const regex = type.isString(prop) ? {
|
|
33
|
+
pattern: prop
|
|
34
|
+
} : prop;
|
|
35
|
+
if (!type.isObject(regex)) {
|
|
36
|
+
throw new Error(`Operator Error: regex must be string or an object. Received ${JSON.stringify(prop)} at ${location}.`);
|
|
76
37
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
38
|
+
try {
|
|
39
|
+
return new RegExp(regex.pattern, regex.flags || 'gm');
|
|
40
|
+
} catch (e) {
|
|
41
|
+
throw new Error(`Operator Error: ${e.message}. Received: ${JSON.stringify(prop)} at ${location}.`);
|
|
80
42
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return args;
|
|
84
43
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
on,
|
|
90
|
-
options
|
|
91
|
-
} = _ref2;
|
|
92
|
-
return on.map(item => {
|
|
93
|
-
if (_helpers.type.isString(item)) {
|
|
94
|
-
return changeCase[methodName](item, options);
|
|
44
|
+
const prep = (args, { location })=>{
|
|
45
|
+
const options = args[1];
|
|
46
|
+
if (!type.isNone(options) && !type.isObject(options)) {
|
|
47
|
+
throw new Error(`Operator Error: options must be an object. Received ${JSON.stringify(options)} at ${location}.`);
|
|
95
48
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
methodName,
|
|
104
|
-
on,
|
|
105
|
-
options
|
|
106
|
-
} = _ref3;
|
|
107
|
-
var result = {};
|
|
108
|
-
var keyConverter = (0, _helpers.get)(options, 'convertKeys') ? key => changeCase[methodName](key, options) : key => key;
|
|
109
|
-
var valueConverter = (0, _helpers.get)(options, 'convertValues', {
|
|
110
|
-
default: true
|
|
111
|
-
}) ? val => changeCase[methodName](val, options) : val => val;
|
|
112
|
-
Object.entries(on).forEach(_ref4 => {
|
|
113
|
-
var [key, value] = _ref4;
|
|
114
|
-
|
|
115
|
-
if (_helpers.type.isString(value)) {
|
|
116
|
-
result[keyConverter(key)] = valueConverter(value);
|
|
117
|
-
} else {
|
|
118
|
-
result[keyConverter(key)] = value;
|
|
49
|
+
if (type.isObject(options)) {
|
|
50
|
+
if (options.splitRegexp) {
|
|
51
|
+
options.splitRegexp = prepRegex(options.splitRegexp, location);
|
|
52
|
+
}
|
|
53
|
+
if (options.stripRegexp) {
|
|
54
|
+
options.stripRegexp = prepRegex(options.stripRegexp, location);
|
|
55
|
+
}
|
|
119
56
|
}
|
|
120
|
-
|
|
121
|
-
return result;
|
|
57
|
+
return args;
|
|
122
58
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
59
|
+
const convertArray = ({ methodName , on , options })=>{
|
|
60
|
+
return on.map((item)=>{
|
|
61
|
+
if (type.isString(item)) {
|
|
62
|
+
return changeCase[methodName](item, options);
|
|
63
|
+
}
|
|
64
|
+
return item;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const convertObject = ({ methodName , on , options })=>{
|
|
68
|
+
const result = {
|
|
69
|
+
};
|
|
70
|
+
const keyConverter = get(options, 'convertKeys') ? (key)=>changeCase[methodName](key, options)
|
|
71
|
+
: (key)=>key
|
|
72
|
+
;
|
|
73
|
+
const valueConverter = get(options, 'convertValues', {
|
|
74
|
+
default: true
|
|
75
|
+
}) ? (val)=>changeCase[methodName](val, options)
|
|
76
|
+
: (val)=>val
|
|
77
|
+
;
|
|
78
|
+
Object.entries(on).forEach(([key, value])=>{
|
|
79
|
+
if (type.isString(value)) {
|
|
80
|
+
result[keyConverter(key)] = valueConverter(value);
|
|
81
|
+
} else {
|
|
82
|
+
result[keyConverter(key)] = value;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
const makeCaseChanger = ({ methodName })=>(on, options = {
|
|
88
|
+
})=>{
|
|
89
|
+
if (type.isString(on)) {
|
|
90
|
+
return changeCase[methodName](on, options);
|
|
91
|
+
}
|
|
92
|
+
if (type.isArray(on)) {
|
|
93
|
+
return convertArray({
|
|
94
|
+
methodName,
|
|
95
|
+
on,
|
|
96
|
+
options
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (type.isObject(on)) {
|
|
100
|
+
return convertObject({
|
|
101
|
+
methodName,
|
|
102
|
+
on,
|
|
103
|
+
options
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return on;
|
|
149
107
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
};
|
|
108
|
+
;
|
|
109
|
+
const functions = {
|
|
153
110
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
111
|
+
const meta = {
|
|
112
|
+
};
|
|
113
|
+
Object.keys(changeCase).forEach((methodName)=>{
|
|
114
|
+
functions[methodName] = makeCaseChanger({
|
|
115
|
+
methodName
|
|
116
|
+
});
|
|
117
|
+
meta[methodName] = {
|
|
118
|
+
namedArgs: [
|
|
119
|
+
'on',
|
|
120
|
+
'options'
|
|
121
|
+
],
|
|
122
|
+
validTypes: [
|
|
123
|
+
'array',
|
|
124
|
+
'object'
|
|
125
|
+
],
|
|
126
|
+
prep
|
|
127
|
+
};
|
|
166
128
|
});
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
location,
|
|
177
|
-
meta,
|
|
178
|
-
methodName,
|
|
179
|
-
operator: '_change_case',
|
|
180
|
-
params
|
|
181
|
-
});
|
|
129
|
+
function change_case({ params , location , methodName }) {
|
|
130
|
+
return runClass({
|
|
131
|
+
functions,
|
|
132
|
+
location,
|
|
133
|
+
meta,
|
|
134
|
+
methodName,
|
|
135
|
+
operator: '_change_case',
|
|
136
|
+
params
|
|
137
|
+
});
|
|
182
138
|
}
|
|
183
|
-
|
|
184
|
-
var _default = change_case;
|
|
185
|
-
exports.default = _default;
|
|
139
|
+
export default change_case;
|
package/dist/common/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
1
|
/*
|
|
9
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
10
3
|
|
|
@@ -19,51 +12,43 @@ exports.default = void 0;
|
|
|
19
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
13
|
See the License for the specific language governing permissions and
|
|
21
14
|
limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_switch: 'common/switch',
|
|
62
|
-
_type: 'common/type',
|
|
63
|
-
_uri: 'common/uri',
|
|
64
|
-
_url_query: 'common/url_query',
|
|
65
|
-
_user: 'common/user',
|
|
66
|
-
_uuid: 'common/uuid',
|
|
67
|
-
_yaml: 'common/yaml'
|
|
15
|
+
*/ export default {
|
|
16
|
+
_and: 'common/and',
|
|
17
|
+
_args: 'common/args',
|
|
18
|
+
_array: 'common/array',
|
|
19
|
+
_change_case: 'common/change_case',
|
|
20
|
+
_date: 'common/date',
|
|
21
|
+
_divide: 'common/divide',
|
|
22
|
+
_eq: 'common/eq',
|
|
23
|
+
_function: 'common/function',
|
|
24
|
+
_get: 'common/get',
|
|
25
|
+
_gt: 'common/gt',
|
|
26
|
+
_gte: 'common/gte',
|
|
27
|
+
_if_none: 'common/if_none',
|
|
28
|
+
_if: 'common/if',
|
|
29
|
+
_json: 'common/json',
|
|
30
|
+
_log: 'common/log',
|
|
31
|
+
_lt: 'common/lt',
|
|
32
|
+
_lte: 'common/lte',
|
|
33
|
+
_math: 'common/math',
|
|
34
|
+
_mql: 'common/mql',
|
|
35
|
+
_ne: 'common/ne',
|
|
36
|
+
_not: 'common/not',
|
|
37
|
+
_number: 'common/number',
|
|
38
|
+
_nunjucks: 'common/nunjucks',
|
|
39
|
+
_object: 'common/object',
|
|
40
|
+
_operator: 'common/operator',
|
|
41
|
+
_or: 'common/or',
|
|
42
|
+
_product: 'common/product',
|
|
43
|
+
_random: 'common/random',
|
|
44
|
+
_regex: 'common/regex',
|
|
45
|
+
_string: 'common/string',
|
|
46
|
+
_subtract: 'common/subtract',
|
|
47
|
+
_sum: 'common/sum',
|
|
48
|
+
_switch: 'common/switch',
|
|
49
|
+
_type: 'common/type',
|
|
50
|
+
_uri: 'common/uri',
|
|
51
|
+
_user: 'common/user',
|
|
52
|
+
_uuid: 'common/uuid',
|
|
53
|
+
_yaml: 'common/yaml'
|
|
68
54
|
};
|
|
69
|
-
exports.default = _default;
|
package/dist/common/mql.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _mingo = _interopRequireDefault(require("mingo"));
|
|
9
|
-
|
|
10
|
-
var _helpers = require("@lowdefy/helpers");
|
|
11
|
-
|
|
12
|
-
var _runClass = _interopRequireDefault(require("../runClass"));
|
|
13
|
-
|
|
14
|
-
require("mingo/init/system");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
1
|
/*
|
|
19
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
20
3
|
|
|
@@ -29,96 +12,104 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
29
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
13
|
See the License for the specific language governing permissions and
|
|
31
14
|
limitations under the License.
|
|
32
|
-
*/
|
|
15
|
+
*/ import mingo from 'mingo';
|
|
16
|
+
import { get, type } from '@lowdefy/helpers';
|
|
17
|
+
import runClass from '../runClass.js';
|
|
18
|
+
import 'mingo/init/system';
|
|
33
19
|
function aggregate(data, pipeline) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var agg = new _mingo.default.Aggregator(pipeline);
|
|
47
|
-
return agg.run(data);
|
|
20
|
+
if (data === null) {
|
|
21
|
+
data = [];
|
|
22
|
+
}
|
|
23
|
+
if (!type.isArray(data)) {
|
|
24
|
+
throw new Error('Data must be of type array.');
|
|
25
|
+
}
|
|
26
|
+
if (!type.isArray(pipeline)) {
|
|
27
|
+
throw new Error('Pipeline must be of type array.');
|
|
28
|
+
}
|
|
29
|
+
const agg = new mingo.Aggregator(pipeline);
|
|
30
|
+
return agg.run(data);
|
|
48
31
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (!_helpers.type.isObject(data)) {
|
|
56
|
-
throw new Error('Data must be of type object.');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var agg = new _mingo.default.Aggregator([{
|
|
60
|
-
$project: {
|
|
61
|
-
value: expr
|
|
32
|
+
function expr1(data, expr) {
|
|
33
|
+
if (data === null) {
|
|
34
|
+
data = {
|
|
35
|
+
};
|
|
62
36
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
if (!type.isObject(data)) {
|
|
38
|
+
throw new Error('Data must be of type object.');
|
|
39
|
+
}
|
|
40
|
+
const agg = new mingo.Aggregator([
|
|
41
|
+
{
|
|
42
|
+
$project: {
|
|
43
|
+
value: expr
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
const res = agg.run([
|
|
48
|
+
data
|
|
49
|
+
]);
|
|
50
|
+
return get(res, '0.value', {
|
|
51
|
+
default: null
|
|
52
|
+
});
|
|
68
53
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var query = new _mingo.default.Query(test);
|
|
84
|
-
return query.test(data);
|
|
54
|
+
function test1(data, test) {
|
|
55
|
+
if (data === null) {
|
|
56
|
+
data = {
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (!type.isObject(data)) {
|
|
60
|
+
throw new Error('Data must be of type object.');
|
|
61
|
+
}
|
|
62
|
+
if (!type.isObject(test)) {
|
|
63
|
+
throw new Error('Query test must be of type object.');
|
|
64
|
+
}
|
|
65
|
+
const query = new mingo.Query(test);
|
|
66
|
+
return query.test(data);
|
|
85
67
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
68
|
+
const meta = {
|
|
69
|
+
aggregate: {
|
|
70
|
+
namedArgs: [
|
|
71
|
+
'on',
|
|
72
|
+
'pipeline'
|
|
73
|
+
],
|
|
74
|
+
validTypes: [
|
|
75
|
+
'array',
|
|
76
|
+
'object'
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
expr: {
|
|
80
|
+
namedArgs: [
|
|
81
|
+
'on',
|
|
82
|
+
'expr'
|
|
83
|
+
],
|
|
84
|
+
validTypes: [
|
|
85
|
+
'array',
|
|
86
|
+
'object'
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
test: {
|
|
90
|
+
namedArgs: [
|
|
91
|
+
'on',
|
|
92
|
+
'test'
|
|
93
|
+
],
|
|
94
|
+
validTypes: [
|
|
95
|
+
'array',
|
|
96
|
+
'object'
|
|
97
|
+
]
|
|
98
|
+
}
|
|
100
99
|
};
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
const functions = {
|
|
101
|
+
aggregate,
|
|
102
|
+
expr: expr1,
|
|
103
|
+
test: test1
|
|
105
104
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
location,
|
|
116
|
-
meta,
|
|
117
|
-
methodName,
|
|
118
|
-
operator: '_mql',
|
|
119
|
-
params
|
|
120
|
-
});
|
|
105
|
+
function mql({ params , location , methodName }) {
|
|
106
|
+
return runClass({
|
|
107
|
+
functions,
|
|
108
|
+
location,
|
|
109
|
+
meta,
|
|
110
|
+
methodName,
|
|
111
|
+
operator: '_mql',
|
|
112
|
+
params
|
|
113
|
+
});
|
|
121
114
|
}
|
|
122
|
-
|
|
123
|
-
var _default = mql;
|
|
124
|
-
exports.default = _default;
|
|
115
|
+
export default mql;
|