@lowdefy/engine 3.23.2 → 4.0.0-alpha.10

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 (49) hide show
  1. package/dist/Actions.js +229 -309
  2. package/dist/Blocks.js +560 -608
  3. package/dist/Events.js +119 -163
  4. package/dist/Requests.js +105 -144
  5. package/dist/State.js +56 -82
  6. package/dist/actions/createCallMethod.js +29 -0
  7. package/dist/actions/{Reset.js → createDisplayMessage.js} +6 -21
  8. package/dist/actions/createGetActions.js +27 -0
  9. package/dist/actions/createGetBlockId.js +20 -0
  10. package/dist/actions/createGetEvent.js +27 -0
  11. package/dist/actions/createGetGlobal.js +27 -0
  12. package/dist/actions/createGetInput.js +27 -0
  13. package/dist/actions/createGetPageId.js +20 -0
  14. package/dist/actions/createGetRequestDetails.js +27 -0
  15. package/dist/actions/{Message.js → createGetState.js} +13 -23
  16. package/dist/actions/createGetUrlQuery.js +27 -0
  17. package/dist/actions/createGetUser.js +27 -0
  18. package/dist/actions/createLink.js +20 -0
  19. package/dist/actions/createLogin.js +20 -0
  20. package/dist/actions/createLogout.js +20 -0
  21. package/dist/actions/createRequest.js +25 -0
  22. package/dist/actions/createReset.js +23 -0
  23. package/dist/actions/createResetValidation.js +21 -0
  24. package/dist/actions/createSetGlobal.js +25 -0
  25. package/dist/actions/createSetState.js +25 -0
  26. package/dist/actions/createValidate.js +25 -0
  27. package/dist/actions/getActionMethods.js +61 -0
  28. package/dist/actions/getFromObject.js +42 -0
  29. package/dist/createLink.js +53 -60
  30. package/dist/getBlockMatcher.js +47 -59
  31. package/dist/getContext.js +106 -143
  32. package/dist/index.js +10 -71
  33. package/package.json +13 -13
  34. package/dist/actions/CallMethod.js +0 -47
  35. package/dist/actions/JsAction.js +0 -77
  36. package/dist/actions/Link.js +0 -38
  37. package/dist/actions/Login.js +0 -43
  38. package/dist/actions/Logout.js +0 -42
  39. package/dist/actions/Request.js +0 -65
  40. package/dist/actions/ResetValidation.js +0 -32
  41. package/dist/actions/ScrollTo.js +0 -52
  42. package/dist/actions/SetGlobal.js +0 -35
  43. package/dist/actions/SetState.js +0 -35
  44. package/dist/actions/Throw.js +0 -67
  45. package/dist/actions/Validate.js +0 -37
  46. package/dist/actions/Wait.js +0 -34
  47. package/dist/actions/index.js +0 -72
  48. package/dist/getFieldValues.js +0 -49
  49. package/dist/makeContextId.js +0 -44
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Throw = Throw;
7
- exports.ThrowActionError = exports.default = void 0;
8
-
9
- var _helpers = require("@lowdefy/helpers");
10
-
11
- /*
12
- Copyright 2020-2021 Lowdefy, Inc
13
-
14
- Licensed under the Apache License, Version 2.0 (the "License");
15
- you may not use this file except in compliance with the License.
16
- You may obtain a copy of the License at
17
-
18
- http://www.apache.org/licenses/LICENSE-2.0
19
-
20
- Unless required by applicable law or agreed to in writing, software
21
- distributed under the License is distributed on an "AS IS" BASIS,
22
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- See the License for the specific language governing permissions and
24
- limitations under the License.
25
- */
26
- class ThrowActionError extends Error {
27
- constructor(message, _ref) {
28
- var {
29
- blockId,
30
- context,
31
- metaData
32
- } = _ref;
33
- super(message);
34
- this.blockId = blockId;
35
- this.metaData = metaData;
36
- this.name = 'ThrowError';
37
- this.pageId = context.pageId;
38
- }
39
-
40
- }
41
-
42
- exports.ThrowActionError = ThrowActionError;
43
-
44
- function Throw(_ref2) {
45
- var {
46
- blockId,
47
- context,
48
- params = {}
49
- } = _ref2;
50
-
51
- if (params.throw === false || _helpers.type.isNone(params.throw)) {
52
- return;
53
- }
54
-
55
- if (params.throw === true) {
56
- throw new ThrowActionError(params.message, {
57
- blockId,
58
- context,
59
- metaData: params.metaData
60
- });
61
- }
62
-
63
- throw new Error("Invalid Throw, check action params. Received \"".concat(JSON.stringify(params), "\"."));
64
- }
65
-
66
- var _default = Throw;
67
- exports.default = _default;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _getBlockMatcher = _interopRequireDefault(require("../getBlockMatcher"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- 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); } }
13
-
14
- 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); }); }; }
15
-
16
- function Validate(_x) {
17
- return _Validate.apply(this, arguments);
18
- }
19
-
20
- function _Validate() {
21
- _Validate = _asyncToGenerator(function* (_ref) {
22
- var {
23
- context,
24
- params
25
- } = _ref;
26
- var validationErrors = context.RootBlocks.validate((0, _getBlockMatcher.default)(params));
27
-
28
- if (validationErrors.length > 0) {
29
- var error = new Error("Your input has ".concat(validationErrors.length, " validation error").concat(validationErrors.length !== 1 ? 's' : '', "."));
30
- throw error;
31
- }
32
- });
33
- return _Validate.apply(this, arguments);
34
- }
35
-
36
- var _default = Validate;
37
- exports.default = _default;
@@ -1,34 +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
- 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); } }
11
-
12
- 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); }); }; }
13
-
14
- function Wait(_x) {
15
- return _Wait.apply(this, arguments);
16
- }
17
-
18
- function _Wait() {
19
- _Wait = _asyncToGenerator(function* (_ref) {
20
- var {
21
- params
22
- } = _ref;
23
-
24
- if (!_helpers.type.isInt(params.ms)) {
25
- throw new Error("Wait action \"ms\" param should be an integer.");
26
- }
27
-
28
- return new Promise(resolve => setTimeout(resolve, params.ms));
29
- });
30
- return _Wait.apply(this, arguments);
31
- }
32
-
33
- var _default = Wait;
34
- exports.default = _default;
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _CallMethod = _interopRequireDefault(require("./CallMethod"));
9
-
10
- var _JsAction = _interopRequireDefault(require("./JsAction"));
11
-
12
- var _Link = _interopRequireDefault(require("./Link"));
13
-
14
- var _Login = _interopRequireDefault(require("./Login"));
15
-
16
- var _Logout = _interopRequireDefault(require("./Logout"));
17
-
18
- var _Message = _interopRequireDefault(require("./Message"));
19
-
20
- var _Request = _interopRequireDefault(require("./Request"));
21
-
22
- var _Reset = _interopRequireDefault(require("./Reset"));
23
-
24
- var _ResetValidation = _interopRequireDefault(require("./ResetValidation"));
25
-
26
- var _ScrollTo = _interopRequireDefault(require("./ScrollTo"));
27
-
28
- var _SetGlobal = _interopRequireDefault(require("./SetGlobal"));
29
-
30
- var _SetState = _interopRequireDefault(require("./SetState"));
31
-
32
- var _Throw = _interopRequireDefault(require("./Throw"));
33
-
34
- var _Validate = _interopRequireDefault(require("./Validate"));
35
-
36
- var _Wait = _interopRequireDefault(require("./Wait"));
37
-
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
-
40
- /*
41
- Copyright 2020-2021 Lowdefy, Inc
42
-
43
- Licensed under the Apache License, Version 2.0 (the "License");
44
- you may not use this file except in compliance with the License.
45
- You may obtain a copy of the License at
46
-
47
- http://www.apache.org/licenses/LICENSE-2.0
48
-
49
- Unless required by applicable law or agreed to in writing, software
50
- distributed under the License is distributed on an "AS IS" BASIS,
51
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
- See the License for the specific language governing permissions and
53
- limitations under the License.
54
- */
55
- var _default = {
56
- CallMethod: _CallMethod.default,
57
- JsAction: _JsAction.default,
58
- Link: _Link.default,
59
- Login: _Login.default,
60
- Logout: _Logout.default,
61
- Message: _Message.default,
62
- Request: _Request.default,
63
- Reset: _Reset.default,
64
- ResetValidation: _ResetValidation.default,
65
- ScrollTo: _ScrollTo.default,
66
- SetGlobal: _SetGlobal.default,
67
- SetState: _SetState.default,
68
- Throw: _Throw.default,
69
- Validate: _Validate.default,
70
- Wait: _Wait.default
71
- };
72
- exports.default = _default;
@@ -1,49 +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 getFieldValues(operatorName) {
26
- var result = new Set();
27
-
28
- function reviver(key, value) {
29
- if (key === operatorName) {
30
- result.add(value);
31
- }
32
-
33
- return value;
34
- }
35
-
36
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
37
- args[_key - 1] = arguments[_key];
38
- }
39
-
40
- [...args].forEach(element => {
41
- _helpers.serializer.deserializeFromString(_helpers.serializer.serializeToString(element), {
42
- reviver
43
- });
44
- });
45
- return [...result];
46
- }
47
-
48
- var _default = getFieldValues;
49
- exports.default = _default;
@@ -1,44 +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 makeContextId(_ref) {
26
- var {
27
- blockId,
28
- pageId,
29
- urlQuery = {}
30
- } = _ref;
31
-
32
- if (!_helpers.type.isString(blockId)) {
33
- throw new Error("Expected string for parameter blockId, received ".concat(blockId));
34
- }
35
-
36
- if (!_helpers.type.isString(pageId)) {
37
- throw new Error("Expected string for parameter pageId, received ".concat(pageId));
38
- }
39
-
40
- return "".concat(pageId, ":").concat(blockId, ":").concat(_helpers.serializer.serializeToString(urlQuery));
41
- }
42
-
43
- var _default = makeContextId;
44
- exports.default = _default;