@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,67 +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
- function decode(input) {
28
- return atob(input);
29
- }
30
-
31
- function encode(input) {
32
- return btoa(input);
33
- }
34
-
35
- var functions = {
36
- encode,
37
- decode
38
- };
39
- var meta = {
40
- encode: {
41
- singleArg: true,
42
- validTypes: ['string']
43
- },
44
- decode: {
45
- singleArg: true,
46
- validTypes: ['string']
47
- }
48
- };
49
-
50
- function _base64(_ref) {
51
- var {
52
- params,
53
- location,
54
- methodName
55
- } = _ref;
56
- return (0, _runClass.default)({
57
- functions,
58
- location,
59
- meta,
60
- methodName,
61
- operator: '_base64',
62
- params
63
- });
64
- }
65
-
66
- var _default = _base64;
67
- exports.default = _default;
@@ -1,50 +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 _event_log(_ref) {
28
- var {
29
- params,
30
- eventLog,
31
- context,
32
- contexts,
33
- arrayIndices,
34
- location,
35
- env
36
- } = _ref;
37
- return (0, _getFromObject.default)({
38
- arrayIndices,
39
- context,
40
- contexts,
41
- env,
42
- location,
43
- object: eventLog,
44
- operator: '_event_log',
45
- params
46
- });
47
- }
48
-
49
- var _default = _event_log;
50
- 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 _list_contexts(_ref) {
24
- var {
25
- contexts
26
- } = _ref;
27
- return Object.keys(contexts).sort();
28
- }
29
-
30
- var _default = _list_contexts;
31
- exports.default = _default;
@@ -1,74 +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
- var validProperties = ['basePath', 'href', 'origin', 'protocol', 'homePageId', 'host', 'hostname', 'port', 'pageId', 'pathname', 'search', 'hash'];
28
-
29
- function _location(_ref) {
30
- var {
31
- arrayIndices,
32
- context,
33
- contexts,
34
- env,
35
- location,
36
- params
37
- } = _ref;
38
-
39
- if (!window || !window.location) {
40
- throw new Error("Operator Error: Browser window.location not available for _location. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
41
- }
42
-
43
- if (!validProperties.includes(params)) {
44
- throw new Error("Operator Error: _location only returns values for ".concat(validProperties.join(', '), ". Received: ").concat(JSON.stringify(params), " at ").concat(location, "."));
45
- }
46
-
47
- var windowLocation = {
48
- basePath: context.lowdefy.basePath,
49
- href: window.location.href,
50
- origin: window.location.origin,
51
- protocol: window.location.protocol,
52
- homePageId: context.lowdefy.homePageId,
53
- host: window.location.host,
54
- hostname: window.location.hostname,
55
- port: window.location.port,
56
- pageId: context.lowdefy.pageId,
57
- pathname: window.location.pathname,
58
- search: window.location.search,
59
- hash: window.location.hash
60
- };
61
- return (0, _getFromObject.default)({
62
- arrayIndices,
63
- context,
64
- contexts,
65
- env,
66
- location,
67
- object: windowLocation,
68
- operator: '_location',
69
- params
70
- });
71
- }
72
-
73
- var _default = _location;
74
- exports.default = _default;
package/dist/web/media.js DELETED
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.breakpoints = 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
- var breakpoints = [576, 768, 992, 1200, 1600];
28
- exports.breakpoints = breakpoints;
29
-
30
- function _media(_ref) {
31
- var {
32
- arrayIndices,
33
- context,
34
- contexts,
35
- env,
36
- location,
37
- params
38
- } = _ref;
39
-
40
- if (!window || !window.innerWidth) {
41
- throw new Error("Operator Error: device window width not available for _media. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
42
- }
43
-
44
- var size;
45
-
46
- switch (true) {
47
- case window.innerWidth < breakpoints[0]:
48
- size = 'xs';
49
- break;
50
-
51
- case window.innerWidth < breakpoints[1]:
52
- size = 'sm';
53
- break;
54
-
55
- case window.innerWidth < breakpoints[2]:
56
- size = 'md';
57
- break;
58
-
59
- case window.innerWidth < breakpoints[3]:
60
- size = 'lg';
61
- break;
62
-
63
- case window.innerWidth < breakpoints[4]:
64
- size = 'xl';
65
- break;
66
-
67
- default:
68
- size = 'xxl';
69
- break;
70
- }
71
-
72
- var media = {
73
- size,
74
- width: window.innerWidth,
75
- height: window.innerHeight
76
- };
77
- return (0, _getFromObject.default)({
78
- arrayIndices,
79
- context,
80
- contexts,
81
- env,
82
- location,
83
- object: media,
84
- operator: '_media',
85
- params
86
- });
87
- }
88
-
89
- var _default = _media;
90
- exports.default = _default;
package/dist/web/menu.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 _getFromArray = _interopRequireDefault(require("../getFromArray"));
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 _menu(_ref) {
28
- var {
29
- params,
30
- menus,
31
- location
32
- } = _ref;
33
- return (0, _getFromArray.default)({
34
- params,
35
- array: menus,
36
- key: 'menuId',
37
- operator: '_menu',
38
- location
39
- });
40
- }
41
-
42
- var _default = _menu;
43
- exports.default = _default;
@@ -1,56 +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 _request(_ref) {
26
- var {
27
- arrayIndices,
28
- params,
29
- requests,
30
- location
31
- } = _ref;
32
-
33
- if (!_helpers.type.isString(params)) {
34
- throw new Error("Operator Error: _request accepts a string value. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
35
- }
36
-
37
- var splitKey = params.split('.');
38
- var [requestId, ...keyParts] = splitKey;
39
-
40
- if (requestId in requests && !requests[requestId].loading) {
41
- if (splitKey.length === 1) {
42
- return _helpers.serializer.copy(requests[requestId].response);
43
- }
44
-
45
- var key = keyParts.reduce((acc, value) => acc === '' ? value : acc.concat('.', value), '');
46
- return (0, _helpers.get)(requests[requestId].response, (0, _helpers.applyArrayIndices)(arrayIndices, key), {
47
- copy: true,
48
- default: null
49
- });
50
- }
51
-
52
- return null;
53
- }
54
-
55
- var _default = _request;
56
- exports.default = _default;
@@ -1,50 +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 _request_details(_ref) {
28
- var {
29
- params,
30
- requests,
31
- context,
32
- contexts,
33
- arrayIndices,
34
- location,
35
- env
36
- } = _ref;
37
- return (0, _getFromObject.default)({
38
- arrayIndices,
39
- context,
40
- contexts,
41
- env,
42
- location,
43
- object: requests,
44
- operator: '_request_details',
45
- params
46
- });
47
- }
48
-
49
- var _default = _request_details;
50
- exports.default = _default;