@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,75 +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 _helpers = require("@lowdefy/helpers");
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
- function date(input) {
30
- var result = new Date(input);
31
-
32
- if (!_helpers.type.isDate(result)) {
33
- throw new Error("".concat(input, " could not resolve as a valid javascript date."));
34
- }
35
-
36
- return result;
37
- }
38
-
39
- function now() {
40
- return new Date();
41
- }
42
-
43
- var functions = {
44
- __default: date,
45
- now
46
- };
47
- var meta = {
48
- __default: {
49
- singleArg: true,
50
- validTypes: ['number', 'string']
51
- },
52
- now: {
53
- noArgs: true
54
- }
55
- };
56
-
57
- function _date(_ref) {
58
- var {
59
- params,
60
- location,
61
- methodName
62
- } = _ref;
63
- return (0, _runClass.default)({
64
- functions,
65
- location,
66
- meta,
67
- methodName: methodName,
68
- operator: '_date',
69
- params,
70
- defaultFunction: '__default'
71
- });
72
- }
73
-
74
- var _default = _date;
75
- exports.default = _default;
@@ -1,51 +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 _divide(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _divide 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: _divide takes an array of length 2 as input. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
37
- }
38
-
39
- if (!_helpers.type.isNumber(params[0]) || !_helpers.type.isNumber(params[1])) {
40
- throw new Error("Operator Error: _divide takes an array of 2 numbers. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
41
- }
42
-
43
- if (params[1] === 0) {
44
- throw new Error("Operator Error: _divide by zero not allowed. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
45
- }
46
-
47
- return params[0] / params[1];
48
- }
49
-
50
- var _default = _divide;
51
- exports.default = _default;
package/dist/common/eq.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 _eq(_ref) {
26
- var {
27
- params,
28
- location
29
- } = _ref;
30
-
31
- if (!_helpers.type.isArray(params)) {
32
- throw new Error("Operator Error: _eq 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: _eq 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 = _eq;
43
- 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 _event(_ref) {
28
- var {
29
- arrayIndices,
30
- env,
31
- event,
32
- location,
33
- params
34
- } = _ref;
35
- return (0, _getFromObject.default)({
36
- arrayIndices,
37
- env,
38
- location,
39
- object: event,
40
- operator: '_event',
41
- params
42
- });
43
- }
44
-
45
- var _default = _event;
46
- exports.default = _default;
@@ -1,78 +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 removeUnderscore(_, value) {
26
- if (_helpers.type.isObject(value) && Object.keys(value).length === 1) {
27
- var key = Object.keys(value)[0];
28
-
29
- if (key.startsWith('__')) {
30
- var newKey = key.substring(1);
31
- return {
32
- [newKey]: value[key]
33
- };
34
- }
35
- }
36
-
37
- return value;
38
- }
39
-
40
- function _function(_ref) {
41
- var {
42
- arrayIndices,
43
- event,
44
- location,
45
- params,
46
- parser
47
- } = _ref;
48
-
49
- var preparedParams = _helpers.serializer.copy(params, {
50
- reviver: removeUnderscore
51
- });
52
-
53
- return function () {
54
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- var {
59
- output,
60
- errors
61
- } = parser.parse({
62
- arrayIndices,
63
- args,
64
- event,
65
- input: preparedParams,
66
- location
67
- });
68
-
69
- if (errors.length > 0) {
70
- throw new Error(errors[0]);
71
- }
72
-
73
- return output;
74
- };
75
- }
76
-
77
- var _default = _function;
78
- exports.default = _default;
@@ -1,61 +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 _getFromObject = _interopRequireDefault(require("../getFromObject"));
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
- function _get(_ref) {
30
- var {
31
- arrayIndices,
32
- env,
33
- location,
34
- params
35
- } = _ref;
36
-
37
- if (!_helpers.type.isObject(params)) {
38
- throw new Error("Operator Error: _get takes an object as params. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
39
- }
40
-
41
- if (params.from === null) return (0, _helpers.get)(params, 'default', {
42
- default: null,
43
- copy: true
44
- });
45
-
46
- if (!_helpers.type.isObject(params.from) && !_helpers.type.isArray(params.from)) {
47
- throw new Error("Operator Error: _get.from is not an object or array. Received: ".concat(JSON.stringify(params), " at ").concat(location, "."));
48
- }
49
-
50
- return (0, _getFromObject.default)({
51
- arrayIndices,
52
- env,
53
- location,
54
- object: params.from,
55
- operator: '_get',
56
- params
57
- });
58
- }
59
-
60
- var _default = _get;
61
- 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 _global(_ref) {
28
- var {
29
- arrayIndices,
30
- context,
31
- contexts,
32
- env,
33
- location,
34
- lowdefyGlobal,
35
- params
36
- } = _ref;
37
- return (0, _getFromObject.default)({
38
- arrayIndices,
39
- context,
40
- contexts,
41
- env,
42
- location,
43
- object: lowdefyGlobal,
44
- operator: '_global',
45
- params
46
- });
47
- }
48
-
49
- var _default = _global;
50
- exports.default = _default;
package/dist/common/gt.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 _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];
40
- }
41
-
42
- var _default = _gt;
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 _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];
40
- }
41
-
42
- var _default = _gte;
43
- exports.default = _default;
package/dist/common/if.js DELETED
@@ -1,41 +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 _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, "."));
38
- }
39
-
40
- var _default = _if;
41
- exports.default = _default;
@@ -1,47 +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 _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];
44
- }
45
-
46
- var _default = _if_none;
47
- 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 _input(_ref) {
28
- var {
29
- arrayIndices,
30
- context,
31
- contexts,
32
- env,
33
- input,
34
- location,
35
- params
36
- } = _ref;
37
- return (0, _getFromObject.default)({
38
- arrayIndices,
39
- context,
40
- contexts,
41
- env,
42
- location,
43
- object: input,
44
- operator: '_input',
45
- params
46
- });
47
- }
48
-
49
- var _default = _input;
50
- exports.default = _default;
@@ -1,64 +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 _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
-
20
- function parse(input) {
21
- if (input === 'undefined') return undefined;
22
- return _helpers.serializer.deserializeFromString(input);
23
- }
24
-
25
- function stringify(input, options) {
26
- return _helpers.serializer.serializeToString(input, _objectSpread({
27
- space: 2,
28
- isoStringDates: true
29
- }, options));
30
- }
31
-
32
- var functions = {
33
- parse,
34
- stringify
35
- };
36
- var meta = {
37
- stringify: {
38
- namedArgs: ['on', 'options'],
39
- validTypes: ['object', 'array']
40
- },
41
- parse: {
42
- singleArg: true,
43
- validTypes: ['string']
44
- }
45
- };
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
- });
61
- }
62
-
63
- var _default = _json;
64
- exports.default = _default;