@lowdefy/engine 4.0.0-alpha.1 → 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 +80 -71
- package/dist/Blocks.js +67 -85
- package/dist/Events.js +14 -16
- package/dist/Requests.js +15 -20
- package/dist/State.js +8 -8
- package/dist/actions/createCallMethod.js +29 -0
- package/dist/actions/{Request.js → createDisplayMessage.js} +6 -9
- package/dist/actions/createGetActions.js +27 -0
- package/dist/actions/{Logout.js → createGetBlockId.js} +6 -4
- package/dist/actions/createGetEvent.js +27 -0
- package/dist/actions/createGetGlobal.js +27 -0
- package/dist/actions/createGetInput.js +27 -0
- package/dist/actions/{Login.js → createGetPageId.js} +6 -4
- package/dist/actions/createGetRequestDetails.js +27 -0
- package/dist/actions/{Wait.js → createGetState.js} +13 -9
- 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/{Message.js → createRequest.js} +11 -10
- package/dist/actions/{Reset.js → createReset.js} +8 -6
- package/dist/actions/{ResetValidation.js → createResetValidation.js} +6 -4
- package/dist/actions/{SetGlobal.js → createSetGlobal.js} +11 -9
- package/dist/actions/{SetState.js → createSetState.js} +10 -8
- package/dist/actions/{Validate.js → createValidate.js} +10 -8
- package/dist/actions/getActionMethods.js +61 -0
- package/dist/actions/getFromObject.js +42 -0
- package/dist/createLink.js +46 -23
- package/dist/getBlockMatcher.js +1 -1
- package/dist/getContext.js +37 -32
- package/dist/index.js +1 -1
- package/package.json +9 -8
- package/dist/actions/CallMethod.js +0 -28
- package/dist/actions/JsAction.js +0 -55
- package/dist/actions/Link.js +0 -27
- package/dist/actions/ScrollTo.js +0 -26
- package/dist/actions/Throw.js +0 -40
- package/dist/actions/index.js +0 -46
- package/dist/getFieldValues.js +0 -35
package/dist/Requests.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { get, serializer, type } from '@lowdefy/helpers';
|
|
16
16
|
let Requests = class Requests {
|
|
17
|
-
callRequests({ actions , arrayIndices , event , params } = {
|
|
18
|
-
|
|
19
|
-
if (params.all === true) {
|
|
17
|
+
callRequests({ actions , arrayIndices , event , params } = {}) {
|
|
18
|
+
if (type.isObject(params) && params.all === true) {
|
|
20
19
|
return Promise.all(Object.keys(this.requestConfig).map((requestId)=>this.callRequest({
|
|
21
20
|
requestId,
|
|
22
21
|
event,
|
|
@@ -37,7 +36,7 @@ let Requests = class Requests {
|
|
|
37
36
|
})
|
|
38
37
|
));
|
|
39
38
|
}
|
|
40
|
-
callRequest({ actions
|
|
39
|
+
callRequest({ actions , arrayIndices , event , requestId }) {
|
|
41
40
|
const request = this.requestConfig[requestId];
|
|
42
41
|
if (!request) {
|
|
43
42
|
const error = new Error(`Configuration Error: Request ${requestId} not defined on page.`);
|
|
@@ -58,9 +57,9 @@ let Requests = class Requests {
|
|
|
58
57
|
};
|
|
59
58
|
}
|
|
60
59
|
const { output: payload , errors: parserErrors } = this.context._internal.parser.parse({
|
|
61
|
-
actions
|
|
62
|
-
event
|
|
63
|
-
arrayIndices
|
|
60
|
+
actions,
|
|
61
|
+
event,
|
|
62
|
+
arrayIndices,
|
|
64
63
|
input: request.payload,
|
|
65
64
|
location: requestId
|
|
66
65
|
});
|
|
@@ -73,27 +72,24 @@ let Requests = class Requests {
|
|
|
73
72
|
payload
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
async fetch({ requestId
|
|
77
|
-
this.context.requests[
|
|
78
|
-
if (this.context._internal.RootBlocks) {
|
|
79
|
-
this.context._internal.RootBlocks.setBlocksLoadingCache();
|
|
80
|
-
}
|
|
75
|
+
async fetch({ requestId , payload }) {
|
|
76
|
+
this.context.requests[requestId].loading = true;
|
|
81
77
|
try {
|
|
82
78
|
const response = await this.context._internal.lowdefy._internal.callRequest({
|
|
83
79
|
pageId: this.context.pageId,
|
|
84
80
|
payload: serializer.serialize(payload),
|
|
85
|
-
requestId
|
|
81
|
+
requestId
|
|
86
82
|
});
|
|
87
83
|
const deserializedResponse = serializer.deserialize(get(response, 'response', {
|
|
88
84
|
default: null
|
|
89
85
|
}));
|
|
90
|
-
this.context.requests[
|
|
91
|
-
this.context.requests[
|
|
86
|
+
this.context.requests[requestId].response = deserializedResponse;
|
|
87
|
+
this.context.requests[requestId].loading = false;
|
|
92
88
|
this.context._internal.update();
|
|
93
89
|
return deserializedResponse;
|
|
94
90
|
} catch (error) {
|
|
95
|
-
this.context.requests[
|
|
96
|
-
this.context.requests[
|
|
91
|
+
this.context.requests[requestId].error.unshift(error);
|
|
92
|
+
this.context.requests[requestId].loading = false;
|
|
97
93
|
this.context._internal.update();
|
|
98
94
|
throw error;
|
|
99
95
|
}
|
|
@@ -103,8 +99,7 @@ let Requests = class Requests {
|
|
|
103
99
|
this.callRequests = this.callRequests.bind(this);
|
|
104
100
|
this.callRequest = this.callRequest.bind(this);
|
|
105
101
|
this.fetch = this.fetch.bind(this);
|
|
106
|
-
this.requestConfig = {
|
|
107
|
-
};
|
|
102
|
+
this.requestConfig = {};
|
|
108
103
|
(this.context._internal.rootBlock.requests || []).forEach((request)=>{
|
|
109
104
|
this.requestConfig[request.requestId] = request;
|
|
110
105
|
});
|
package/dist/State.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -32,10 +32,10 @@ let State = class State {
|
|
|
32
32
|
set(field, value) {
|
|
33
33
|
set(this.context.state, field, value);
|
|
34
34
|
}
|
|
35
|
-
del(
|
|
36
|
-
unset(this.context.state,
|
|
35
|
+
del(field) {
|
|
36
|
+
unset(this.context.state, field);
|
|
37
37
|
// remove all empty objects from state as an effect of deleted values
|
|
38
|
-
const fields =
|
|
38
|
+
const fields = field.split('.');
|
|
39
39
|
if (fields.length > 1) {
|
|
40
40
|
const parent = fields.slice(0, fields.length - 1).join('.');
|
|
41
41
|
const parentValue = get(this.context.state, parent);
|
|
@@ -44,15 +44,15 @@ let State = class State {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
swapItems(
|
|
48
|
-
const arr = get(this.context.state,
|
|
47
|
+
swapItems(field, from, to) {
|
|
48
|
+
const arr = get(this.context.state, field);
|
|
49
49
|
if (!type.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
swap(arr, from, to);
|
|
53
53
|
}
|
|
54
|
-
removeItem(
|
|
55
|
-
const arr = get(this.context.state,
|
|
54
|
+
removeItem(field, index) {
|
|
55
|
+
const arr = get(this.context.state, field);
|
|
56
56
|
if (!type.isArray(arr) || index < 0 || index >= arr.length) {
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,12 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
event,
|
|
20
|
-
params
|
|
21
|
-
});
|
|
15
|
+
*/ function createDisplayMessage({ context }) {
|
|
16
|
+
return function displayMessage(params = {}) {
|
|
17
|
+
context._internal.lowdefy._internal.displayMessage(params);
|
|
18
|
+
};
|
|
22
19
|
}
|
|
23
|
-
export 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
15
|
+
*/ function createGetBlockId({ blockId }) {
|
|
16
|
+
return function getBlockId() {
|
|
17
|
+
return blockId;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
|
-
export default
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
return
|
|
15
|
+
*/ function createGetPageId({ context }) {
|
|
16
|
+
return function getPageId() {
|
|
17
|
+
return context.pageId;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
|
-
export default
|
|
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,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
};
|
|
22
26
|
}
|
|
23
|
-
export 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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
};
|
|
23
24
|
}
|
|
24
|
-
export default
|
|
25
|
+
export default createRequest;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { serializer } from '@lowdefy/helpers';
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
};
|
|
20
22
|
}
|
|
21
|
-
export default
|
|
23
|
+
export default createReset;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import getBlockMatcher from '../getBlockMatcher.js';
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
function createResetValidation({ context }) {
|
|
17
|
+
return function resetValidation(params) {
|
|
18
|
+
context._internal.RootBlocks.resetValidation(getBlockMatcher(params));
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
|
-
export default
|
|
21
|
+
export default createResetValidation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { applyArrayIndices, set } from '@lowdefy/helpers';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2022 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { applyArrayIndices } from '@lowdefy/helpers';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
function createSetState({ arrayIndices , context }) {
|
|
17
|
+
return function setState(params) {
|
|
18
|
+
Object.keys(params).forEach((key)=>{
|
|
19
|
+
context._internal.State.set(applyArrayIndices(arrayIndices, key), params[key]);
|
|
20
|
+
});
|
|
21
|
+
context._internal.RootBlocks.reset();
|
|
22
|
+
context._internal.update();
|
|
23
|
+
};
|
|
22
24
|
}
|
|
23
|
-
export default
|
|
25
|
+
export default createSetState;
|