@lowdefy/operators 3.22.0 → 4.0.0-alpha.1

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 (75) hide show
  1. package/dist/common/and.js +8 -24
  2. package/dist/common/args.js +10 -31
  3. package/dist/common/array.js +244 -153
  4. package/dist/common/change_case.js +114 -160
  5. package/dist/common/date.js +33 -54
  6. package/dist/common/divide.js +16 -36
  7. package/dist/common/eq.js +10 -28
  8. package/dist/common/function.js +27 -59
  9. package/dist/common/get.js +21 -46
  10. package/dist/common/gt.js +10 -28
  11. package/dist/common/gte.js +10 -28
  12. package/dist/common/if.js +9 -26
  13. package/dist/common/if_none.js +13 -32
  14. package/dist/common/index.js +39 -53
  15. package/dist/common/json.js +53 -57
  16. package/dist/common/log.js +5 -18
  17. package/dist/common/lt.js +10 -28
  18. package/dist/common/lte.js +10 -28
  19. package/dist/common/math.js +255 -194
  20. package/dist/common/mql.js +93 -102
  21. package/dist/common/ne.js +10 -28
  22. package/dist/common/not.js +3 -16
  23. package/dist/common/number.js +130 -108
  24. package/dist/common/nunjucks.js +24 -44
  25. package/dist/common/object.js +89 -98
  26. package/dist/common/operator.js +33 -44
  27. package/dist/common/or.js +8 -24
  28. package/dist/common/product.js +11 -29
  29. package/dist/common/random.js +74 -109
  30. package/dist/common/regex.js +26 -49
  31. package/dist/common/string.js +270 -171
  32. package/dist/common/subtract.js +13 -32
  33. package/dist/common/sum.js +11 -29
  34. package/dist/common/switch.js +30 -0
  35. package/dist/common/type.js +36 -67
  36. package/dist/common/uri.js +29 -46
  37. package/dist/common/user.js +10 -35
  38. package/dist/common/uuid.js +48 -59
  39. package/dist/common/yaml.js +56 -63
  40. package/dist/getFromArray.js +22 -44
  41. package/dist/getFromObject.js +25 -70
  42. package/dist/index.js +14 -20
  43. package/dist/node/base64.js +31 -48
  44. package/dist/node/diff.js +30 -47
  45. package/dist/node/hash.js +55 -71
  46. package/dist/node/index.js +6 -14
  47. package/dist/{web/list_contexts.js → node/payload.js} +9 -16
  48. package/dist/node/secret.js +32 -53
  49. package/dist/nodeParser.js +95 -146
  50. package/dist/runClass.js +57 -82
  51. package/dist/runInstance.js +60 -84
  52. package/dist/web/_index.js +25 -0
  53. package/dist/web/actions.js +10 -31
  54. package/dist/web/base64.js +29 -46
  55. package/dist/{common/_index.js → web/event.js} +10 -30
  56. package/dist/web/event_log.js +10 -35
  57. package/dist/web/format.js +15 -37
  58. package/dist/web/global.js +25 -0
  59. package/dist/web/index.js +17 -21
  60. package/dist/{common/event.js → web/input.js} +10 -31
  61. package/dist/web/js.js +10 -30
  62. package/dist/web/location.js +44 -59
  63. package/dist/web/media.js +46 -75
  64. package/dist/web/menu.js +10 -28
  65. package/dist/web/request.js +19 -40
  66. package/dist/web/request_details.js +10 -35
  67. package/dist/web/state.js +25 -0
  68. package/dist/web/url_query.js +25 -0
  69. package/dist/webParser.js +115 -157
  70. package/package.json +16 -15
  71. package/dist/common/global.js +0 -50
  72. package/dist/common/input.js +0 -50
  73. package/dist/common/state.js +0 -50
  74. package/dist/common/url_query.js +0 -50
  75. package/dist/getFromOtherContext.js +0 -96
