@lowdefy/operators 3.23.2 → 4.0.0-alpha.6

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/getFromArray.js +22 -44
  2. package/dist/getFromObject.js +25 -70
  3. package/dist/index.js +18 -20
  4. package/dist/nodeParser.js +83 -146
  5. package/dist/runClass.js +57 -82
  6. package/dist/runInstance.js +60 -84
  7. package/dist/webParser.js +94 -157
  8. package/package.json +13 -19
  9. package/dist/common/_index.js +0 -45
  10. package/dist/common/and.js +0 -39
  11. package/dist/common/args.js +0 -46
  12. package/dist/common/array.js +0 -170
  13. package/dist/common/change_case.js +0 -185
  14. package/dist/common/date.js +0 -75
  15. package/dist/common/divide.js +0 -51
  16. package/dist/common/eq.js +0 -43
  17. package/dist/common/event.js +0 -46
  18. package/dist/common/function.js +0 -78
  19. package/dist/common/get.js +0 -61
  20. package/dist/common/global.js +0 -50
  21. package/dist/common/gt.js +0 -43
  22. package/dist/common/gte.js +0 -43
  23. package/dist/common/if.js +0 -41
  24. package/dist/common/if_none.js +0 -47
  25. package/dist/common/index.js +0 -69
  26. package/dist/common/input.js +0 -50
  27. package/dist/common/json.js +0 -64
  28. package/dist/common/log.js +0 -33
  29. package/dist/common/lt.js +0 -43
  30. package/dist/common/lte.js +0 -43
  31. package/dist/common/math.js +0 -210
  32. package/dist/common/mql.js +0 -124
  33. package/dist/common/ne.js +0 -43
  34. package/dist/common/not.js +0 -31
  35. package/dist/common/number.js +0 -125
  36. package/dist/common/nunjucks.js +0 -60
  37. package/dist/common/object.js +0 -118
  38. package/dist/common/operator.js +0 -49
  39. package/dist/common/or.js +0 -39
  40. package/dist/common/product.js +0 -45
  41. package/dist/common/random.js +0 -132
  42. package/dist/common/regex.js +0 -65
  43. package/dist/common/state.js +0 -50
  44. package/dist/common/string.js +0 -188
  45. package/dist/common/subtract.js +0 -47
  46. package/dist/common/sum.js +0 -45
  47. package/dist/common/switch.js +0 -49
  48. package/dist/common/type.js +0 -82
  49. package/dist/common/uri.js +0 -67
  50. package/dist/common/url_query.js +0 -50
  51. package/dist/common/user.js +0 -50
  52. package/dist/common/uuid.js +0 -76
  53. package/dist/common/yaml.js +0 -70
  54. package/dist/getFromOtherContext.js +0 -96
  55. package/dist/node/base64.js +0 -69
  56. package/dist/node/diff.js +0 -66
  57. package/dist/node/hash.js +0 -100
  58. package/dist/node/index.js +0 -29
  59. package/dist/node/secret.js +0 -54
  60. package/dist/web/actions.js +0 -46
  61. package/dist/web/base64.js +0 -67
  62. package/dist/web/event_log.js +0 -50
  63. package/dist/web/format.js +0 -52
  64. package/dist/web/index.js +0 -36
  65. package/dist/web/js.js +0 -45
  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,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,81 +12,66 @@ 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
