@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.
Files changed (71) hide show
  1. package/dist/common/change_case.js +114 -160
  2. package/dist/common/index.js +39 -54
  3. package/dist/common/mql.js +93 -102
  4. package/dist/common/uuid.js +48 -59
  5. package/dist/common/yaml.js +56 -63
  6. package/dist/getFromArray.js +22 -44
  7. package/dist/getFromObject.js +25 -70
  8. package/dist/index.js +18 -20
  9. package/dist/node/diff.js +30 -47
  10. package/dist/node/index.js +6 -14
  11. package/dist/nodeParser.js +83 -146
  12. package/dist/runClass.js +57 -82
  13. package/dist/runInstance.js +60 -84
  14. package/dist/web/format.js +15 -37
  15. package/dist/web/index.js +17 -21
  16. package/dist/web/js.js +10 -30
  17. package/dist/webParser.js +99 -157
  18. package/package.json +16 -15
  19. package/dist/common/_index.js +0 -45
  20. package/dist/common/and.js +0 -39
  21. package/dist/common/args.js +0 -46
  22. package/dist/common/array.js +0 -170
  23. package/dist/common/date.js +0 -75
  24. package/dist/common/divide.js +0 -51
  25. package/dist/common/eq.js +0 -43
  26. package/dist/common/event.js +0 -46
  27. package/dist/common/function.js +0 -78
  28. package/dist/common/get.js +0 -61
  29. package/dist/common/global.js +0 -50
  30. package/dist/common/gt.js +0 -43
  31. package/dist/common/gte.js +0 -43
  32. package/dist/common/if.js +0 -41
  33. package/dist/common/if_none.js +0 -47
  34. package/dist/common/input.js +0 -50
  35. package/dist/common/json.js +0 -64
  36. package/dist/common/log.js +0 -33
  37. package/dist/common/lt.js +0 -43
  38. package/dist/common/lte.js +0 -43
  39. package/dist/common/math.js +0 -210
  40. package/dist/common/ne.js +0 -43
  41. package/dist/common/not.js +0 -31
  42. package/dist/common/number.js +0 -125
  43. package/dist/common/nunjucks.js +0 -60
  44. package/dist/common/object.js +0 -118
  45. package/dist/common/operator.js +0 -49
  46. package/dist/common/or.js +0 -39
  47. package/dist/common/product.js +0 -45
  48. package/dist/common/random.js +0 -132
  49. package/dist/common/regex.js +0 -65
  50. package/dist/common/state.js +0 -50
  51. package/dist/common/string.js +0 -188
  52. package/dist/common/subtract.js +0 -47
  53. package/dist/common/sum.js +0 -45
  54. package/dist/common/switch.js +0 -49
  55. package/dist/common/type.js +0 -82
  56. package/dist/common/uri.js +0 -67
  57. package/dist/common/url_query.js +0 -50
  58. package/dist/common/user.js +0 -50
  59. package/dist/getFromOtherContext.js +0 -96
  60. package/dist/node/base64.js +0 -69
  61. package/dist/node/hash.js +0 -100
  62. package/dist/node/secret.js +0 -54
  63. package/dist/web/actions.js +0 -46
  64. package/dist/web/base64.js +0 -67
  65. package/dist/web/event_log.js +0 -50
  66. package/dist/web/list_contexts.js +0 -31
  67. package/dist/web/location.js +0 -74
  68. package/dist/web/media.js +0 -90
  69. package/dist/web/menu.js +0 -43
  70. package/dist/web/request.js +0 -56
  71. package/dist/web/request_details.js +0 -50
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- /*
9
- Copyright 2020-2021 Lowdefy, Inc
10
-
11
- Licensed under the Apache License, Version 2.0 (the "License");
12
- you may not use this file except in compliance with the License.
13
- You may obtain a copy of the License at
14
-
15
- http://www.apache.org/licenses/LICENSE-2.0
16
-
17
- Unless required by applicable law or agreed to in writing, software
18
- distributed under the License is distributed on an "AS IS" BASIS,
19
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- See the License for the specific language governing permissions and
21
- limitations under the License.
22
- */
23
- function _log(_ref) {
24
- var {
25
- params
26
- } = _ref;
27
- // eslint-disable-next-line no-console
28
- console.log(params);
29
- return params;
30
- }
31
-
32
- var _default = _log;
33
- exports.default = _default;
package/dist/common/lt.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _lt(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _lt takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- if (params.length !== 2) {
36
- throw new Error("Operator Error: _lt takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] < params[1];
40
- }
41
-
42
- var _default = _lt;
43
- exports.default = _default;
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _lte(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _lte takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- if (params.length !== 2) {
36
- throw new Error("Operator Error: _lte takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] <= params[1];
40
- }
41
-
42
- var _default = _lte;
43
- exports.default = _default;
@@ -1,210 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _runClass = _interopRequireDefault(require("../runClass"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- /*
13
- Copyright 2020-2021 Lowdefy, Inc
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License");
16
- you may not use this file except in compliance with the License.
17
- You may obtain a copy of the License at
18
-
19
- http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- Unless required by applicable law or agreed to in writing, software
22
- distributed under the License is distributed on an "AS IS" BASIS,
23
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- See the License for the specific language governing permissions and
25
- limitations under the License.
26
- */
27
- var meta = {
28
- abs: {
29
- singleArg: true,
30
- validTypes: ['number']
31
- },
32
- acos: {
33
- singleArg: true,
34
- validTypes: ['number']
35
- },
36
- acosh: {
37
- singleArg: true,
38
- validTypes: ['number']
39
- },
40
- asin: {
41
- singleArg: true,
42
- validTypes: ['number']
43
- },
44
- asinh: {
45
- singleArg: true,
46
- validTypes: ['number']
47
- },
48
- atan: {
49
- singleArg: true,
50
- validTypes: ['number']
51
- },
52
- atan2: {
53
- namedArgs: ['x', 'y'],
54
- validTypes: ['object', 'array']
55
- },
56
- atanh: {
57
- singleArg: true,
58
- validTypes: ['number']
59
- },
60
- cbrt: {
61
- singleArg: true,
62
- validTypes: ['number']
63
- },
64
- ceil: {
65
- singleArg: true,
66
- validTypes: ['number']
67
- },
68
- clz32: {
69
- singleArg: true,
70
- validTypes: ['number']
71
- },
72
- cos: {
73
- singleArg: true,
74
- validTypes: ['number']
75
- },
76
- cosh: {
77
- singleArg: true,
78
- validTypes: ['number']
79
- },
80
- exp: {
81
- singleArg: true,
82
- validTypes: ['number']
83
- },
84
- expm1: {
85
- singleArg: true,
86
- validTypes: ['number']
87
- },
88
- floor: {
89
- singleArg: true,
90
- validTypes: ['number']
91
- },
92
- fround: {
93
- singleArg: true,
94
- validTypes: ['number']
95
- },
96
- hypot: {
97
- spreadArgs: true,
98
- validTypes: ['array']
99
- },
100
- imul: {
101
- namedArgs: ['a', 'b'],
102
- validTypes: ['object', 'array']
103
- },
104
- log: {
105
- singleArg: true,
106
- validTypes: ['number']
107
- },
108
- log10: {
109
- singleArg: true,
110
- validTypes: ['number']
111
- },
112
- log1p: {
113
- singleArg: true,
114
- validTypes: ['number']
115
- },
116
- log2: {
117
- singleArg: true,
118
- validTypes: ['number']
119
- },
120
- max: {
121
- spreadArgs: true,
122
- validTypes: ['array']
123
- },
124
- min: {
125
- spreadArgs: true,
126
- validTypes: ['array']
127
- },
128
- pow: {
129
- namedArgs: ['base', 'exponent'],
130
- validTypes: ['object', 'array']
131
- },
132
- random: {
133
- noArgs: true
134
- },
135
- round: {
136
- singleArg: true,
137
- validTypes: ['number']
138
- },
139
- sign: {
140
- singleArg: true,
141
- validTypes: ['number']
142
- },
143
- sin: {
144
- singleArg: true,
145
- validTypes: ['number']
146
- },
147
- sinh: {
148
- singleArg: true,
149
- validTypes: ['number']
150
- },
151
- sqrt: {
152
- singleArg: true,
153
- validTypes: ['number']
154
- },
155
- tan: {
156
- singleArg: true,
157
- validTypes: ['number']
158
- },
159
- tanh: {
160
- singleArg: true,
161
- validTypes: ['number']
162
- },
163
- trunc: {
164
- singleArg: true,
165
- validTypes: ['number']
166
- },
167
- E: {
168
- property: true
169
- },
170
- LN10: {
171
- property: true
172
- },
173
- LN2: {
174
- property: true
175
- },
176
- LOG10E: {
177
- property: true
178
- },
179
- LOG2E: {
180
- property: true
181
- },
182
- PI: {
183
- property: true
184
- },
185
- SQRT1_2: {
186
- property: true
187
- },
188
- SQRT2: {
189
- property: true
190
- }
191
- };
192
-
193
- function _math(_ref) {
194
- var {
195
- params,
196
- location,
197
- methodName
198
- } = _ref;
199
- return (0, _runClass.default)({
200
- functions: Math,
201
- location,
202
- meta,
203
- methodName,
204
- operator: '_math',
205
- params
206
- });
207
- }
208
-
209
- var _default = _math;
210
- exports.default = _default;
package/dist/common/ne.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- /*
11
- Copyright 2020-2021 Lowdefy, Inc
12
-
13
- Licensed under the Apache License, Version 2.0 (the "License");
14
- you may not use this file except in compliance with the License.
15
- You may obtain a copy of the License at
16
-
17
- http://www.apache.org/licenses/LICENSE-2.0
18
-
19
- Unless required by applicable law or agreed to in writing, software
20
- distributed under the License is distributed on an "AS IS" BASIS,
21
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
- See the License for the specific language governing permissions and
23
- limitations under the License.
24
- */
25
- function _ne(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _ne takes an array type as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- if (params.length !== 2) {
36
- throw new Error("Operator Error: _ne takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] !== params[1];
40
- }
41
-
42
- var _default = _ne;
43
- exports.default = _default;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- /*
9
- Copyright 2020-2021 Lowdefy, Inc
10
-
11
- Licensed under the Apache License, Version 2.0 (the "License");
12
- you may not use this file except in compliance with the License.
13
- You may obtain a copy of the License at
14
-
15
- http://www.apache.org/licenses/LICENSE-2.0
16
-
17
- Unless required by applicable law or agreed to in writing, software
18
- distributed under the License is distributed on an "AS IS" BASIS,
19
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- See the License for the specific language governing permissions and
21
- limitations under the License.
22
- */
23
- function _not(_ref) {
24
- var {
25
- params
26
- } = _ref;
27
- return !params;
28
- }
29
-
30
- var _default = _not;
31
- exports.default = _default;
@@ -1,125 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _runClass = _interopRequireDefault(require("../runClass"));
9
-
10
- var _runInstance = _interopRequireDefault(require("../runInstance"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- /*
15
- Copyright 2020-2021 Lowdefy, Inc
16
-
17
- Licensed under the Apache License, Version 2.0 (the "License");
18
- you may not use this file except in compliance with the License.
19
- You may obtain a copy of the License at
20
-
21
- http://www.apache.org/licenses/LICENSE-2.0
22
-
23
- Unless required by applicable law or agreed to in writing, software
24
- distributed under the License is distributed on an "AS IS" BASIS,
25
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- See the License for the specific language governing permissions and
27
- limitations under the License.
28
- */
29
- var meta = {
30
- EPSILON: {
31
- property: true
32
- },
33
- MAX_SAFE_INTEGER: {
34
- property: true
35
- },
36
- MAX_VALUE: {
37
- property: true
38
- },
39
- MIN_SAFE_INTEGER: {
40
- property: true
41
- },
42
- MIN_VALUE: {
43
- property: true
44
- },
45
- NaN: {
46
- property: true
47
- },
48
- NEGATIVE_INFINITY: {
49
- property: true
50
- },
51
- POSITIVE_INFINITY: {
52
- property: true
53
- },
54
- isFinite: {
55
- singleArg: true
56
- },
57
- isInteger: {
58
- singleArg: true
59
- },
60
- isNaN: {
61
- singleArg: true
62
- },
63
- isSafeInteger: {
64
- singleArg: true
65
- },
66
- parseFloat: {
67
- singleArg: true,
68
- validTypes: ['string']
69
- },
70
- parseInt: {
71
- namedArgs: ['on', 'radix'],
72
- validTypes: ['array', 'object']
73
- },
74
- toExponential: {
75
- namedArgs: ['on', 'fractionDigits'],
76
- validTypes: ['array', 'object']
77
- },
78
- toFixed: {
79
- namedArgs: ['on', 'digits'],
80
- validTypes: ['array', 'object']
81
- },
82
- toLocaleString: {
83
- namedArgs: ['on', 'locales'],
84
- validTypes: ['array', 'object']
85
- },
86
- toPrecision: {
87
- namedArgs: ['on', 'precision'],
88
- validTypes: ['array', 'object']
89
- },
90
- toString: {
91
- namedArgs: ['on', 'radix'],
92
- validTypes: ['array', 'object']
93
- }
94
- };
95
-
96
- function _number(_ref) {
97
- var {
98
- params,
99
- location,
100
- methodName
101
- } = _ref;
102
-
103
- if (['toExponential', 'toFixed', 'toLocaleString', 'toPrecision', 'toString'].includes(methodName)) {
104
- return (0, _runInstance.default)({
105
- location,
106
- meta: meta,
107
- methodName,
108
- operator: '_number',
109
- params,
110
- instanceType: 'number'
111
- });
112
- }
113
-
114
- return (0, _runClass.default)({
115
- functions: Number,
116
- location,
117
- meta: meta,
118
- methodName,
119
- operator: '_number',
120
- params
121
- });
122
- }
123
-
124
- var _default = _number;
125
- exports.default = _default;
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _helpers = require("@lowdefy/helpers");
9
-
10
- var _nunjucks2 = require("@lowdefy/nunjucks");
11
-
12
- /*
13
- Copyright 2020-2021 Lowdefy, Inc
14
-
15
- Licensed under the Apache License, Version 2.0 (the "License");
16
- you may not use this file except in compliance with the License.
17
- You may obtain a copy of the License at
18
-
19
- http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- Unless required by applicable law or agreed to in writing, software
22
- distributed under the License is distributed on an "AS IS" BASIS,
23
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
- See the License for the specific language governing permissions and
25
- limitations under the License.
26
- */
27
- function _nunjucks(_ref) {
28
- var {
29
- location,
30
- params,
31
- state
32
- } = _ref;
33
- var templateString;
34
- var on;
35
-
36
- if (_helpers.type.isObject(params) && _helpers.type.isString(params.template)) {
37
- templateString = params.template;
38
- on = _helpers.type.isObject(params.on) ? params.on : {};
39
- }
40
-
41
- if (_helpers.type.isString(params)) {
42
- templateString = params;
43
- on = state;
44
- }
45
-
46
- if (templateString) {
47
- try {
48
- var template = (0, _nunjucks2.nunjucksFunction)(templateString);
49
- return template(on);
50
- } catch (e) {
51
- // log e to LowdefyError
52
- throw new Error("Operator Error: _nunjucks failed to parse nunjucks template. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
53
- }
54
- }
55
-
56
- return null;
57
- }
58
-
59
- var _default = _nunjucks;
60
- exports.default = _default;
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _runInstance = _interopRequireDefault(require("../runInstance"));
9
-
10
- var _runClass = _interopRequireDefault(require("../runClass"));
11
-
12
- var _helpers = require("@lowdefy/helpers");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- /*
17
- Copyright 2020-2021 Lowdefy, Inc
18
-
19
- Licensed under the Apache License, Version 2.0 (the "License");
20
- you may not use this file except in compliance with the License.
21
- You may obtain a copy of the License at
22
-
23
- http://www.apache.org/licenses/LICENSE-2.0
24
-
25
- Unless required by applicable law or agreed to in writing, software
26
- distributed under the License is distributed on an "AS IS" BASIS,
27
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
- See the License for the specific language governing permissions and
29
- limitations under the License.
30
- */
31
- var prep = args => {
32
- if (_helpers.type.isNone(args[0])) {
33
- args[0] = {};
34
- }
35
-
36
- return args;
37
- };
38
-
39
- var prepDescriptor = args => {
40
- var descriptor = args[2] || {};
41
-
42
- if (_helpers.type.isNone(descriptor.enumerable)) {
43
- descriptor.enumerable = true;
44
- }
45
-
46
- if (_helpers.type.isNone(descriptor.configurable)) {
47
- descriptor.configurable = true;
48
- }
49
-
50
- args[2] = descriptor;
51
-
52
- if (_helpers.type.isNone(args[0])) {
53
- args[0] = {};
54
- }
55
-
56
- return args;
57
- };
58
-
59
- var metaInstance = {
60
- hasOwnProperty: {
61
- namedArgs: ['on', 'prop'],
62
- validTypes: ['array', 'object'],
63
- prep
64
- }
65
- };
66
- var metaClass = {
67
- keys: {
68
- singleArg: true,
69
- validTypes: ['object'],
70
- prep
71
- },
72
- values: {
73
- singleArg: true,
74
- validTypes: ['object'],
75
- prep
76
- },
77
- assign: {
78
- spreadArgs: true,
79
- validTypes: ['array'],
80
- prep
81
- },
82
- defineProperty: {
83
- namedArgs: ['on', 'key', 'descriptor'],
84
- validTypes: ['array', 'object'],
85
- prep: prepDescriptor
86
- }
87
- };
88
-
89
- function _object(_ref) {
90
- var {
91
- params,
92
- location,
93
- methodName
94
- } = _ref;
95
-
96
- if (methodName === 'hasOwnProperty') {
97
- return (0, _runInstance.default)({
98
- location,
99
- meta: metaInstance,
100
- methodName,
101
- operator: '_object',
102
- params,
103
- instanceType: 'object'
104
- });
105
- }
106
-
107
- return (0, _runClass.default)({
108
- functions: Object,
109
- location,
110
- meta: metaClass,
111
- methodName,
112
- operator: '_object',
113
- params
114
- });
115
- }
116
-
117
- var _default = _object;
118
- exports.default = _default;