package/dist/common/gt.js CHANGED
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,23 +12,14 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
25
- function _gt(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _gt 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: _gt takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] > params[1];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _gt({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _gt takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _gt takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ return params[0] > params[1];
40
24
  }
41
-
42
- var _default = _gt;
43
- exports.default = _default;
25
+ export default _gt;
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,23 +12,14 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
25
- function _gte(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _gte 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: _gte takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- return params[0] >= params[1];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _gte({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _gte takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _gte takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ return params[0] >= params[1];
40
24
  }
41
-
42
- var _default = _gte;
43
- exports.default = _default;
25
+ export default _gte;
package/dist/common/if.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,23 +12,13 @@ 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
- function _if(_ref) {
24
- var {
25
- location,
26
- params
27
- } = _ref;
28
-
29
- if (params.test === true) {
30
- return params.then;
31
- }
32
-
33
- if (params.test === false) {
34
- return params.else;
35
- }
36
-
37
- throw new Error("Operator Error: _if takes a boolean type for parameter test. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
15
+ */ function _if({ location , params }) {
16
+ if (params.test === true) {
17
+ return params.then;
18
+ }
19
+ if (params.test === false) {
20
+ return params.else;
21
+ }
22
+ throw new Error(`Operator Error: _if takes a boolean type for parameter test. Received: ${JSON.stringify(params)} at ${location}.`);
38
23
  }
39
-
40
- var _default = _if;
41
- exports.default = _default;
24
+ export default _if;
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,27 +12,17 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  limitations under the License.
24
- */
25
- function _if_none(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _if_none 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: _if_none takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- if (_helpers.type.isNone(params[0])) {
40
- return params[1];
41
- }
42
-
43
- return params[0];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _if_none({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _if_none takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _if_none takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ if (type.isNone(params[0])) {
24
+ return params[1];
25
+ }
26
+ return params[0];
44
27
  }
45
-
46
- var _default = _if_none;
47
- exports.default = _default;
28
+ export default _if_none;
@@ -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,50 +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
- var _default = {
24
- _and: 'common/and',
25
- _args: 'common/args',
26
- _array: 'common/array',
27
- _change_case: 'common/change_case',
28
- _date: 'common/date',
29
- _divide: 'common/divide',
30
- _eq: 'common/eq',
31
- _event: 'common/event',
32
- _function: 'common/function',
33
- _get: 'common/get',
34
- _global: 'common/global',
35
- _gt: 'common/gt',
36
- _gte: 'common/gte',
37
- _if_none: 'common/if_none',
38
- _if: 'common/if',
39
- _index: 'common/_index',
40
- _input: 'common/input',
41
- _json: 'common/json',
42
- _log: 'common/log',
43
- _lt: 'common/lt',
44
- _lte: 'common/lte',
45
- _math: 'common/math',
46
- _mql: 'common/mql',
47
- _ne: 'common/ne',
48
- _not: 'common/not',
49
- _number: 'common/number',
50
- _nunjucks: 'common/nunjucks',
51
- _object: 'common/object',
52
- _operator: 'common/operator',
53
- _or: 'common/or',
54
- _product: 'common/product',
55
- _random: 'common/random',
56
- _regex: 'common/regex',
57
- _state: 'common/state',
58
- _string: 'common/string',
59
- _subtract: 'common/subtract',
60
- _sum: 'common/sum',
61
- _type: 'common/type',
62
- _uri: 'common/uri',
63
- _url_query: 'common/url_query',
64
- _user: 'common/user',
65
- _uuid: 'common/uuid',
66
- _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'
67
54
  };
68
- exports.default = _default;
@@ -1,64 +1,60 @@
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 _runClass = _interopRequireDefault(require("../runClass"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
1
+ /*
2
+ Copyright 2020-2021 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { serializer } from '@lowdefy/helpers';
16
+ import runClass from '../runClass.js';
20
17
  function parse(input) {
21
- if (input === 'undefined') return undefined;
22
- return _helpers.serializer.deserializeFromString(input);
18
+ if (input === 'undefined') return undefined;
19
+ return serializer.deserializeFromString(input);
23
20
  }
24
-
25
21
  function stringify(input, options) {
26
- return _helpers.serializer.serializeToString(input, _objectSpread({
27
- space: 2,
28
- isoStringDates: true
29
- }, options));
22
+ return serializer.serializeToString(input, {
23
+ space: 2,
24
+ isoStringDates: true,
25
+ ...options
26
+ });
30
27
  }
31
-
32
- var functions = {
33
- parse,
34
- stringify
28
+ const functions = {
29
+ parse,
30
+ stringify
35
31
  };
36
- var meta = {
37
- stringify: {
38
- namedArgs: ['on', 'options'],
39
- validTypes: ['object', 'array']
40
- },
41
- parse: {
42
- singleArg: true,
43
- validTypes: ['string']
44
- }
32
+ const meta = {
33
+ stringify: {
34
+ namedArgs: [
35
+ 'on',
36
+ 'options'
37
+ ],
38
+ validTypes: [
39
+ 'object',
40
+ 'array'
41
+ ]
42
+ },
43
+ parse: {
44
+ singleArg: true,
45
+ validTypes: [
46
+ 'string'
47
+ ]
48
+ }
45
49
  };
46
-
47
- function _json(_ref) {
48
- var {
49
- params,
50
- location,
51
- methodName
52
- } = _ref;
53
- return (0, _runClass.default)({
54
- functions,
55
- location,
56
- meta,
57
- methodName,
58
- operator: '_json',
59
- params
60
- });
50
+ function _json({ params , location , methodName }) {
51
+ return runClass({
52
+ functions,
53
+ location,
54
+ meta,
55
+ methodName,
56
+ operator: '_json',
57
+ params
58
+ });
61
59
  }
62
-
63
- var _default = _json;
64
- exports.default = _default;
60
+ export default _json;
@@ -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,15 +12,9 @@ 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
- function _log(_ref) {
24
- var {
25
- params
26
- } = _ref;
27
- // eslint-disable-next-line no-console
28
- console.log(params);
29
- return params;
15
+ */ function _log({ params }) {
16
+ // eslint-disable-next-line no-console
17
+ console.log(params);
18
+ return params;
30
19
  }
31
-
32
- var _default = _log;
33
- exports.default = _default;
20
+ export default _log;
package/dist/common/lt.js CHANGED
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,23 +12,14 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  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];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _lt({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _lt takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _lt takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ return params[0] < params[1];
40
24
  }
41
-
42
- var _default = _lt;
43
- exports.default = _default;
25
+ export default _lt;
@@ -1,12 +1,3 @@
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
1
  /*
11
2
  Copyright 2020-2021 Lowdefy, Inc
12
3
 
@@ -21,23 +12,14 @@ var _helpers = require("@lowdefy/helpers");
21
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
13
  See the License for the specific language governing permissions and
23
14
  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];
15
+ */ import { type } from '@lowdefy/helpers';
16
+ function _lte({ params , location }) {
17
+ if (!type.isArray(params)) {
18
+ throw new Error(`Operator Error: _lte takes an array type as input. Received: ${JSON.stringify(params)} at ${location}.`);
19
+ }
20
+ if (params.length !== 2) {
21
+ throw new Error(`Operator Error: _lte takes an array of length 2 as input. Received: ${JSON.stringify(params)} at ${location}.`);
22
+ }
23
+ return params[0] <= params[1];
40
24
  }
41
-
42
- var _default = _lte;
43
- exports.default = _default;
25
+ export default _lte;