@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.
- package/dist/Actions.js +229 -309
- package/dist/Blocks.js +560 -608
- package/dist/Events.js +119 -163
- package/dist/Requests.js +105 -144
- package/dist/State.js +56 -82
- package/dist/actions/createCallMethod.js +29 -0
- package/dist/actions/{Reset.js → createDisplayMessage.js} +6 -21
- package/dist/actions/createGetActions.js +27 -0
- package/dist/actions/createGetBlockId.js +20 -0
- package/dist/actions/createGetEvent.js +27 -0
- package/dist/actions/createGetGlobal.js +27 -0
- package/dist/actions/createGetInput.js +27 -0
- package/dist/actions/createGetPageId.js +20 -0
- package/dist/actions/createGetRequestDetails.js +27 -0
- package/dist/actions/{Message.js → createGetState.js} +13 -23
- package/dist/actions/createGetUrlQuery.js +27 -0
- package/dist/actions/createGetUser.js +27 -0
- package/dist/actions/createLink.js +20 -0
- package/dist/actions/createLogin.js +20 -0
- package/dist/actions/createLogout.js +20 -0
- package/dist/actions/createRequest.js +25 -0
- package/dist/actions/createReset.js +23 -0
- package/dist/actions/createResetValidation.js +21 -0
- package/dist/actions/createSetGlobal.js +25 -0
- package/dist/actions/createSetState.js +25 -0
- package/dist/actions/createValidate.js +25 -0
- package/dist/actions/getActionMethods.js +61 -0
- package/dist/actions/getFromObject.js +42 -0
- package/dist/createLink.js +53 -60
- package/dist/getBlockMatcher.js +47 -59
- package/dist/getContext.js +106 -143
- package/dist/index.js +10 -71
- package/package.json +13 -13
- package/dist/actions/CallMethod.js +0 -47
- package/dist/actions/JsAction.js +0 -77
- package/dist/actions/Link.js +0 -38
- package/dist/actions/Login.js +0 -43
- package/dist/actions/Logout.js +0 -42
- package/dist/actions/Request.js +0 -65
- package/dist/actions/ResetValidation.js +0 -32
- package/dist/actions/ScrollTo.js +0 -52
- package/dist/actions/SetGlobal.js +0 -35
- package/dist/actions/SetState.js +0 -35
- package/dist/actions/Throw.js +0 -67
- package/dist/actions/Validate.js +0 -37
- package/dist/actions/Wait.js +0 -34
- package/dist/actions/index.js +0 -72
- package/dist/getFieldValues.js +0 -49
- package/dist/makeContextId.js +0 -44
package/dist/State.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
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
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
12
3
|
|
|
13
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,79 +12,62 @@ 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
|
-
class State {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.freezeState = this.freezeState.bind(this);
|
|
35
|
-
this.resetState = this.resetState.bind(this);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
resetState() {
|
|
39
|
-
Object.keys(this.context.state).forEach(key => {
|
|
40
|
-
delete this.context.state[key];
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
var frozenCopy = _helpers.serializer.deserializeFromString(this.frozenState);
|
|
44
|
-
|
|
45
|
-
Object.keys(frozenCopy).forEach(key => {
|
|
46
|
-
this.set(key, frozenCopy[key]);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
freezeState() {
|
|
51
|
-
if (!this.initialized) {
|
|
52
|
-
this.frozenState = _helpers.serializer.serializeToString(this.context.state);
|
|
53
|
-
this.initialized = true;
|
|
15
|
+
*/ import { unset, get, serializer, set, swap, type } from '@lowdefy/helpers';
|
|
16
|
+
let State = class State {
|
|
17
|
+
resetState() {
|
|
18
|
+
Object.keys(this.context.state).forEach((key)=>{
|
|
19
|
+
delete this.context.state[key];
|
|
20
|
+
});
|
|
21
|
+
const frozenCopy = serializer.deserializeFromString(this.frozenState);
|
|
22
|
+
Object.keys(frozenCopy).forEach((key)=>{
|
|
23
|
+
this.set(key, frozenCopy[key]);
|
|
24
|
+
});
|
|
54
25
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
del(field) {
|
|
62
|
-
(0, _helpers.unset)(this.context.state, field); // remove all empty objects from state as an effect of deleted values
|
|
63
|
-
|
|
64
|
-
var fields = field.split('.');
|
|
65
|
-
|
|
66
|
-
if (fields.length > 1) {
|
|
67
|
-
var parent = fields.slice(0, fields.length - 1).join('.');
|
|
68
|
-
var parentValue = (0, _helpers.get)(this.context.state, parent);
|
|
69
|
-
|
|
70
|
-
if (_helpers.type.isObject(parentValue) && Object.keys(parentValue).length === 0) {
|
|
71
|
-
this.del(parent);
|
|
72
|
-
}
|
|
26
|
+
freezeState() {
|
|
27
|
+
if (!this.initialized) {
|
|
28
|
+
this.frozenState = serializer.serializeToString(this.context.state);
|
|
29
|
+
this.initialized = true;
|
|
30
|
+
}
|
|
73
31
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
swapItems(field, from, to) {
|
|
77
|
-
var arr = (0, _helpers.get)(this.context.state, field);
|
|
78
|
-
|
|
79
|
-
if (!_helpers.type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
|
80
|
-
return;
|
|
32
|
+
set(field, value) {
|
|
33
|
+
set(this.context.state, field, value);
|
|
81
34
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
35
|
+
del(field) {
|
|
36
|
+
unset(this.context.state, field);
|
|
37
|
+
// remove all empty objects from state as an effect of deleted values
|
|
38
|
+
const fields = field.split('.');
|
|
39
|
+
if (fields.length > 1) {
|
|
40
|
+
const parent = fields.slice(0, fields.length - 1).join('.');
|
|
41
|
+
const parentValue = get(this.context.state, parent);
|
|
42
|
+
if (type.isObject(parentValue) && Object.keys(parentValue).length === 0) {
|
|
43
|
+
this.del(parent);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
91
46
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
47
|
+
swapItems(field, from, to) {
|
|
48
|
+
const arr = get(this.context.state, field);
|
|
49
|
+
if (!type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
swap(arr, from, to);
|
|
53
|
+
}
|
|
54
|
+
removeItem(field, index) {
|
|
55
|
+
const arr = get(this.context.state, field);
|
|
56
|
+
if (!type.isArray(arr) || index < 0 || index >= arr.length) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
arr.splice(index, 1);
|
|
60
|
+
}
|
|
61
|
+
constructor(context){
|
|
62
|
+
this.context = context;
|
|
63
|
+
this.frozenState = null;
|
|
64
|
+
this.initialized = false;
|
|
65
|
+
this.set = this.set.bind(this);
|
|
66
|
+
this.del = this.del.bind(this);
|
|
67
|
+
this.swapItems = this.swapItems.bind(this);
|
|
68
|
+
this.removeItem = this.removeItem.bind(this);
|
|
69
|
+
this.freezeState = this.freezeState.bind(this);
|
|
70
|
+
this.resetState = this.resetState.bind(this);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
export default State;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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, type } from '@lowdefy/helpers';
|
|
16
|
+
function createCallMethod({ arrayIndices , context }) {
|
|
17
|
+
return function callMethod(params) {
|
|
18
|
+
const { blockId , method , args =[] } = params;
|
|
19
|
+
const blockMethod = context._internal.RootBlocks.map[applyArrayIndices(arrayIndices, blockId)].methods[method];
|
|
20
|
+
if (!type.isArray(args)) {
|
|
21
|
+
throw new Error(`Failed to call method "${method}" on block "${blockId}": "args" should be an array. Received "${JSON.stringify(params)}".`);
|
|
22
|
+
}
|
|
23
|
+
if (!type.isFunction(blockMethod)) {
|
|
24
|
+
throw new Error(`Failed to call method "${method}" on block "${blockId}". Check if "${method}" is a valid block method for block "${blockId}". Received "${JSON.stringify(params)}".`);
|
|
25
|
+
}
|
|
26
|
+
return blockMethod(...args);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export default createCallMethod;
|
|
@@ -1,14 +1,5 @@
|
|
|
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
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
12
3
|
|
|
13
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,15 +12,9 @@ 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
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = _ref;
|
|
29
|
-
context.State.resetState();
|
|
30
|
-
context.RootBlocks.reset(_helpers.serializer.deserializeFromString(context.State.frozenState));
|
|
31
|
-
context.update();
|
|
15
|
+
*/ function createDisplayMessage({ context }) {
|
|
16
|
+
return function displayMessage(params = {}) {
|
|
17
|
+
context._internal.lowdefy._internal.displayMessage(params);
|
|
18
|
+
};
|
|
32
19
|
}
|
|
33
|
-
|
|
34
|
-
var _default = Reset;
|
|
35
|
-
exports.default = _default;
|
|
20
|
+
export default createDisplayMessage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetActions({ actions , arrayIndices , blockId }) {
|
|
17
|
+
return function getActions(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: actions,
|
|
22
|
+
method: 'getActions',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetActions;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createGetBlockId({ blockId }) {
|
|
16
|
+
return function getBlockId() {
|
|
17
|
+
return blockId;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createGetBlockId;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetEvent({ arrayIndices , blockId , event }) {
|
|
17
|
+
return function getEvent(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: event,
|
|
22
|
+
method: 'getEvent',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetEvent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetGlobal({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getGlobal(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.lowdefyGlobal,
|
|
22
|
+
method: 'getGlobal',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetGlobal;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetInput({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getInput(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.inputs[context.id],
|
|
22
|
+
method: 'getInput',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetInput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createGetPageId({ context }) {
|
|
16
|
+
return function getPageId() {
|
|
17
|
+
return context.pageId;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createGetPageId;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
const createGetRequestDetails = ({ arrayIndices , blockId , context })=>{
|
|
17
|
+
return function getRequestDetails(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context.requests,
|
|
22
|
+
method: 'getRequestDetails',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default createGetRequestDetails;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
1
|
/*
|
|
9
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
10
3
|
|
|
11
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,19 +12,16 @@ 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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
15
|
+
*/ import getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetState({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getState(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context.state,
|
|
22
|
+
method: 'getState',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
34
26
|
}
|
|
35
|
-
|
|
36
|
-
var _default = Message;
|
|
37
|
-
exports.default = _default;
|
|
27
|
+
export default createGetState;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetUrlQuery({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getUrlQuery(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.urlQuery,
|
|
22
|
+
method: 'getUrlQuery',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetUrlQuery;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getFromObject from './getFromObject.js';
|
|
16
|
+
function createGetUser({ arrayIndices , blockId , context }) {
|
|
17
|
+
return function getUser(params) {
|
|
18
|
+
return getFromObject({
|
|
19
|
+
arrayIndices,
|
|
20
|
+
location: blockId,
|
|
21
|
+
object: context._internal.lowdefy.user,
|
|
22
|
+
method: 'getUser',
|
|
23
|
+
params
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default createGetUser;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createLink({ context }) {
|
|
16
|
+
return function link(params) {
|
|
17
|
+
context._internal.lowdefy._internal.link(params);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createLink;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createLogin({ context }) {
|
|
16
|
+
return function login(params) {
|
|
17
|
+
return context._internal.lowdefy._internal.auth.login(params);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createLogin;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createLogout({ context }) {
|
|
16
|
+
return function logout() {
|
|
17
|
+
return context._internal.lowdefy._internal.auth.logout();
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export default createLogout;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
*/ function createRequest({ actions , arrayIndices , context , event }) {
|
|
16
|
+
return async function request(params) {
|
|
17
|
+
return await context._internal.Requests.callRequests({
|
|
18
|
+
actions,
|
|
19
|
+
arrayIndices,
|
|
20
|
+
event,
|
|
21
|
+
params
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export default createRequest;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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
|
+
function createReset({ context }) {
|
|
17
|
+
return function reset() {
|
|
18
|
+
context._internal.State.resetState();
|
|
19
|
+
context._internal.RootBlocks.reset(serializer.deserializeFromString(context._internal.State.frozenState));
|
|
20
|
+
context._internal.update();
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default createReset;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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 getBlockMatcher from '../getBlockMatcher.js';
|
|
16
|
+
function createResetValidation({ context }) {
|
|
17
|
+
return function resetValidation(params) {
|
|
18
|
+
context._internal.RootBlocks.resetValidation(getBlockMatcher(params));
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export default createResetValidation;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2022 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, set } from '@lowdefy/helpers';
|
|
16
|
+
const createSetGlobal = ({ arrayIndices , context })=>{
|
|
17
|
+
return function setGlobal(params) {
|
|
18
|
+
Object.keys(params).forEach((key)=>{
|
|
19
|
+
set(context._internal.lowdefy._internal.lowdefyGlobal, applyArrayIndices(arrayIndices, key), params[key]);
|
|
20
|
+
});
|
|
21
|
+
context._internal.RootBlocks.reset();
|
|
22
|
+
context._internal.update();
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default createSetGlobal;
|