- var runInstance = _ref => {
26
- var {
27
- location,
28
- meta,
29
- methodName,
30
- operator,
31
- params,
32
- instanceType
33
- } = _ref;
34
-
35
- if (!meta[methodName]) {
36
- throw new Error("Operator Error: ".concat(operator, ".").concat(methodName, " is not supported, use one of the following: ").concat(Object.keys(meta).join(', '), ".\n Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
37
- } // validate params type
38
-
39
-
40
- if (meta[methodName].validTypes && !meta[methodName].validTypes.includes(_helpers.type.typeOf(params))) {
41
- throw new Error("Operator Error: ".concat(operator, ".").concat(methodName, " accepts one of the following types: ").concat(meta[methodName].validTypes.join(', '), ".\n Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
42
- }
43
-
44
- var instance;
45
- var args = [];
46
-
47
- if (meta[methodName].singleArg || meta[methodName].property) {
48
- instance = params;
49
- } else {
50
- if (_helpers.type.isArray(params)) {
51
- // Instance must be zero in list args.
52
- instance = params[0];
53
- args = params.slice(1);
54
- } // Instance must be listed first in named args.
55
-
56
-
57
- if (_helpers.type.isObject(params)) {
58
- instance = params[meta[methodName].namedArgs[0]];
59
- args.push(...meta[methodName].namedArgs.slice(1).map(key => params[key]));
60
-
61
- if (!_helpers.type.isNone(meta[methodName].spreadArgs) && !_helpers.type.isArray(params[meta[methodName].spreadArgs])) {
62
- throw new Error("Operator Error: ".concat(operator, ".").concat(methodName, " takes an array as input argument for ").concat(meta[methodName].spreadArgs, ".\n Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
63
- }
64
-
65
- args.push(...(params[meta[methodName].spreadArgs] || []));
15
+ */ import { type } from '@lowdefy/helpers';
16
+ const runInstance = ({ location , meta , methodName , operator , params , instanceType })=>{
17
+ if (!meta[methodName]) {
18
+ throw new Error(`Operator Error: ${operator}.${methodName} is not supported, use one of the following: ${Object.keys(meta).join(', ')}.
19
+ Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
66
20
  }
67
- }
68
-
69
- if (_helpers.type.isFunction(meta[methodName].prep)) {
70
- [instance, ...args] = meta[methodName].prep([instance, ...args]);
71
- }
72
-
73
- if (_helpers.type.typeOf(instance) !== instanceType) {
74
- throw new Error("Operator Error: ".concat(operator, ".").concat(methodName, " must be evaluated on an ").concat(instanceType, " instance. For named args provide an ").concat(instanceType, " instance to the \"on\" property, for listed args provide and ").concat(instanceType, " instance as the first element in the operator argument array.\n Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
75
- } // Error for invalid method key.
76
-
77
-
78
- if (_helpers.type.isNone(instance[methodName])) {
79
- throw new Error("Operator Error: ".concat(operator, " must be evaluated using one of the following: ").concat(Object.keys(meta).join(', '), ".\n Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
80
- } // for property
81
-
82
-
83
- if (meta[methodName].property) {
84
- return instance[methodName];
85
- }
86
-
87
- try {
88
- var result = instance[methodName](...args);
89
-
90
- if (meta[methodName].returnInstance) {
91
- return instance;
21
+ // validate params type
22
+ if (meta[methodName].validTypes && !meta[methodName].validTypes.includes(type.typeOf(params))) {
23
+ throw new Error(`Operator Error: ${operator}.${methodName} accepts one of the following types: ${meta[methodName].validTypes.join(', ')}.
24
+ Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
25
+ }
26
+ let instance;
27
+ let args = [];
28
+ if (meta[methodName].singleArg || meta[methodName].property) {
29
+ instance = params;
30
+ } else {
31
+ if (type.isArray(params)) {
32
+ // Instance must be zero in list args.
33
+ instance = params[0];
34
+ args = params.slice(1);
35
+ }
36
+ // Instance must be listed first in named args.
37
+ if (type.isObject(params)) {
38
+ instance = params[meta[methodName].namedArgs[0]];
39
+ args.push(...meta[methodName].namedArgs.slice(1).map((key)=>params[key]
40
+ ));
41
+ if (!type.isNone(meta[methodName].spreadArgs) && !type.isArray(params[meta[methodName].spreadArgs])) {
42
+ throw new Error(`Operator Error: ${operator}.${methodName} takes an array as input argument for ${meta[methodName].spreadArgs}.
43
+ Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
44
+ }
45
+ args.push(...params[meta[methodName].spreadArgs] || []);
46
+ }
47
+ }
48
+ if (type.isFunction(meta[methodName].prep)) {
49
+ [instance, ...args] = meta[methodName].prep([
50
+ instance,
51
+ ...args
52
+ ]);
53
+ }
54
+ if (type.typeOf(instance) !== instanceType) {
55
+ throw new Error(`Operator Error: ${operator}.${methodName} must be evaluated on an ${instanceType} instance. For named args provide an ${instanceType} instance to the "on" property, for listed args provide and ${instanceType} instance as the first element in the operator argument array.
56
+ Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
57
+ }
58
+ // Error for invalid method key.
59
+ if (type.isNone(instance[methodName])) {
60
+ throw new Error(`Operator Error: ${operator} must be evaluated using one of the following: ${Object.keys(meta).join(', ')}.
61
+ Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
62
+ }
63
+ // for property
64
+ if (meta[methodName].property) {
65
+ return instance[methodName];
66
+ }
67
+ try {
68
+ const result = instance[methodName](...args);
69
+ if (meta[methodName].returnInstance) {
70
+ return instance;
71
+ }
72
+ return result;
73
+ } catch (e) {
74
+ throw new Error(`Operator Error: ${operator}.${methodName} - ${e.message} Received: {"${operator}.${methodName}":${JSON.stringify(params)}} at ${location}.`);
92
75
  }
93
-
94
- return result;
95
- } catch (e) {
96
- throw new Error("Operator Error: ".concat(operator, ".").concat(methodName, " - ").concat(e.message, " Received: {\"").concat(operator, ".").concat(methodName, "\":").concat(JSON.stringify(params), "} at ").concat(location, "."));
97
- }
98
76
  };
99
-
100
- var _default = runInstance;
101
- exports.default = _default;
77
+ export default runInstance;
package/dist/webParser.js CHANGED
@@ -1,161 +1,98 @@
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 _common = _interopRequireDefault(require("./common"));
11
-
12
- var _web = _interopRequireDefault(require("./web"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
17
-
18
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
19
-
20
- 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; }
21
-
22
- 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; }
23
-
24
- 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; }
25
-
26
- class WebParser {
27
- constructor(_ref) {
28
- var {
29
- context,
30
- contexts
31
- } = _ref;
32
- this.context = context;
33
- this.contexts = contexts;
34
- this.init = this.init.bind(this);
35
- this.parse = this.parse.bind(this);
36
- this.operators = _objectSpread(_objectSpread({}, _common.default), _web.default);
37
- this.operations = {};
38
- }
39
-
40
- init() {
41
- var _this = this;
42
-
43
- return _asyncToGenerator(function* () {
44
- if (!_helpers.type.isObject(_this.context.lowdefy)) {
45
- throw new Error('context.lowdefy must be an object.');
46
- }
47
-
48
- if (!_helpers.type.isArray(_this.context.operators)) {
49
- throw new Error('context.operators must be an array.');
50
- }
51
-
52
- yield Promise.all(_this.context.operators.map( /*#__PURE__*/function () {
53
- var _ref2 = _asyncToGenerator(function* (operator) {
54
- if (_this.operators[operator]) {
55
- var fn = yield import("./".concat(_this.operators[operator], ".js"));
56
- _this.operations[operator] = fn.default;
57
-
58
- if (_this.operations[operator].init) {
59
- yield _this.operations[operator].init();
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 { applyArrayIndices, serializer, type } from '@lowdefy/helpers';
16
+ let WebParser = class WebParser {
17
+ async init() {
18
+ if (!type.isObject(this.context._internal.lowdefy)) {
19
+ throw new Error('context._internal.lowdefy must be an object.');
20
+ }
21
+ await Promise.all(Object.values(this.operators).map(async (operator)=>{
22
+ if (operator.init) {
23
+ await operator.init();
60
24
  }
61
- }
62
- });
63
-
64
- return function (_x) {
65
- return _ref2.apply(this, arguments);
66
- };
67
- }()));
68
- })();
69
- }
70
-
71
- parse(_ref3) {
72
- var {
73
- actions,
74
- args,
75
- arrayIndices,
76
- event,
77
- input,
78
- location
79
- } = _ref3;
80
-
81
- if (_helpers.type.isUndefined(input)) {
82
- return {
83
- output: input,
84
- errors: []
85
- };
86
- }
87
-
88
- if (event && !_helpers.type.isObject(event)) {
89
- throw new Error('Operator parser event must be a object.');
25
+ }));
90
26
  }
91
-
92
- if (args && !_helpers.type.isArray(args)) {
93
- throw new Error('Operator parser args must be an array.');
27
+ parse({ actions , args , arrayIndices , event , input , location }) {
28
+ const operators = this.operators;
29
+ const context = this.context;
30
+ if (type.isUndefined(input)) {
31
+ return {
32
+ output: input,
33
+ errors: []
34
+ };
35
+ }
36
+ if (event && !type.isObject(event)) {
37
+ throw new Error('Operator parser event must be a object.');
38
+ }
39
+ if (args && !type.isArray(args)) {
40
+ throw new Error('Operator parser args must be an array.');
41
+ }
42
+ if (!type.isString(location)) {
43
+ throw new Error('Operator parser location must be a string.');
44
+ }
45
+ const errors = [];
46
+ const { inputs , lowdefyGlobal , menus , urlQuery , user } = context._internal.lowdefy;
47
+ const reviver = (_, value)=>{
48
+ if (type.isObject(value) && Object.keys(value).length === 1) {
49
+ const key = Object.keys(value)[0];
50
+ const [op, methodName] = key.split('.');
51
+ try {
52
+ if (!type.isUndefined(operators[op])) {
53
+ const res = operators[op]({
54
+ eventLog: context.eventLog,
55
+ actions,
56
+ args,
57
+ arrayIndices,
58
+ context: context,
59
+ env: 'web',
60
+ event,
61
+ input: inputs ? inputs[context.id] : {},
62
+ location: applyArrayIndices(arrayIndices, location),
63
+ lowdefyGlobal: lowdefyGlobal || {},
64
+ menus: menus || {},
65
+ methodName,
66
+ operators: operators,
67
+ params: value[key],
68
+ requests: context.requests,
69
+ state: context.state,
70
+ urlQuery: urlQuery || {},
71
+ user: user || {},
72
+ parser: this
73
+ });
74
+ return res;
75
+ }
76
+ } catch (e) {
77
+ errors.push(e);
78
+ console.error(e);
79
+ return null;
80
+ }
81
+ }
82
+ return value;
83
+ };
84
+ return {
85
+ output: serializer.copy(input, {
86
+ reviver
87
+ }),
88
+ errors
89
+ };
94
90
  }
95
-
96
- if (location && !_helpers.type.isString(location)) {
97
- throw new Error('Operator parser location must be a string.');
91
+ constructor({ context , operators }){
92
+ this.context = context;
93
+ this.init = this.init.bind(this);
94
+ this.parse = this.parse.bind(this);
95
+ this.operators = operators;
98
96
  }
99
-
100
- var errors = [];
101
- var {
102
- inputs,
103
- lowdefyGlobal,
104
- menus,
105
- urlQuery,
106
- user
107
- } = this.context.lowdefy;
108
-
109
- var reviver = (_, value) => {
110
- if (_helpers.type.isObject(value) && Object.keys(value).length === 1) {
111
- var key = Object.keys(value)[0];
112
- var [op, methodName] = key.split('.');
113
-
114
- try {
115
- if (!_helpers.type.isUndefined(this.operations[op])) {
116
- var res = this.operations[op]({
117
- eventLog: this.context.eventLog,
118
- actions,
119
- args,
120
- arrayIndices,
121
- context: this.context,
122
- contexts: this.contexts,
123
- env: 'web',
124
- event,
125
- input: inputs ? inputs[this.context.id] : {},
126
- location: location ? (0, _helpers.applyArrayIndices)(arrayIndices, location) : null,
127
- lowdefyGlobal: lowdefyGlobal || {},
128
- menus: menus || {},
129
- methodName,
130
- operations: this.operations,
131
- params: value[key],
132
- requests: this.context.requests,
133
- state: this.context.state,
134
- urlQuery: urlQuery || {},
135
- user: user || {},
136
- parser: this
137
- });
138
- return res;
139
- }
140
- } catch (e) {
141
- errors.push(e);
142
- console.error(e);
143
- return null;
144
- }
145
- }
146
-
147
- return value;
148
- };
149
-
150
- return {
151
- output: _helpers.serializer.copy(input, {
152
- reviver
153
- }),
154
- errors
155
- };
156
- }
157
-
158
- }
159
-
160
- var _default = WebParser;
161
- exports.default = _default;
97
+ };
98
+ export default WebParser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/operators",
3
- "version": "3.23.2",
3
+ "version": "4.0.0-alpha.6",
4
4
  "licence": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -24,36 +24,30 @@
24
24
  "type": "git",
25
25
  "url": "https://github.com/lowdefy/lowdefy.git"
26
26
  },
27
- "main": "dist/index.js",
27
+ "type": "module",
28
+ "exports": "./dist/index.js",
28
29
  "files": [
29
30
  "dist/*"
30
31
  ],
31
32
  "scripts": {
32
- "build": "babel src --out-dir dist",
33
+ "build": "yarn clean && yarn swc",
33
34
  "clean": "rm -rf dist",
35
+ "prepare": "yarn build",
36
+ "swc": "swc src --out-dir dist --config-file ../../.swcrc",
34
37
  "test": "jest --coverage --testTimeout=10000",
35
- "test:watch": "jest --coverage --watch",
36
- "prepare": "yarn build"
38
+ "test:watch": "jest --coverage --watch"
37
39
  },
38
40
  "dependencies": {
39
- "@lowdefy/format": "3.23.2",
40
- "@lowdefy/helpers": "3.23.2",
41
- "@lowdefy/nunjucks": "3.23.2",
42
- "change-case": "4.1.2",
43
- "deep-diff": "1.0.2",
44
- "js-yaml": "4.1.0",
45
- "mingo": "4.1.2",
46
- "uuid": "8.3.2"
41
+ "@lowdefy/helpers": "4.0.0-alpha.6"
47
42
  },
48
43
  "devDependencies": {
49
- "@babel/cli": "7.14.3",
50
- "@babel/core": "7.14.3",
51
- "@babel/preset-env": "7.14.4",
52
- "babel-jest": "26.6.3",
53
- "jest": "26.6.3"
44
+ "@swc/cli": "0.1.55",
45
+ "@swc/core": "1.2.130",
46
+ "@swc/jest": "0.2.17",
47
+ "jest": "27.3.1"
54
48
  },
55
49
  "publishConfig": {
56
50
  "access": "public"
57
51
  },
58
- "gitHead": "4c30d3cdfa99ae4e90fc891825938c28bad45760"
52
+ "gitHead": "2530e31af795b6a3c75ac8f72c8dbe0ab5d1251b"
59
53
  }
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _getFromObject = _interopRequireDefault(require("../getFromObject"));
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
- function _index(_ref) {
28
- var {
29
- arrayIndices,
30
- env,
31
- location,
32
- params
33
- } = _ref;
34
- return (0, _getFromObject.default)({
35
- arrayIndices,
36
- env,
37
- location,
38
- object: arrayIndices,
39
- operator: '_index',
40
- params
41
- });
42
- }
43
-
44
- var _default = _index;
45
- exports.default = _default;
@@ -1,39 +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 _and(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _and takes an array type. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
33
- }
34
-
35
- return !!params.reduce((acc, el) => acc && el, true);
36
- }
37
-
38
- var _default = _and;
39
- exports.default = _default;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _getFromObject = _interopRequireDefault(require("../getFromObject"));
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
- function _args(_ref) {
28
- var {
29
- args,
30
- arrayIndices,
31
- env,
32
- location,
33
- params
34
- } = _ref;
35
- return (0, _getFromObject.default)({
36
- arrayIndices,
37
- env,
38
- location,
39
- object: args,
40
- operator: '_args',
41
- params
42
- });
43
- }
44
-
45
- var _default = _args;
46
- exports.default = _default;